We need to make our life easier by creating consistency for every machine. What this means is every machine you try to use, whether it be yours or your colleagues, the environment will be the same when you sit down to help them with something. This is very important if you’re a Development Manager and you’re trying to help one of your staff.
This is one of several posts in regards to this subject.
We’ve installed PHP and MySQL but we haven’t “connected” the two of them. We’re going to do that today and it’s actually pretty easy to do. All we have to do is tell PHP where the MySQL socket file is located. The PHP we installed, thinks it is going to be at “/var/mysql/mysql.sock”. However, on our Apple Macintosh it isn’t located there. It’s located at “/tmp/mysql.sock”. All we have to do is start up a “Terminal” session and edit our “php.ini” file using “sudo” like so:
Clik here to view.

sudo vi /etc/php.ini
and we then find the line that starts “mysql.default_socket” like so (it’s highlighted):
Clik here to view.

mysql.default_socket (before)
and change it from “/var/mysql/mysql.sock” to “/tmp/mysql.sock” like so (again highlighted):
Clik here to view.

mysql.default_socket (after)
now we have another line that starts “pdo_mysql.default_socket” that we also need to change. We’re changing it in the same way. From “/var/mysql/mysql.sock” to “/tmp/mysql.sock”. Here are two screen shots of the before and after:
Clik here to view.

pdo_mysql.default_socket (before)
Clik here to view.

pdo_mysql.default_socket (after)
save it and you’re done!
Reboot to make sure everything gets re-initialized. This may be unnecessary but what’s it hurt?
Next week, I’ll show you how to verify that you’re talking to the database.
Image may be NSFW.
Clik here to view.

Clik here to view.

Clik here to view.

Clik here to view.

Clik here to view.

Clik here to view.

Clik here to view.

Clik here to view.
