Developing Software in J2EE

Developing Software in J2EE

Environment Consistency – PHP/MySQL Configuration (Apple Macintosh)

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:

sudo vi /etc/php.ini

sudo vi /etc/php.ini

and we then find the line that starts “mysql.default_socket” like so (it’s highlighted):

mysql.default_socket

mysql.default_socket (before)

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

mysql.default_socket (after)

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:

pdo_mysql.default_socket (before)

pdo_mysql.default_socket (before)

pdo_mysql.default_socket (after)

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.

December 6, 2009 - Posted by | Development Environment, MySQL, PHP | , ,

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.