ChartDirector Ver 4.1 (PHP Edition Edition)

Trouble-Shooting ChartDirector for PHP Installation


This is a guide for trouble-shooting ChartDirector for PHP installation issues.

Getting the Error Message

To trouble-shoot any problem, the most important thing is to obtain the error message.

If you see an error message with heading Error Loading ChartDirector for PHP Extension, then you have already obtained the error message. Otherwise, please copy "ChartDirector/phpdemo/cdinfo.php" to your web server and access it. It will check your ChartDirector installation and show you any error.

If you are using extension statement in "php.ini" to pre-load ChartDirector, but the "cdinfo.php" script above is still trying to dynamically load ChartDirector, probably pre-loading has failed. The pre-loading error message can be found in the web server error log file. For certain web servers on Windows, a window may pop-up to display the error message.

If you are using extension statement in "php.ini" to pre-load ChartDirector, but nothing happens (not even an error message in the error log) as if the statement is ignored, please verify the "php.ini" you use is the real "php.ini" used by your PHP (use phpinfo to confirm). Also remember to restart your web server for the modified "php.ini" to take effect.

Error Messages and Their Resolutions

The followings list out common errors that may occur during ChartDirector for PHP installation.

Note that the exact error messages may vary depending on your operating system type and version, as well as your PHP version. For example, access security violations may report as "Permission Denied" or "Access Denied", depending on your operating system type and version.

No error message, but no text is being displayed on charts

Cause
ChartDirector cannot access the fonts. For Windows, the fonts are assumed to be in the "[windows]\fonts" subdirectory. For Mac OS X, the fonts are assumed to be in the "/Library/Fonts" and "/System/Library/Fonts" subdirectory. For Linux, FreeBSD and Solaris, the fonts are assumed to be in the "fonts" subdirectory under the directory that contains the ChartDirector for PHP extensions.

The "cdinfo.php" output contains a "Font Loading Test" section that prints out the directory where ChartDirector is searching for the fonts, and the reason that they cannot be accessed.

For Linux, FreeBSD and Solaris, one common cause of this error is that the ChartDirector for PHP extensions are copied to another directory (eg. to the PHP extension directory), but the fonts subdirectory are not copied. As a result, ChartDirector cannot find the fonts.

Another common cause of the error is that the web server anonymous user may not have sufficient privileges to read the font files.

Solution
  • If the error is because of missing "fonts" subdirectory in Linux, FreeBSD or Solaris, please copy the fonts subdirectory to the same directory that contains the ChartDirector for PHP extensions.

  • If the error is due to access security issues, please configure your system to allow everyone to access the font files.
PHP error: Dynamically loaded extensions aren't allowed when running in Safe Mode

Cause
Your PHP is configured to run in Safe Mode, and so does not allow dynamic loading of extensions. As a result, ChartDirector cannot be loaded dynamically.

Solution
PHP error: Dynamically loaded extensions aren't enabled

Cause
Your PHP is configured to disable dynamic loading of extensions. As a result, ChartDirector cannot be loaded dynamically.

Solution
PHP error: Not supported in multithreaded Web servers - use extension statements in your php.ini

Cause
Your PHP is compiled as a multi-threaded web server module, and do not support dynamic loading of extensions.

Solution
Failed opening required 'path/to/phpchartdir.php' (include_path='[list_of_paths]')

Cause
PHP cannot locate "path/to/phpchartdir.php". This file is in the "ChartDirector/lib" subdirectory under the directory that you extract ChartDirector.

If you are using a relative path name, PHP will search for the file using the directories in the PHP include path. The PHP include path usually contains "." (the current directory) as one of the directories. You may use phpinfo to determine your PHP include path configuration.

If you are using an absolute path name (eg. a path name starting with a slash "/"), note that the path is a file system path. That means the root is the file system root directory, not your web server root directory.

Solution
  • If "path/to/phpchartdir.php" is a relatively path, please make sure it exists in one of the PHP include path directories.

  • If "/path/to/phpchartdir.php" is an absolutely path, please make sure it exists in the file system, with the leading "/" means the file system root.

  • When copying "phpchartdir.php", please copy everything in "ChartDirector/lib" together (including the fonts subdirectory in Linux, FreeBSD and Solaris versions). The files in "ChartDirector/lib" are inter-dependent.
PHP error: Unable to load dynamic library '/path/to/phpchartdir###.dll'

  • The specified module could not be found.
  • cannot open shared object file: No such file or directory
  • open failed: No such file or directory
  • Cannot open "/path/to/phpchartdir###.dll"
Cause
PHP cannot locate the ChartDirector extension DLL/shared objects. For FreeBSD, the error may also be caused by access permission denied.

Solution
The error message should contain a directory path showing where ChartDirector is attempting to load the extension DLL/shared objects. ChartDirector may search multiple locations. In this case, there will be multiple error messages and multiple directory paths.

If one of the directory path is an absolute path without ambiguity, please copy everything in "ChartDirector/lib" (including the fonts subdirectory in Linux, FreeBSD and Solaris versions) to that directory.

If all paths are relative or ambiguous, it is because the PHP extension directory is ambiguous (eg. being a relative path). In this case, please reconfigure your PHP extension directory to remove the ambiguity.

For FreeBSD, you may also try the solution suggested for access permission denied.
PHP error: Unable to load dynamic library '/path/to/phpchartdir###.dll'

  • Permission denied
  • Access is denied
Cause
"phpchartdir###.dll" is not accessible to the web server anonymous user for security reasons.

