Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems installing GD Library for PHP on Windows XP

Status
Not open for further replies.

TheQuestioner

Programmer
Jun 29, 2002
78
GB
I'm having a problem trying to get the GD library to work with PHP on my local machine. I'm using Windows XP with PHP 4.3.2 and Apache 1.3.33.

I've look at the other threads and have tried their solutions, but it's still not working.

I've changed PHP.INI (which is in [blue][tt]C:\Program Files\Apache Group\Apache\bin[/tt][/blue]) so that: -

Code:
extension_dir = "C:\Program Files\Apache Group\PHP\extensions"

(This is where my PHP extensions are installed. I can see the [tt][blue]php_gd2.dll[/blue][/tt] file in here)

I've also uncommented the GD library extension entry

Code:
extension=php_gd2.dll

Yet when I run the [tt][blue]phpinfo()[/blue][/tt] function, there is no indication of the GD library.

I've also tried running a sample GD PHP script, which throws up an error.

Warning: Cannot modify header information - headers already sent by (output started at c:\program files\apache group\apache\htdocs\temp\gdsample.php:2) in c:\program files\apache group\apache\htdocs\temp\gdsample.php on line 3

Fatal error: Call to undefined function: imagecreate() in c:\program files\apache group\apache\htdocs\temp\gdsample.php on line 4

It's obvious that the GD library has not been "attached" to my PHP. Has it got something to do with the way PHP reads file paths with spaces within filenames? Or is it to do with the double-quotes?

Lastly, I'm intending to create a website which has various galleries, which is why I need the GD library (to auto create thumbnails, etc). However, is it correct to assume that most PHP web hosts already have this library configured on their servers?

Thanks in advance.
 
What web server software do you use?
Have you restarted the web server (sorry for a dumb question, but we never know)?
Are other extensions loaded that reside in the same folder (permission problem)?
 
What web server software do you use?
I'm using Apache (v1.3.33) running locally.

Have you restarted the web server
I have restarted the web-server (a dozen times) to no effect.

Are other extensions loaded that reside in the same folder (permission problem)

According to my [tt][blue]PHP.INI[/blue][/tt] file's Windows Extensions section, the [tt][blue]php_gd2.dll[/blue][/tt] is the only thing that is uncommented.

When I run Apache (it's not set as a service), the DOS windows always states: -

Code:
[Thu May 19 15:04:16 2005] [warn] module mod_php4.c is already added, skipping
Apache/1.3.33 (Win32) PHP/4.3.4 running...
 
I've found the solution to my own problem. I'd thought I'll share it here with the rest of you people.

[highlight]One thing I have to admit about open-source stuff is that it's not very informative when errors occur.[/highlight]

Basically, I copied my one and only [tt][blue]PHP.INI[/blue][/tt] file from its supposedly default location of the [tt][blue]Apache bin folder[/blue][/tt] to the [tt][blue]C:\Windows[/blue][/tt] folder. Everything worked fine after this!

I then ran [tt][blue]PHPInfo()[/blue][/tt] to ensure that the GD Library was available.
 
I would rather attribute the problem to the non standard location of the PHP.INI to the windows environment, not the open source software.
 
The default location for the [blue]PHP.INI[/blue] file is supposed to be in the [blue]Apache/bin[/blue] folder – this is the standard location (according to the release notes).

Having said that, [blue]PHPInfo()[/blue] stated that the PHP.INI file was stored in [blue]C:\Windows[/blue], even though it wasn't intially.

I'm all for open source, which is why I dumped IIS/ASP/ASP NET in favour of PHP/Apache/MySQL, it's just a shame that more work is needed on producing a more water-tight method of minimising config problems.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top