GD Library not working...

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

GD Library not working...

Post by infolock »

This is the first time I've run into this issue and it's driving me insane..

Basically, I'm on php 4.4 and the GD 2 library won't show up as an installed module.

I uncommented the line for the module=php_gd2.dll or whatever, but nothing shows up.

If i check the php_info page, it shows my extensions_dir as c:\php4 (yes, it's a windows box running apache 2)

So, I went to the ini file, but the extensions_dir directive is set for c:\php\extensions like it should be... but the php_info file is saying otherwise.

I've tried removing the file and copying it back into the c:\windows directory, but it still keeps saying the same thing. Something tells me that this is hardwired in php.

So, I also tried copying the php.ini file into ever directory known to man just to see if i could get around it (i created php4, i copied it into c:\php, and apache and everywhere). Same thing.

I even tried copying the dll into every file on my box that could possibly have it load (windows, system, system32, apache, php, etc).

Nothing has worked. Any insight would be greatly appreciated. Thanks :?: :oops: 8O
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

This may be obvious, but did you restart Apache?
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

Yeah. Even rebooted the system. Even tried stupid stuff like turning apache off, removing the ini file, putting the revised one back int he directory, and restarting apache. Nothing has helped =\
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

phpinfo() tells you which php.ini is used. Have you changed the right file?
Change something else and check wether phpinfo() reflects the new value, e.g. error_reporting=E_COMPILE_ERROR
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

Volka:

yep... it says c:\windows\php.ini, which is what i have been fighting with for about 3 days now.. =\

what is worse, is I can actually DELETE c:\windows\php.ini out of the folder, turn apache off, and reboot it. Guess what? Apache reboots fine, no errors. I can even still run my php files!@! =(

Reboot. same thing.


in case you wanna see the config, here ya go :

Code: Select all

System  Windows NT NSA 5.1 build 2600  
Build Date  Jan 13 2006 13:49:27  
Server API  Apache 2.0 Handler  
Virtual Directory Support  enabled  
Configuration File (php.ini) Path  C:\WINDOWS\php.ini  
PHP API  20020918  
PHP Extension  20020429  
Zend Extension  20050606  
Debug Build  no  
Zend Memory Manager  enabled  
Thread Safety  enabled  
Registered PHP Streams  php, http, ftp, compress.zlib
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

Is there a php.ini file anywhere else on the box?
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

There is one in the Zend folder, but it's only 2 lines of code that is used by zend for stuff like function look up. After running into this issue, I tried copying it into multiple other directories just for testing, but ended up removing it out of them after my tests didnt work.


c:\windows\php.ini config lines for extensions and for module:

Code: Select all

; Directory in which the loadable extensions (modules) reside.
extension_dir = "c:\php\extensions"



extension=php_gd2.dll
of course i didn't post the rest of the file. can if needed.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

http://de2.php.net/ini tells you when,where and why php searches for its ini. If php does not find an ini it simply uses default values for all parameters.
If you really want to change the ini path
API module specific location (PHPIniDir directive in Apache 2
is probably the best way for you.

What about
Change something else and check wether phpinfo() reflects the new value, e.g. error_reporting=E_COMPILE_ERROR
?
It doesn't make sense to look further into your gd problem until you are able to change the php settings.
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

Volka: I'll look into the apache setting. As for the changing thing, I stated above that I can actually remove the php.ini file from c:\windows, reboot the server, and it boots with no problem and the same issue. And I checked for PHPini flag in apache but nothing is there stating that is even an option. I haven't looked further into that setting so I can only assume I would have to manually enter that line in the conf file itself.

Anyways, it's like php_info has the ini file set to c:\windows\php.ini, but for one reason or another it's not actually using it. I even have wierd include paths set that are not even remotely correct in my ini file. I guess I'll have to look into your suggestion. Thanks and I'll let you know what I find.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

I stated above that I can actually remove the php.ini file from c:\windows, reboot the server, and it boots with no problem and the same issue.
Yes, and then it is using default values.
http://de2.php.net/ini wrote: * SAPI module specific location (PHPIniDir directive in Apache 2, -c command line option in CGI and CLI, php_ini parameter in NSAPI, PHP_INI_PATH environment variable in THTTPD)
* The PHPRC environment variable. Before PHP 5.2.0 this was checked after the registry key mentioned below.
* HKEY_LOCAL_MACHINE\SOFTWARE\PHP\IniFilePath (Windows Registry location)
* Current working directory (for CLI)
* The web server's directory (for SAPI modules), or directory of PHP (otherwise in Windows)
* Windows directory (C:\windows or C:\winnt) (for Windows), or --with-config-file-path compile time option
If there was an php.ini at c:\windows it would have used the values. The path is printed in phpinfo() because it was "the last resort" for php to find such a file (ok, maybe a bit confusing).
And I checked for PHPini flag in apache but nothing is there stating that is even an option.
It's PHPIniDir and you have to place it there yourself. There's an example in install.txt
install.txt wrote:Installing as an Apache module

You need to insert these two lines to your Apache httpd.conf
configuration file to set up the PHP module for Apache 2.0:

Example 2-6. PHP and Apache 2.0 as Module
# For PHP 4 do something like this:
LoadModule php4_module "c:/php/php4apache2.dll"
# Don't forget to copy the php4apache2.dll file from the sapi directory!
AddType application/x-httpd-php .php

# For PHP 5 do something like this:
LoadModule php5_module "c:/php/php5apache2.dll"
AddType application/x-httpd-php .php

# configure the path to php.ini
PHPIniDir "C:/php"
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

volka wrote: It's PHPIniDir and you have to place it there yourself. There's an example in install.txt
install.txt wrote:Installing as an Apache module

You need to insert these two lines to your Apache httpd.conf
configuration file to set up the PHP module for Apache 2.0:

Example 2-6. PHP and Apache 2.0 as Module
# For PHP 4 do something like this:
LoadModule php4_module "c:/php/php4apache2.dll"
# Don't forget to copy the php4apache2.dll file from the sapi directory!
AddType application/x-httpd-php .php

# For PHP 5 do something like this:
LoadModule php5_module "c:/php/php5apache2.dll"
AddType application/x-httpd-php .php

# configure the path to php.ini
PHPIniDir "C:/php"
Ok, I tried this and still no change.. I even tried changin the PHPInDir to be c:/windows instead of c:/php. :x Dunno what else to do other than uninstall and reinstall and then try it again... This is seriously very frustrating.


Edit: The path to the ini actually changes at the top of the php_info page, however the values for the extensions_dir doesn't.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

yeah, i'm sure that would work. just would rather know why it's not working for me as it stands before going the newbie route.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

is there only one web server installed (and running) on the machine?
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

Yep. Apache 2 is all i have.
Post Reply