So, I totally killed my work’s website. I’m trying to upgrade PHP so I can upgrade moodle and make it work. So I go to the excellent Mark Liyanage’s site, download the packages and install on a test server. All works. I install on current server. All works. Sort of. Messing around a bit, I finally get the server to load the new PHP module (version 5).
Suddenly, none of my web apps can connect to the MySQL server. Holy SHIT. The entire website AND distance learning system runs off of mySQL. SHIT. FUCK. CRAP!
I toy with the idea of dumping and restoring from backup. I’ve done that before and it just ends up with me having a empty server (my backups seem to never restore right).
So, i seearch around. I head BACK to the entropy.ch site (where I got the original package files), and start poking around their forums. and BAM. There it is. JESUS WHY IS THIS SO COMPLEX! But, at least, it’s all working now. yay. I get to keep my job. whew.
How to install PHP 5.2 for Apache 1.3 entropy-php-5.2.0-3.tar.gz on Mac OS X Server v10.4.8.
1. Disable the PHP 4 Module which is currently at version 4.4.4
Services: Web: Settings: Modules tab
Uncheck “php4_module” and click Save.
2. Download and unpack PHP 5.2 and run the installer.
The phpinfo function now confirms that PHP 5.2 is active.
However, on trying to connect to MySQL you get a “Could not connect to database.” error message.
The default socket location for MySQL on Mac OS X Server v10.4 is /var/mysql/mysql.sock.
The move to place the mysql.sock file in /var/mysql/ was done for security purposes.
You can find the details in two articles on Apples Server Support Website:
1 Mac OS X Server 10.4: Issues connecting PHP to MySQL
2 Mac OS X Server 10.4.4: Improvements to Apache/PHP/MySQL interaction
Reverting the socket location to /tmp/mysql.sock makes little sense from a security standpoint.
Telling PHP where the new socket file is is a much better solution.