Solution
Make sure all ChartDirector extension files, such as "phpchartdir###.dll" and "libchartdir.so" (for Linux, FreeBSD, Mac OS X and Solaris) / "chartdir.dll" (for Windows), are readable by everyone.
PHP error: Unable to load dynamic library '/path/to/phpchartdir###.dll'

  • not a valid Win32 application.
  • invalid ELF header
  • ELF file data encoding not little-endian
  • ELF file OS ABI invalid
  • wrong ELF data format: ELFDATA2LSB
  • unknown file type
  • invalid file format
  • unsupported file layout
  • Shared object "libc.so.6" not found
Cause
  • The ChartDirector installed is not for your operating system. For example, you may be using ChartDirector for Windows on a Linux server, or ChartDirector for Linux on a FreeBSD server, etc.

  • The file 'phpchartdir###.dll' may be corrupted (eg. FTP in ASCII mode instead of binary mode).
Solution
  • Make sure you are using the ChartDirector edition that is appropriate for your operating system. You may refer to Installing ChartDirector for PHP on how to identify the ChartDirector edition and the operating system you are using.

  • Make sure the files 'phpchartdir###.dll' are not corrupted by comparing the file sizes with the files extracted from the ChartDirector download.
PHP error: Unable to load dynamic library '/path/to/phpchartdir###.dll' - The specified procedure could not be found.

*** Note ***: Do not confuse this error with a similar error 'The specified module could not be found.' These two errors have different cause and solution.

This error is the same as the PHP API mismatch error, and has the same cause and solution.
PHP error: ChartDirector PHP API: Unable To Initialize module
Module compiled with module API=########, debug=#, thread-safety=#
PHP compiled with module API=########, debug=#, thread-safety=#
These options need to match


Cause
PHP can only load extension modules that matches exactly with its module API version, debug mode flag, and thread-safety flag.

ChartDirector comes with many extension modules to support various combinations of module API version, debug mode flag, and thread-safety flag configurations. However, to limit the number of combinations, some unreasonable combinations are not supported:

  • PHP compiled in debug mode (debug=1) is not supported. PHP in debug mode is for debugging the PHP interpreter itself. It is not needed for debugging PHP scripts. So a PHP developer should never need to use PHP in debug mode.

  • PHP on Windows compiled in single-threaded mode (thread-safety=0) is not supported. Because of the nature of Windows, PHP on Windows should always be in multi-threaded mode to achieve acceptable performance.
If you are using extension statement to load ChartDirector, the error may be because the extension module entered into php.ini does not match the actual type of your PHP.

For example, if you use "phpchartdir410.dll" for PHP 4.2.3, the module API will not match. Similarly, if you use "phpchartdir421mt.dll" on Linux, but your PHP is single-threaded, the thread-safety settings will not match.

Solution
  • If your PHP is compiled in debug mode (debug=1), please consider compile or download another PHP interpreter that is not in debug mode.

  • If your PHP is compiled as single-threaded PHP on Windows, please consider compile or download another PHP interpreter that is in multi-threaded mode. You may consider to download the binary release of PHP from PHP's official web site www.php.net.

  • If you are using extension statement to load ChartDirector, please follow the steps in Use extension statement in php.ini to load ChartDirector to identify your PHP type and choose the appropriate ChartDirector extension module to use.
PHP error: ChartDirector PHP API: Unable to initialize module

Cause
The file "libchartdir.so" (for Linux, FreeBSD, Mac OS X and Solaris) or "chartdir.dll" (for Windows) is missing, corrupted, or not accessible for security reasons.

Solution
  • Make sure "libchartdir.so" (for Linux, FreeBSD, Mac OS X and Solaris) or "chartdir.dll" (for Windows) is in the same directory as "phpchartdir###.dll".

  • Make sure the above file is readable by everyone.

  • Verify the file is not corrupted by comparing the file size with the file extracted from the ChartDirector download. If you upload the file using FTP, please upload in binary mode.
Version mismatch : "phpchartdir.php" is of version ##.##, but "libchartdir.so" (or "chartdir.dll") is of version ##.##.

Cause
ChartDirector consists of two parts - the "phpchartdir.php" script, plus the ChartDirector extension DLLs and/or shared objects. Their versions need to match. The most common causes are:

  • You have upgraded "phpchartdir.php" but forgot to upgrade the extension DLLs and/or shared objects, or vice versa.

  • Your PHP is configured to use extension statement to load ChartDirector, but the web server has not been restarted after the upgrade, so it is still using the old version.

  • There are multiple copies of "phpchartdir.php" and ChartDirector extension DLLs and/or shared objects in the server system (eg. "ChartDirector/lib" might be copied to the PHP extension directory). You have upgraded one copy, but your web server is using another copy.
Solution
  • Ensure both "phpchartdir.php" and the ChartDirector extension DLLs and/or shared objects ("chartdir.dll" or "libchartdir.so", and also "phpchartdir###.dll") are upgraded. Verify that their file sizes are the same as the same files in the ChartDirector download.

  • If you are using extension statement to load ChartDirector, please restart your web server after upgrade.

  • If you have copied ChartDirector to multiple places in the server, please upgrade all of them to avoid different versions get mixed up.
ChartDirector requires PHP 4.0.4 or above, but the current PHP version is ##.##.##.

Cause
ChartDirector requests at least PHP 4.0.4, but your PHP version is too old.

Solution
Upgrade your PHP.

Contacting Support Service

If this guide still does not solve the problem, you may contact our support service at support@advsofteng.net. Please include the error message and the output of phpinfo in your email.