Jump to content

Code works in command-prompt but not webpage


waterbottle

Recommended Posts

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!

 

 

 

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!

 

 

 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.