Normally OS upgrades seem to go so smoothly… But this one left me (and I’m sure many others) with a nasty surprise — no communication between PHP and MySQL. Not nice. After a couple quick searches and no answers I decided to search out one myself. Discovering the problem was simple, and so apparently, was devising a solution.
If you fire up a quick PHP info file, you’ll see that the MySQL socket specified in the included version of PHP is wrong (or at least different and not what is expected) compared to older OS releases.
In 10.4.4, it is set as
with-mysql-sock=/var/mysql/mysql.sock, whereas previously it was
Thankfully, there are at least two things you can do to remedy this.
- Locate and edit a
php.inifile (by default it should be in the /etc directory and find the mysql.default_socket line and simply add
/tmp/mysql.sockfollowing the equals sign, save and restart Apache.
- In a plain text editor, create a new file in
my.cnf. In the file, include a line which reads (on two lines):
Edit: The original second solution has been removed due to security concerns as indicated by Apple. A revised alternative solution has been added in its place.