[FONT=Arial]When running MySQL and PHP on the same Mac OS X 10.4 server, you may find that PHP cannot connect to MySQL. When PHP is communicating with a MySQL server on the same host, it uses a socket file to communicate, and looks for it at
/tmp/mysql.sock. On Mac OS X Server 10.4, MySQL creates this socket file at
/var/mysql/mysql.sock.
To resolve this issue, you can either change the location where MySQL creates its socket file, or modify the location where PHP looks for the file. Please note that the first option is less secure than the second. Before delving in, you should also review
new information relevant to PHP and MySQL on Mac OS X Server 10.4.4 and later.
To change the location where MySQL creates its socket file, do this:
Open your preferred text editor and create a plain text file.
Type this text (on two lines as shown):
[mysq
ld]
socket=/tmp/mysql.sock
Save the file as: /etc/my.c
nf
To change the location where PHP looks for the socket file, follow these steps:
In Terminal: sudo cp /etc
/php.ini.default /etc/php.ini
Open /etc/php.ini in
your preferred text editor.
Find the [MySQL] section, and change the mysql.default_socket directive:
; Default sock
et name for local MySQL connects. If empty, uses
the built-in
; MySQL defaults.
mysql.default_socket = /var/mysql/mysql.sock
Change the permissions on /var/mysql so that www can read the socket,
by executing this in Terminal:
sudo chmod 775 /var/mysql
[/FONT]
Bookmarks