Page 1 of 1
PHP gd extension problem
Posted: Tue Apr 15, 2008 2:22 am
by DarkConsultant
Hello Everyone,
I am running Apache 2.2.4 with PHP 5.2.3 on Windows 2000 and I cannot enable the gd extension. I get no errors but it just does not work. If I check phpinfo then I see everything else but no gd. PHP is working fine apart from the gd.
Any thoughts ...
Re: PHP gd extension problem
Posted: Tue Apr 15, 2008 3:57 am
by Chris Corbyn
How are you enabling it? Sorry, might be an patronising question.
Also... very imporant... and the cause of much furstration... don't forget the restart the httpd server.
Re: PHP gd extension problem
Posted: Tue Apr 15, 2008 5:12 am
by DarkConsultant
Hi everyone,
I have done all the usual things ....
In the PHPO ini file I have set the extensions directory, uncommented the gd2 dll and set the root directory.
I did google the problem but after spending 4 hours I was no closer so I have put it back to fresh install.
Does anyone have any suggestions ....
Re: PHP gd extension problem
Posted: Tue Apr 15, 2008 5:37 am
by onion2k
Are you definitely editing the right php.ini file? php_info() will tell you which one PHP is using.
Re: PHP gd extension problem
Posted: Tue Apr 15, 2008 5:44 am
by DarkConsultant
Hi,
My php resides in a folder called C:\php5 and the ini file is in the same folder.
If I deliberately set a false reading php wont open so I think its the right one.
Re: PHP gd extension problem
Posted: Tue Apr 15, 2008 5:50 am
by onion2k
Ok. Save this little script into a file and run it from a browser...
Code: Select all
<?php
$i = imagecreate(200,200);
$red = imagecolorallocate($i,255,0,0);
imagefill($i,0,0,$red);
header("Content-type: image/jpeg");
imagejpeg($i);
Do you get a big red square?
Re: PHP gd extension problem
Posted: Tue Apr 15, 2008 6:22 am
by DarkConsultant
Hi,
No I got
Code: Select all
Warning: Cannot modify header information - headers already sent by (output started at /home/val3072/public_html/test.php:6) in /home/val3072/public_html/test.php on line 10
ÿØÿàJFIFÿþ>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality ÿÛC $.' ",#(7),01444'9=82<.342ÿÛC 2!!22222222222222222222222222222222222222222222222222ÿÀÈÈ"ÿÄ ÿĵ}!1AQa"q2‘¡#B±ÁRÑð$3br‚ %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyzƒ„…†‡ˆ‰Š’“”•–—˜™š¢£¤¥¦§¨©ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖרÙÚáâãäåæçèéêñòóôõö÷øùúÿÄ ÿĵw!1AQaq"2B‘¡±Á #3RðbrÑ $4á%ñ&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz‚ƒ„…†‡ˆ‰Š’“”•–—˜™š¢£¤¥¦§¨©ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖרÙÚâãäåæçèéêòóôõö÷øùúÿÚ ?â袊ù“÷¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(ÿÙ
or see result for your self at
http://www.contactconsultants.co.uk/test.php.
Re: PHP gd extension problem
Posted: Tue Apr 15, 2008 7:51 am
by Chris Corbyn
Looks like GD is installed to me

Even if there is an error in the code you've run. That warning is unrelated to GD, and the gibberish is image data.
Re: PHP gd extension problem
Posted: Tue Apr 15, 2008 7:53 am
by Chris Corbyn
It looks like you've wrapped that code inside a HTML document? That won't work, which is why there's a headers-sent warning appearing.
Re: PHP gd extension problem
Posted: Tue Apr 15, 2008 8:00 am
by DarkConsultant
Hi,
Now I remove the html I see a big red square ..... however this is on my remote server which has got gd installed successfully.
On my own server I get ...
Fatal error: Call to undefined function imagecreate() in F:\Webs\root\test.php on line 2.
Shall I give up and live without it?
Re: PHP gd extension problem
Posted: Tue Apr 15, 2008 8:13 am
by DarkConsultant
Additional ...
I have just noticed that when I look at phpinfo it report my Configuration File (php.ini) Path is C:\WINNT when it should be C:\php5 and it says below that Loaded Configuration File (none) although Under Apache Environment it reports PHPRC = C:/php5 (forward slash?).
I do not know if this is important or not.
Re: PHP gd extension problem
Posted: Tue Apr 15, 2008 8:30 am
by onion2k
It is important. For some reason your PHP installation is using the windows directory php.ini file instead of the php5 install directory version (I think.. I suck at sys admin stuff). You've got two options ... either attempt to make PHP use the right one (
http://uk.php.net/configuration ) or just update the one in the c:/winnt directory to enable GD like you did with the c:/php5 version. Updating the c:/winnt version is going to be the easier fix.
PHP gd extension problem (RESOLVED)
Posted: Wed Apr 16, 2008 12:55 am
by DarkConsultant
Hi All,
To all contributers ....
The problem is fixed by dropping a copy of php.ini into C:\WINNT et voila. (Although I will try to reconfigure it to use the c:\php5 version)
Many thanks to all.
Re: PHP gd extension problem
Posted: Wed Apr 16, 2008 2:46 am
by EverLearning
For Apache2 there is PHPIniDir directive which tells the server where to look for php.ini.
PHP gd extension problem (RESOLVED)
Posted: Wed Apr 16, 2008 3:27 am
by DarkConsultant
Dear Everlearning,
Yah I know but it gets ignored. This was set to C:\php5 from the word go.
The solution .....
I promised to try and make it work (without resorting to dropping copy of php.ini into C:\WINNT) and I have found the solution.
In the Apache httpd.conf file amend PHPinidir path from 'C:\php5' to (wait for it) 'C:/php5' and the problem goes away.
Thanks again for all the help, I have put the instructions on how to (definitively) set up Apache 2.2.4 with PHP 5.2.3 on my website for general viewing.
