You are here: Home / Debian GNU/Linux / Servers / PHP / Install the ChartDirector PHP extension on Debian

Install the ChartDirector PHP extension on Debian

by Pierre-Yves Landuré last modified Nov 11, 2017 09:45

ChartDirector is a chart generation tool used by some PHP applications (for example, EggCRM). This howto ease its installation on Debian GNU/Linux.

This how-to is tested on:

  • Debian 6.0 Squeeze
  • Debian 7.0 Wheezy

Prerequisites

This how-to needs :

Installation

Detect PHP extension configuration path:

MODS_CONF_PATH='/etc/php5/conf.d'
test -d '/etc/php5/mods-available' \
  && MODS_CONF_PATH='/etc/php5/mods-available'

Detect the system architecture:

ARCH="$(command dpkg --print-architecture)"
if [ "${ARCH}" = "i386" ]; then
  ARCH=""
elif [ "${ARCH}" = "amd64" ]; then
  ARCH="_64"
fi

Detect the PHP version:

PHP_VERSION="$(command php -v \
    | command grep 'PHP 5' \
    | command sed -e 's/PHP \(.\)\.\(.\).*$/\1\20/')"

Software installation

Download the archive for the detected architecture:

command wget "http://download2.advsofteng.com/chartdir_php_linux${ARCH}.tar.gz" \
    --output-document='/tmp/chardir_php_linux.tar.gz'

Extract the archive:

command tar --directory='/usr/lib/php5' -xzf '/tmp/chardir_php_linux.tar.gz'

Set up PHP to use the extension:

echo "; configuration for php Pinba module
; priority=20
extension=/usr/lib/php5/ChartDirector/lib/phpchartdir${PHP_VERSION}.dll" \
> "${MODS_CONF_PATH}/chartdirector.ini"
test -n "$(command -v php5enmod)" && command php5enmod 'chartdirector'

Reload the configuration:

test -e '/etc/init.d/php5-fpm' && command service 'php5-fpm' 'restart'
test -e '/etc/init.d/apache2' && command service 'apache2' 'force-reload'

Thanks