|
error with missing dl function |
Posted by Michael on Jan-22-2011 01:18 |
|
I installed ChartDirector for PHP on windows to test it and it works fine. I have an identical directory structure on linux (ubuntu), and I downloaded the 32-bit linux version to test it. When I try to display a chart (again, exactly as one that worked in windows), I get an error:
PHP Fatal error: Call to undefined function dl() in /var/www/htdocs/05_a/ChartDirector/lib/phpchartdir.php on line 44
This is in this function:
function cdLoadDLL($ext)
{
global $cdDebug;
if ($cdDebug || (error_reporting() != 0))
echo '
<b>Trying to load "'.$ext.'" from the PHP extension directory '.listExtDir().'.</b>
';
@cdSetHint(ini_get("extension_dir"));
if (dl($ext))
return true;
etc.....
I am not sure why I have this error. I do not see any dl function in phpchartdir.php, but maybe it is referencing an included file?
Any guidance?? |
Re: error with missing dl function |
Posted by Peter Kwan on Jan-23-2011 05:06 |
|
Hi Michael,
When the code use ChartDirector (by including "phpchartdir.php"), the "phpchartdir.php" will check if your PHP has already loaded ChartDirector (by using "php.ini"). If not, it will try to dynamically load ChartDirector (using "dl").
PHP 5.3 or above no longer support dynamic loading of PHP extensions. This function is removed by the company that develops PHP. You can still load PHP extensions (such as ChartDirector) by using extension statements in "php.ini". You may refer to the PHP documentation for the details. The Installation section of the ChartDirector documentation also mentions about this.
In brief, the steps are:
(a) Copy *everything* from "ChartDirector/lib" (include all files and the fonts subdirectory) to your PHP extension directory. Make sure you use "phpinfo" to determine where is your PHP extension directory.
(b) Add the following line in your active "php.ini". Again, make sure you use "phpinfo" to determine the location of your active "php.ini" (as there are can more than one "php.ini" in your system). The following assumes you are using PHP 5.3.x. (Note that the followings work even on Linux. I mention that because a lot of people has the mistaken believe that one cannot use .dll on Linux.)
extension=phpchartdir530.dll
(c) Restart Apache. This is actually only required if your are using SAPI PHP or FastCGI PHP - not required if you are using CGI PHP.
If the above still does not solve the problem, please check if your PHP or Linux is really 32-bit (use "uname -a".) Also, please inform me the result of the "ChartDirector/phpdemo/cdinfo.php" diagnostic script.
Hope this can help.
Regards
Peter Kwan |
|