Im running Apache and PHP in OS X environment.

I have installed using a "double click" installer as my unix is not quite up to me compiling!

I get errors when i try to connect to mysql "could not connect through socket"

I have check using phpinfo() and apache is using the socket /var/mysql/mysql.sock

Following install the mysql.sock was put in /tmp/mysql.sock

i moved the socket file to var/mysql and this worked but only until reboot!

I have tried to create an alias to point to var/mysql but this has not worked.

I figured i needed to change where apache was looking for sql socket and had a search through httpd.conf but could not find any reference to mysql.

I googled for this problem and found some suggestions on mysql site to modify /etc/my.cnf file. I do not seen to have this file!!!

Can any body suggest what i can do now?

Advance thanks

    You can set in php.ini where it will look for the socket by default.

    Unix sockets are not normal files and aren't guaranteed to work if they're moved, symlinked etc. Unix sockets exist in the filesystem as a bit of a "side effect".

    Mark

      according to phpinfo() my php.ini is in /etc

      all i can find in there is php.ini.default

      in that file there are no values set for default mysql socket file (ie default) should i fill this in and re save as php.ini??

        php.ini does not need to exist for PHP to work - it will work happily without it and all settings will have their default.

        Read the documentation to find out how to specify the default MySQL socket.

        Mark

          Write a Reply...