mickyginger — 2010-12-11T19:38:54-05:00 — #1
I'm using PHP 5.2.14 on Mac OS X Leopard, and I'm trying to use the function imagecreatefrompng(); but I keep getting a fatal error: call to undefined function.
I've just done a search of the php.ini file so that I can enable gd (I'm looking for something like --with-gd), but there's nothing there.
All I can find is this:
; Tell the jpeg decode to libjpeg warnings and try to create
; a gd image. The warning will then be displayed as notices
; disabled by default
;gd.jpeg_ignore_warning = 0
What am I missing?
anthonysterling — 2010-12-11T19:47:41-05:00 — #2
Remove the semi-colon from
save, and restart Apache. Hopefully, you'll now have the GD extension enabled.
mickyginger — 2010-12-12T09:40:04-05:00 — #3
having a little trouble restarting apache. I typed this in terminal command line:
sudo /usr/sbin/apachect1 restart
And got this error message:
sudo: /usr/sbin/apachect1: command not found
Not hugely au fait with Terminal commands so not sure what I'm looking for. Bit scared about messing around with sudo tho.. :s
So I tried just turning off web sharing in system preferences, then back on again. I'm still getting the error message 'Call to undefined function imagecreatetruecolor()'... Is there something I've missed?
anthonysterling — 2010-12-12T09:47:37-05:00 — #4
sudo apachectl restart
That's apachectl, not apachect1.
mickyginger — 2010-12-12T10:06:06-05:00 — #5
Ha ha. :rolleyes:
OK so I've done that, still not joy. Double checked the php.ini file, and that semi-colon is definitely not there.
Any other ideas?
anthonysterling — 2010-12-12T11:36:40-05:00 — #6
Actually, as you're on OS X, the .dll obviously will not exist. Sorry, I'm an idiot.
Does the PHP package that ships with OS X even have GD? If not, you either have to install GD and recompile PHP with the module enabled or find an OS X package with GD already enabled.
I'm not a Mac user, so I'm a little out of my depth, does this look like it could be of some use?
mickyginger — 2010-12-12T13:19:36-05:00 — #7
Well from what I gather, yes it does ship with GD. In fact from what I gather from forums its best to activate the shipped library rather than install another copy of it.
I had a look on the link you posted, and the only mention of GD is here:
The module includes many popular PHP extensions, among them:
the MySQL and PostgreSQL databases
the cURL library for various communications protocols
the GD image creation library (with PNG, JPEG, PostScript Type 1 and TrueType font options).
the expat XML parser and WDDX support
the IMAP client library
mcrypt encryption functions
Hmm, well, I'll keep digging. I'm sure something will come up.
mickyginger — 2010-12-13T06:13:28-05:00 — #8
Ok, so after a little digging on t'interweb I found this solution that works for anyone who is using the native installation of PHP 5 on Leopard (OS 10.5). I don't understand exactly what's going on here, but I thought I'd post it just so that this thread would be resolved.
So I got this from this blog post:
But NOT from the main post, from a comment made by Sheldon about a third of the way down the page.
[If you] are trying to get this done on Leopard's base PHP5 installation, here's what you do.
-> Open Terminal App
-> Write "cd /private/etc" and press return
-> Use your favorite text editor to open httpd.conf
-> Find this "LoadModule php5_module libexec/apache2/libphp5.so" and add a "#" (no quotes) at the front of the line to comment out Leopard's default PHP5 library
-> Write "cd /usr/local" and press return
-> Write "sudo curl -O http://www2.entropy.ch/download/php5-5.2.5-6-beta.tar.gz" and press return
-> Write "sudo tar -xzf php5-*-beta.tar.gz" and press return
-> Write "sudo ln -sf /usr/local/php5/entropy-php.conf /etc/apache2/other/+entropy-php.conf" and press return
-> (Optional) Write "rm php5-5.2.5-6-beta.tar.gz" and press return to delete the downloaded archive
-> Write "sudo apachectl restart" and press return
Worked for me
@Anthony -- I just realised that the link you sent me was for the entropy site that is used in this solution. Completely missed that. I thought it was the specs of the Mac OS build! :rolleyes:
anthonysterling — 2010-12-13T06:49:52-05:00 — #9
Ha, no worries.
Glad you got it sorted, I'm just sorry I couldn't help further.