Unfortunately the Mac OS Leopard PHP build doesn't bring GD library installed.
There are many tutorials around the web telling how to patch the system so you can have it working but all are very complicated and require the installation of Xcode, etc, so you need some gigs of free HD space and a lot of free time to do the trick.
After goggling for some hours searching the simplest tutorial, I have found this great solution that works like a charm and it's as simple and fast as write some commands in the terminal.
This tutorial tells you how to overwrite the system PHP installation with a new with GD built in.
So what you need to do is:
-> Open Terminal App
-> Write "sudo mv /usr/local/php5 ~/Desktop/php5.old" and press return
- You'll be asked for the admin login
-> Write "curl -O http://www2.entropy.ch/download/php5-5.2.5-6-beta.tar.gz" and press return
-> Write "tar -xzf php5-*-beta.tar.gz" and press return
-> Write "sudo mv php5 /usr/local/" and press return
-> Write "sudo ln -sf /usr/local/php5/entropy-php.conf /etc/apache2/other/+entropy-php.conf" and press return
-> Write "sudo apachectl restart" and press return
- You're done :)
From: http://www.entropy.ch/phpbb2/viewtopic.php?t=2945&postdays=0&postorder=asc&highlight=leopard&start=0
Saturday, February 16, 2008
Adding GD library for Mac OS X Leopard
Subscribe to:
Post Comments (Atom)
74 comments:
I tried to follow your instructions but I'm getting the following error in terminal:
mv: rename /usr/local/php5 to /Users/Carlos/Desktop/php5.old: No such file or directory
Got any idea what's going on?
I just realized that the reason it's not working is because I don't have a php5 directory in "/usr/local". Not sure where it is, or if it even exists.
Btw, not sure if this is relevant, but i followed this tutorial to set up php on my macbook pro:
http://foundationphp.com/tutorials/php_leopard.php
Can you please help?
Thanks for the tutorial. A big help!
These two lines need to be combined to work when creating the link
from this:
-> Write "sudo ln -sf /usr/local/php5/entropy-php.conf" and press return
-> Write "/etc/apache2/other/+entropy-php.conf" and press return
to this:
-> Write "sudo ln -sf /usr/local/php5/entropy-php.conf /etc/apache2/other/+entropy-php.conf" and press return
I'm having the same problem as Carlos, in that /usr/local/php5 doesn't exist on my machine.
Was anyone ever able to work this out?
life gets more interesting... I've compiled php and it exists in /usr/local/php5, but since it didn't work I tried MacPorts and now there's an install at /opt/local/bin/php (where "which php" points to). phpinfo() via Apache gives me version 5.2.4, while the php-config file for the version pointed to by "which" is 5.2.5.
php -m results in the following:
PHP Warning: PHP Startup: Unable to load dynamic library '/opt/local/lib/php/extensions/no-debug-non-zts-20060613/gd.so' - (null) in Unknown on line 0
[PHP Modules]
bcmath
bz2
calendar
ctype
curl
date
dba
dom
exif
filter
ftp
gd
gettext
hash
iconv
imap
json
ldap
libxml
mbstring
mcrypt
mhash
mysql
mysqli
odbc
openssl
pcntl
pcre
PDO
pdo_mysql
posix
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tidy
tokenizer
wddx
xml
xmlreader
xmlrpc
xmlwriter
xsl
zlib
gd.so is nowhere to be found on my machine. Any suggestions on how to remedy either the a) mismatched PHP versions or b) getting gd.so?
Any help would be much appreciated.
Thanks,
-ilija
ilija-- this is what I did to get it to work for me:
Add PHP5-5.2.5-beta.tar.gz to your home direcory (~name) and follow the directions in the below website starting from step 3.
http://docs.moodle.org/en/Step_by_Step_Installation_on_a_Mac_OS_X_10.5_Server#Install_the_GD_Library_on_the_Mac_OS_X_10.5_Server
Use the following as a reference if you get stuck, but I did not follow their instructions: http://www.entropy.ch/phpbb2/viewtopic.php?t=2945
hope that helps.
Thanks for the response, Carlos. Unfortunately, I can't change the LoadModule line in my httpd.conf to point to the new PHP instead of the existing one in the Apache directory.
Doing so causing the following error to show in the Apache log file:
"caught SIGTERM, shutting down".
Just FYI for new users happening upon this tutorial:
This tutorial will not work for the standard Apple installation - only those that have installed the Entropy PHP package. That's (most likely) the reason for the 'No such file' error that some people are encountering.
If you used the foundationphp.com instructions to enable PHP like Carlos did then you're using the default Leopard install which stores files in different locations.
Carlos and everyone else who 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
Sheldon you are the BOMB! Been trying to get this for a while now and then as simple as your step by steps say... DONE.
Thanks a bunch!
I salute in your general direction.
But this doesn't include GD right, I can't seem to use it. Is there that needs to be done to enable it?
Nevermind it worked, my problem was that restarting the server wouldn't take effect, so I had to kill it the hard way. And also that it found php first in path at /usr/bin before /usr/local/php5
Thanks very much,
Stan
Thanks Sheldon!
MANY (many) thanks Sheldon
Finally! I've been working with the entropy PHP install on Mac OS X Leopard for the last 3 days trying to get it to work. The forums didn't provide any help and all the other solutions were unusually complicated.
This works a treat, thank you. There is one question I have - since doing this I'm not sure my error_log in the Console (under var/log/Apache2) is reflecting exactly what was going on as before (ie, undefined variables etc). Is there an additional step or am I better than I thought I was (unlikely!!). Regards.
I found the solution to my php error_log not working.
These 2 lines need to be in the php.ini file (for some reason I also had to rename it from "php.ini-recommended" to "php.ini"), located here:
/usr/local/php5/lib/php.ini
error_reporting = E_ALL
error_log = "/var/log/php_error.log"
Hope it's of use.
I was wanting to install the GD library but my system is showing:
PHP Version 5.2.5
config file php.ini /etc
loaded configuration /private/etc/php.ini
There is no httpd.conf in /private/etc
what am I missing?
Sheldon's steps worked for me. The only thing that was different for me was the httpd.conf was located in /private/etc/apache2 and not /private/etc
This worked great for me, however when when I look at my status in Drupal I still see GD not installed.
Is there another step to get GD functioning?
GD does not show up in php_info ... so I looked for it in the php directory (and then in the downloaded files from the given link ... http://www2.entropy.ch/download/php5-5.2.5-6-beta.tar.gz) and could not find any GD references anywhere (such as gd.so or gd2.so, etc...)
Update to my prior post.
I FINALLY found what I needed to get it working. I needed to comment out the following line in /etc/apache2/httpd.conf:
#LoadModule php5_module local/php5/libphp5.so
Reference found here:
http://www.maltete.com/blog/index.php?2008/05/03/388-installing-php-with-gd-library-working-on-mac-osx-105-leopard
Thanks!
Anoyone have any idea how to install the entropy PHP libs AND keep Apple's pre-installed MySQL working? I set the socket in the PHP.ini to match the apple installation (/private/tmp/mysql.sock) but the entropy install seems to want to use /tmp/mysql.sock
Thanks Sheldon. Your comments worked the first time through. I think I know how to fix your problem Luke. PHP is confused which mysql.sock file to use. I found this at: http://www.sysarchitects.com/node/58
sudo mkdir /var/mysql
sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock
Sheldon, you just made my week. I'd tried ten other things and nothing worked. Then I spent 3 minutes with your info and I'm up and running. Thanks!
Oh my, you save my life. This does the trick. Thanks!
Truly excellent - much appreciated - thanx - PdeP
I shared the same problem and thanks to Sheldon I now have a fresh install of php5 with the gd library.
THANKS A BUNCH!
Yet another very, very happy customer! But to clarify, in my case the MySQL link was also broken after following these steps, but I could not follow Marquez's steps because /var/mysql was already there!
So in my case I simply reversed the symbolic link, as:
sudo ln -s /var/mysql/mysql.sock /tmp/mysql.sock
Sheldon, thank you!
Worked first time!
Sheldon: thank you.
Is this the same install for OS 10.5 server?
I've followed Sheldon's advice and then raw-m's tip to enable error logging (adding error_reporting = E_ALL and error_log = "/var/log/php_error.log" to php.ini).
However, no error log file appears. I've tried creating my own /var/log/php_error.log file and get permission denied errors. What's the best way to handle this? Change permissions on /var/log?
Any help appreciated, thanks for all the great work so far.
Thanks all!
Thanks sheldon, wish I stumbled on this a few hours ago. Thanks a bunch
Unfortunately I am not that lucky. I have installed php/mysql a while ago on my macbookpro but now that I try to locate the httpd.conf file, I simply do not find it in any of the places indicated in this blog. Where is it? How do I find this file? I only find a file called httpd_conf.h in 2 locations.
I have php 5.2.6 | Apache 2.2.9.
What is going on here???
This was great! I got PHP with GD library up and running. However, like others, this broke my mysql connection. I can access it all through the terminal but it's dead through PHP despite phpinfo() saying it's enabled.
phpinfo() shows the
MYSQL_SOCKET to be in /tmp/mysql.sock
and logged into mysql from the Terminal I also get that location by typing in :
mysql> SHOW VARIABLES LIKE '%socket%';
I'm really stumped for a solution. I noticed that before I did all this PHP was working with MySQL and phpinfo() said /var/mysql/mysql.sock for MYSQL_SOCKET.
I've tried to change /usr/local/php5/lib/php.ini to read mysql.default_socket = /var/mysql/mysql.sock
but it doesn't seem to affect PHP at all and phpinfo() still reports MSYQL_SOCKET /tmp/mysql.sock
Grrr! This is so frustrating! So I've gained GD library but I've lost connection MySQL :=(
Thank you very much!!! This is a pretty simple solution and worked on Leopard :)
To have GD library AND MySQL, I modify file /etc/my.cnf with:
[client]
socket = /tmp/mysql.sock
[mysqld]
socket = /tmp/mysql.sock
And now GD+MySQL works like a charm !
Thank you Diving Rhino!
Marc did mention that you really have to kill the old php5 - it's persistent and kept coming back until I commented out that line and restarted, letting Marc's package load.
AWESOME.
This very nice tutorial explains how to compile GD separately and load it into the existing php/apache setup. It worked for me.
Hi Paul,
You can only find the httpd_conf.h because the httpd_conf file is hidden.
The easiest way is to download text wrangler. Then open the program and from the File menu, select Open Hidden. In the Open dialog box, select All Files from the Enable drop-down menu. Then navigate to Macintosh HD:private:etc:apache2:httpd.conf, and click Open.
Here you can follow sheldons answer.
Hope this helps for anyone
Thanks! Your comment worked perfect for me!
Tried with phpinfo(); in my php-file afterwards to confirm that gd was installed - and it was. Thanks a lot! :)
Hi,
Thx for this solution. Work's perfect, now i have GD Library running on Leopard, but, and I have a problem, big problem... I lost my MySQL datababses!!! and my password for "root" user.
What can I do?
Tanks ;-)
LeGo
Well... after hours and hours... I've found a solution here: http://protichnoctem.blogspot.com/2008/05/install-gd-library-in-leopard.html
----------
...
cd /usr/local/php5/lib
sudo mv mysql mysql.old
sudo ln -s /usr/local/mysql/lib mysql
restart apache
...
----------
That's all friends!
I am having problems with MySQL too. MySQL is running and I can connect with MySQL Administrator and MySQL Query Browser but I get access denied in PHP for all users, even root.
There is a much easier and safer way of installing PGP with GD! Use the package here:
http://www.entropy.ch/software/macosx/php/
Just run the installer! That's it!
the "sudo" line worked for me but then it prompts me for a password? i tried typing the next line but it says "Sorry, try again." What should I do? Thanks.
Thanks Ben (and the earlier contributors especially Sheldon) Ben's suggestion works fine. (I paid particular attention to the warning about disabling the PHP that comes with 10.5 .
Howdy, have you got the root user enabled? (Open Directory Utility, click the lock, Edit->Enable Root User. )
Your instructions are great and it did what it was supposed to, but now it seems when I try to install Drupal I only have the option of msqli and pgsql databases. Any ideas why this is happening or this was even caused by the GD library installation? Before I added GD library Drupal 6 easily installed. I'm running mySQL 5.0.87. Could it have anything to do with the socket? Thanks in advance.
Sorry, I forgot to mention I used the solution you had given to Carlos.
So, I cannot to login into mysql as root from phpmyadmin as well now. It only works from mysql prompt.
What can I do to fix it ?
thanks
Many thanks for taking the time to write this up.
Sheldon, thank you for your additional configuration changes to httpd.conf.
Sheldon, THANK YOU for you impecable instructions, they were flawless. Thank you thank you!!
Nice post!! Thanks for sharing!
Levitra Generico
very informative post, thanks for sharing it with usManchester photography studio hire
Nice post! Thanks for sharing!
the web telling how to patch the system so you can have it working but all are very complicated and require the installation of Xcode, etc, so you need some gigs of free HD space and a lot of free time to do the trick.turtle ridge homes
black boots
Chocolate boots
sand boots
Chestnut boots
gray boots
pink boots
grey boots
Ugg Boots For Sale
Sand Ugg Boots
buy codeine online
Great article.
Thanks for sharing this post!
cost effective advertisingThanks for your post, I like this post very much.
This tutorial about how to overwrite the system PHP installation with a new with GD built in is awesome!It's just what I needed.
Bianca plantarea trandafirilor Jessy
Thanks to a brilliant effort in publishing your article. One can be more informative as this. There are many things I can know only after reading your wonderful article.drug discussion
drug discussion forum
drug forum
I am visiting this site first time & it has awesome information. I have come to know a lot of information after visiting this site. Keep this sort of posting in future as well.....
buy watson
Thanks for the post. I followed someone's recommendation to install the latest one from this site and it works like a charm! Just one command line :)
http://php-osx.liip.ch/
Nice! Reading the same blog repeatedly it was boring, when i read your blog it was amazing and very interesting the way of narration is awesome, I am glad that i found such a beautiful post. Thank you for sharing them.
Cheap hotels in los angeles
how may i know more information from your website.
share with me the process.
pharmacy reviews
mac os is great os ...
i like this article about mac os i like this thanks for this article ..
i got very informative information thanks ..
airfrance booking
Sheldon MAESTRO :D Thanks a lot <3
Kamagra
Thank you for another essential article. Where else could anyone get that kind of information in such a complete.
Please visit my site also Jio Phone 1500 Rs Free
Post a Comment