ChartDirector 6.0 (PHP Edition)
Installing ChartDirector for PHP
PHP Version Compatibility
ChartDirector for PHP requires at least PHP 4.0.4pl1. ChartDirector has been tested up to PHP 5.6, which is the latest PHP release as of the writing of this document.
Note: ChartDirector for PHP on Mac OS X, Solaris (x86), Linux (x86_64) and FreeBSD (AMD64) only supports PHP 4.2.1 or above.
Extracting the ChartDirector Distribution
ChartDirector for PHP is supported on Windows, Linux, FreeBSD, Mac OS X and Solaris. Before installation, please verify the ChartDirector distribution you have downloaded is for the operating system edition of PHP you are using. (See table below.) If you are not sure the type of PHP you are using, you may use phpinfo
to find out.
Note for 64-bit Windows: As of the writing of this document, it is common to use 32-bit PHP on 64-bit Windows. If you are using 32-bit Windows PHP, you should use the Windows (32-bit) edition of "ChartDirector for PHP", even if the operating system is Windows 64-bit.
|Operating System||File Name |
|Linux (x86_64 - 64bit OS)||chartdir_php_linux_64.tar.gz|
|Mac OS X (Power PC/Intel)||chartdir_php_mac.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 are using Windows, please unzip the ChartDirector distribution.
- If you are using Linux, FreeBSD, Mac OS X or Solaris, first copy the ChartDirector distribution to your web server HTML directory, then change to your web server HTML directory, and issue the following commands:
tar xvf [chartdir_file_name].tar
If you cannot access the command prompt (eg. you are using a remote host with no telnet or ssh access), you may extract ChartDirector to a local machine first, then upload the files to your host using FTP. If the connection to your remote host is not fast, you may upload only the "ChartDirector/phpdemo" and "ChartDirector/lib" subdirectories, and keep the "ChartDirector/doc" (containing the documentation) in your local machine.
Installing ChartDirector for PHP
ChartDirector for PHP is implemented as a PHP extension in "ChartDirector/lib". There is also an include file "phpchartdir.php", which interfaces PHP scripts with ChartDirector PHP extension.
Modern versions of PHP (5.3.0 or above) requires all PHP extensions to be copied to the PHP extension directory
, and be loaded using extension statements in the PHP configuration file php.ini
Older versions of PHP (before PHP 5.3.0) may allow PHP extensions to be loaded dynamically without using "php.ini", in which case "phpchartdir.php" will try to load the ChartDirector extension from the PHP extension directory automatically. PHP 5.2.4 or earlier may not require copying PHP extensions to the PHP extension directory, in which case "phpchartdir.php" will try to load the ChartDirector extension from both the PHP extension directory and the directory that contains "phpchartdir.php".
The following installation method is based on the more restrictive requirements of PHP 5.3.0 or above, which also works on all earlier PHP versions.
If you cannot modify the "php.ini" or add files to the PHP extension directory (eg. due to limited access rights), you may refer to Considerations for Shared Hosting
for some suggestions.
Running 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).
In the sample scripts index page, there is a "check installation" link in the right window. Please click on that link. If it displays the ChartDirector version with some other information, it can be confirmed that ChartDirector is installed successfully. Note that messages in the "Boot Log" or the "Font Loading Test" are informational only and are not error messages.
After confirming that ChartDirector is installed successfully, you may click the links in the left window to see the sample charts.
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":
Note that require_once assumes the path is a file system path, not a URL. If you use an absolute path name (eg. a path name starting with a slash "/"), the root is the root of the hard disk, not the root of the web document directory.
Installing the ChartDirector License
If you have purchased a license to use ChartDirector, you should have a license key delivered to your via email and postal mail.
If your license key is for upgrading from a previous version of ChartDirector, you need to append the upgrade license key to the previous version license key, and use the combined license key.
There are two alternative methods to install the license key.
- Create a one-line ASCII file using Notepad or other text editor, and put the license key in that line. The whole file should contain only the license key. Name that file "chartdir.lic" and put the file in the same directory as the active "libchartdir.so" (for Linux, FreeBSD, Mac OS X and Solaris) or "chartdir.dll" (for Windows), which should be in the "ChartDirector/lib" directory or your PHP extension directory.
If the license file appears to have no effect (does not disable the yellow banner line), and you are running on a web server environment, please make sure the web server "anonymous user" has read access to the "chartdir.lic" file. You may copy the file "ChartDirector/phpdemo/cdinfo.php" to your web server and access it using a browser. It will display a diagnostic page explaining why the license cannot be loaded.
Make sure your license file is called "chartdir.lic". In particular, Notepad may automatically append ".txt" to the file name when creating a new file. So even if the file is saved as "chartdir.lic", it may end up as "chartdir.lic.txt". If this is the case, please rename the file back to "chartdir.lic".
- An alternative method is to hard code the license key into the source code by using the setLicenseCode API. This method is recommended if your are redistributing ChartDirector, because your customer will then be unable to see the license key (unless your software is open source).
© 2015 Advanced Software Engineering Limited. All rights reserved.