ChartDirector 7.0 (PHP Edition)
Installing ChartDirector for PHP
PHP Version Compatibility
ChartDirector for PHP requires PHP 5.0 or later. ChartDirector has been tested up to PHP 8.4, which is the latest PHP release as of the writing of this document.
Extracting the ChartDirector Distribution
ChartDirector for PHP is supported on Windows, Linux and macOS. Please verify the ChartDirector distribution you have downloaded is for the operating system edition of PHP you are using. If you are not sure the type of PHP you are using, you may use
phpinfo to find out.
Note for Windows: As 64-bit Windows can also run 32-bit applications, it is not uncommon for 32-bit PHP to be installed 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.
Note for Linux: ChartDirector supports 4 types of Linux architectures - 32-bit Intel (i386/i686), 64-bit Intel (x86_64), 32-bit ARM (such as armv7l) and 64-bit ARM (aarch64). Make sure you download the ChartDirector edition that matches your Linux architecture.
Note for macOS: ChartDirector for PHP on macOS is a universal binary that supports both Intel and Apple silicon CPUs.
To get started, you may extract the files from the ChartDirector distribution to your web server HTML directory.
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 the ChartDirector PHP extension.
To install the ChartDirector PHP extension, simply add a line to the PHP configuration file, then restart PHP.
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).
http://aaa.bbb.ccc.ddd/ChartDirector/phpdemo/index.php
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":
require_once("../lib/phpchartdir.php");
Note that require_once assumes the path is a file system path, not a URL. If the path starts with a slash "/", the slash refers to the file system root, not the web document root.
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. Please install the license key as according to the following instructions.
Even without a license key, ChartDirector will work normally, but the charts will include a yellow bar at the bottom that marks the charts as produced by the "unregistered" ChartDirector. You can freely test ChartDirector for as long as necessary.
If your license key is for upgrading from a previous version of ChartDirector, please append the upgrade license key to the previous version license key, and use the combined license key.
ChartDirector Developer License
Please follow the steps below to install the license key for the "ChartDirector Developer License":
- Create an ASCII file using Notepad or other text editor, and put the license key in it. The whole file should contain only the license key. Save the file as "chartdir.lic".
Note that some text editors, such as Notepad, may automatically append ".txt" to the filename. If file is saved as "chartdir.lic", it may end up as "chartdir.lic.txt". In this case, please rename the file back to "chartdir.lic".
- Copy the "chartdir.lic" to the windows directory (normally "c:\windows" on Windows) or the "/etc" directory (for Linux/macOS).
The above directory is a system directory and may require administrative privileges for write access. If you are copying using the command prompt, please make sure you use "Run As administrator" to start the command prompt (for Windows), or use "sudo" (for Linux/macOS).
- If you cannot copy to a system directory (eg. due to lack of administrative privilege), you can copy "chartdir.lic" to the same directory as the active "libchartdir.so" (for Linux/macOS) or "chartdir.dll" (for Windows), which should be in your PHP extension directory.
The license file should remove the "unregistered" message on the charts. If the license file appears to have no effect, please refer to
http://www.advsofteng.com/license_diag.html for trouble-shooting instructions.
ChartDirector Redistribute License
The "ChartDirector Redistribute License" can be installed using the same method as that of the "ChartDirector Developer License". You can also embed the license key in your code by adding a line to call
setLicenseCode and pass the license key as the argument.
setLicenseCode(".....your-license-key.....");
© 2024 Advanced Software Engineering Limited. All rights reserved.