Installing PHP 4 and MySQL 4 on Intel Macs
This post will soon becomes obsolete, but until then, maybe a few Mac web developers can benefit.
Until Marc Liyanage releases a "universal" installer package for PHP (which doesn't seem forthcoming), more than a few of us lowly web developers who've purchased new Intel iMacs (and who aren't comfortable with compiling and installing things from binaries) are left confused and alone. But there is hope, as I discovered last night.
PHP
OS X (10.4) comes with PHP 4.4.x already installed but disabled. If you don't need PHP 5, just open up /etc/httpd/httpd.conf and uncomment the lines that mention php:
LoadModule php4_module libexec/httpd/libphp4.so
AddModule mod_php4.c
That's it. Just save the changes, open up the Sharing system preference and restart Personal Web Sharing. PHP will be ready to go.
MySQL
Ironically, MySQL has great OS X installers, but after I installed 4.1, I was still getting the dreaded "Can't connect to local MySQL server through socket '/tmp/mysql.sock'" error even though MySQL was running. Luckily, a little Googling found this page.
According to Joe:
I did as Joe suggested, and I'll be damned if MySQL didn't start working. I've been using the PHP/MySQL setup for a few hours now, and I have yet to come across any problems.
This may not work for everyone, but it helps one other developer, I've done my job.
Until Marc Liyanage releases a "universal" installer package for PHP (which doesn't seem forthcoming), more than a few of us lowly web developers who've purchased new Intel iMacs (and who aren't comfortable with compiling and installing things from binaries) are left confused and alone. But there is hope, as I discovered last night.
PHP
OS X (10.4) comes with PHP 4.4.x already installed but disabled. If you don't need PHP 5, just open up /etc/httpd/httpd.conf and uncomment the lines that mention php:
LoadModule php4_module libexec/httpd/libphp4.so
AddModule mod_php4.c
That's it. Just save the changes, open up the Sharing system preference and restart Personal Web Sharing. PHP will be ready to go.
MySQL
Ironically, MySQL has great OS X installers, but after I installed 4.1, I was still getting the dreaded "Can't connect to local MySQL server through socket '/tmp/mysql.sock'" error even though MySQL was running. Luckily, a little Googling found this page.
According to Joe:
I have an Intel iMac and I think I figured out part of the problem with MySql connections. There is no socket link in /var/mysql. If you are in terminal you should create a directory called "mysql" in the "var" directory. Then go to that directory and run the command "ln /tmp/mysql.sock ." That did the trick for me.
I did as Joe suggested, and I'll be damned if MySQL didn't start working. I've been using the PHP/MySQL setup for a few hours now, and I have yet to come across any problems.
This may not work for everyone, but it helps one other developer, I've done my job.
