Enabling libgd mac osx 10.4.11

Hi,

I installed my own Apache 2.2.4 and php 5.2.3 side by side with the system install. I would like to enable libgd. How can I do that? According to the php website, libgd comes bundled with php 5.2.3. I get an error when I call one of the libgd functions in a php script, so I assume libgd is not enabled:

Fatal error: Call to undefined function imagecreate() in /Library/Apache2/htdocs/mypages/myimage.php on line 2

This is from phpinfo():

Configure Command
‘./configure’ ‘–prefix=/Library/PHP5’ ‘–mandir=/usr/share/man’ ‘–infodir=/usr/share/info’ ‘–sysconfdir=/etc’ ‘–with-zlib’ ‘–with-xml’ ‘–with-zlib-dir=/usr’ ‘–with-openssl’ ‘–enable-exif’ ‘–enable-ftp’ ‘–enable-mbstring’ ‘–enable-mbregex’ ‘–enable-sockets’ ‘–with-mysql=/usr/local/mysql’ ‘–with-mysqli=/usr/local/mysql/bin/mysql_config’ ‘–with-apxs2=/Library/Apache2/bin/apxs’

Thanks.

Try adding “extension=gd.so” to your php.ini and restarting apache.

Hi,

Thanks for the reply. My phpinfo says php.ini is in /Library/PHP5/lib, but I don’t see php.ini in there.

Ok, I found a php.ini-dist file which says this:

;;;;;;;;;;;;;;;;;;;
; About this file ;
;;;;;;;;;;;;;;;;;;;
; All the values in the php.ini-dist file correspond to the builtin
; defaults (that is, if no php.ini is used, or if you delete these lines,
; the builtin defaults will be identical).

So I renamed that to php.ini and moved it to /Library/PHP5/lib, and at the top of the file under the

 section I added:


> 
```php

;Added by me to enable php libgd:
extension=gd.so


I saved the file, then restarted apache, but I still get the same error.  phpinfo now shows:


> Configuration File (php.ini) Path	/Library/PHP5/lib
Loaded Configuration File	/Library/PHP5/lib/php.ini

So php is reading the file.