ChartDirector Ver 3.1 (PHP Edition Edition)

Installing ChartDirector for PHP


PHP Version Compatibility

ChartDirector for PHP on Windows requires at least PHP versions 4.0.4pl1, and has been tested up to PHP 5.0.0 (the latest PHP release as of the date of this document).

Extracting the ChartDirector Distribution

ChartDirector for PHP is releaed in Windows, Linux, FreeBSD and Solaris editions. Before we start installation, you may want to verify the ChartDirector distribution you have downloaded is for your operating system by using the table below. If you do not know what is your operating system (eg. you are using a remote host), you may use phpinfo to find out.

Operating SystemFile Name
Windowschartdir_php_win32.zip
Linuxchartdir_php_linux.tar.gz
FreeBSDchartdir_php_freebsd.tar.gz
Solarischartdir_php_sunos.tar.gz

To install ChartDirector for PHP, extract the files from the ChartDirector distribution to your web server HTML directory (or any directory that allow PHP scripts to execute):

If you cannot access the command prompt (eg. you are using a remote host with no telnet access), you may extract ChartDirector on a local machine first (eg. using Winzip), then upload the files to your host using FTP.

If the connection to your remote host is not fast, you may consider to upload only the "ChartDirector/phpdemo" and "ChartDirector/lib" subdirectories, while keeping the documentation "ChartDirector/doc" in your local machine.

Verifying Your PHP Configuration

The core of ChartDirector is implemented as a PHP extension. If your PHP system supports dynamic loading of extensions, ChartDirector will automatically load the ChartDirector PHP extension when needed. Therefore, no PHP configuration is required to use ChartDirector.

However, the following types of PHP do not support dynamic loading of extensions or have restrictions. For these types of PHP, you may need to put an extension statement in php.ini to load ChartDirector.

You may use phpinfo to find out if the your PHP system belongs to one of the above types. Another method is to simply try the ChartDirector for PHP sample scripts to see if they work.

To try the sample scripts, use the following URL to view the sample scripts index page (note: the exact URL depends on where you have extracted ChartDirector to).

http://aaa.bbb.ccc.ddd/ChartDirector/phpdemo/index.php

In the sample scripts index page, there is a "check installation" link on the right window. If it returns the ChartDirector version along with some other information, then dynamic loading of ChartDirector is successful.

On the other hand, if it returns an error message saying "use extension statement in php.ini to load ChartDirector", you would need to use extension statement to load ChartDirector.

If you are seeing other error message (eg. "Permission Denied"), please refer to Trouble-Shooting ChartDirector for PHP Installation for trouble-shooting instructions. Note that messages in the "Boot Log" or the "Font Loading Test" are informational only and are not error messages.

Use Extension Statement in php.ini to Load ChartDirector

You need to use extension statement to load ChartDirector if your PHP does not support dynamic loading of extensions.

If your PHP supports dynamic loading of extensions, using extension statement is optional and may improve performance. It is because by using extension statement, instead of dynamically loading ChartDirector everytime when it is needed, PHP will just pre-load it once during initialization.

To use extension statement in php.ini to load ChartDirector:

Installing the License Key

If you have purchased a license to use ChartDirector, you should receive a license key by email and/or by post.

Note that even without a license key, ChartDirector is fully functional and will not expire, but the charts generated will contain a small yellow banner at the bottom. The yellow banner will disappear once you install the license key.

To install the license key, follow the steps below:

For license installation issues, please refer to http://www.advsofteng.com/license_diag.html for trouble-shooting instructions.

Running the ChartDirector Sample Scripts

ChartDirector for PHP comes with a number of sample PHP scripts under the "ChartDirector/phpdemo" directory. They are good examples and tutorials on how to use ChartDirector.

To try the sample scripts, use the following URL to view the sample scripts index page (note: the exact URL depends on where you have extracted ChartDirector to).

http://aaa.bbb.ccc.ddd/ChartDirector/phpdemo/index.php

If ChartDirector is installed correctly, you should see sample charts being generated by the sample PHP programs as you click through the links in the "index.php" page.

If for some reason, you cannot see the charts, please refer to Trouble-Shooting ChartDirector for PHP Installation for trouble-shooting instructions.

Using ChartDirector for PHP in Your Own Scripts

To use ChartDirector, please include the ChartDirector script "phpchartdir.php" in your own script using the PHP "require_once" statement. For example, all ChartDirector sample scripts use the following line to include "phpchartdir.php":

require_once("../lib/phpchartdir.php");

For your own scripts, you may copy everything in "ChartDirector/lib" (including the fonts subdirectory for Linux/FreeBSD/Solaris version) to your script directory. You may then use the following line to include "phpchartdir.php":

require_once("phpchartdir.php");

Another option is to copy everything in "ChartDirector/lib" to your PHP extension directory (you may have already done that if you are using extension statement to load ChartDirector). In this case, you just need to copy one file "phpchartdir.php" to your script directory. It will search for the other ChartDirector files in the PHP extension directory.

Note that require_once assume the path is a file system path. If you use an absolute path name (eg. a path name starting with a slash "/"), the root is the file system root directory, not the web server root directory.