Search code examples
phpmysqlosx-mavericks

PHP/mysql requiring 127.0.0.1 on OS X Mavericks


On Mac OS X 10.6, I am able to connect to mysql in php with

$mysql = mysql_connect(localhost,user,password)

However, if I use the same in Mac OS X 10.9 (Mavericks), I get the error message:

Warning: mysql_connect(): No such file or directory

if I use $mysql = mysql_connect("127.0.0.1",user,password), it works OK, but I'd rather not make the change everywhere.

I've read on this site that there is a socket issue, but I already have this in php.ini.default: pdo_mysql.default_socket=/tmp/mysql.sock

Any idea on how to make mysql_connect(localhost,user,password) work on 10.9 ?


Solution

  • Please read those articles:

    1. http://www.coolestguidesontheplanet.com/downtown/get-apache-mysql-php-and-phpmyadmin-working-osx-109-mavericks

    2. AllowOverride for .htaccess on local machine giving 403 Forbidden

    3. http://coolestguidesontheplanet.com/how-to-install-mcrypt-for-php-on-mac-osx-lion-10-7-development-server/

    4. http://michaelgracie.com/2013/10/29/plugging-mcrypt-into-php-on-mac-os-x-mavericks-10-9/