waterbottle Posted May 24, 2007 Share Posted May 24, 2007 Hello all. I have the following code to check the version of the GD library: <?php // // Routine to determine if GD1 or GD2 is installed // function CheckGDVersion() { if( !function_exists("imagetypes") || !function_exists('imagecreatefromstring') ) return -1; $GDfuncList = get_extension_funcs('gd'); if( !$GDfuncList ) return -2 ; else { if( in_array('imagegd2',$GDfuncList) && in_array('imagecreatetruecolor',$GDfuncList)) return 2; else return 1; } } $gdversion = CheckGDVersion(); echo("Version found: $gdversion"); ?> This (correctly) returns the version of 2 when I run it from the command prompt like so: C:\myPHPDir>php foo.php However, when I run it from my server, it does not work, and returns -1 http://myServerAddress/foo.php -They are both referencing the same PHP file -I am running PHP 5.2 -Server is Apache 2.2 -I have done the following steps to load my GD library 1) Uncomment the line "extension=php_gd2.dll" in the php.ini file 2) Add the line "extension_dir=./ext" in the php.ini file (tells where to look for extensions) Any ideas?? Thanks! Link to comment https://forums.phpfreaks.com/topic/52838-code-works-in-command-prompt-but-not-webpage/ Share on other sites More sharing options...
trq Posted May 24, 2007 Share Posted May 24, 2007 It would appear that you still have not configured gd in mod_php. have you restarted Apache? Just because something works on the cli does not meen it will through Apache, they are two seperate engines. Link to comment https://forums.phpfreaks.com/topic/52838-code-works-in-command-prompt-but-not-webpage/#findComment-260845 Share on other sites More sharing options...
waterbottle Posted May 24, 2007 Author Share Posted May 24, 2007 Thanks for the quick reply, Thorpe! Hmm, mod_php? I haven't worked with that file yet...Does this need to be configured in Windows as well? (I'm running on Windows XP by the way -- sorry, should've mentioned that). No, I haven't restarted the server yet. I will try that after I look into configuring mod_php. Do you have any links with more information on this? Cheers & thanks again Thorpe! Link to comment https://forums.phpfreaks.com/topic/52838-code-works-in-command-prompt-but-not-webpage/#findComment-260855 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.