The problem you're talking about isn't related to only Drupal. It's a problem with MAMP. Just Google MAMP pdo and you'll see tons of results that stem from some of the weird things MAMP does with reading PHP's INI file.
Actual this is something that should probably be documented on D.O. about MAMP. Honestly the best thing to do is comment out skip-networking and add bind-address=127.0.0.1 to your my.cnf file and that way PDO can connect straight through localhost. IIRC you can actually do this from the MAMP control panel.
As far as PHPInfo and PhpMyAdmin, there's a simple reason why it doesn't affect those. First, phpinfo(() is a function and just gives you back information about PHP. It doesn't connect to the database.
PHPMyAdmin doesn't use PDO. Instead they use the old mysql_*/mysqli_* functions. You can set the socket location for PHPMyAdmin via the $cfg['Servers'][$i]['socket'] = ''; setting. I believe that is done automatically in the MAMP install though.
Jamie Holly http://www.intoxination.net http://www.hollyit.net
On 1/3/2013 4:07 PM, Tim Johnson wrote:
- Tim Johnson tim@akwebsoft.com [130102 15:33]:
- Tim Johnson tim@akwebsoft.com [130102 10:15]:
Two steps are needed:
- Define connection information as an entry in settings.php to the
$databases array as follows:
'dba' => array ( 'default' => array ( 'driver' => 'mysql', 'database' => 'aisbooks', 'host' => 'localhost', 'username' => 'tim', 'password' => 'marion', // explicitly define the socket file for mysql 'unix_socket' => '/opt/local/var/run/mysql5/mysqld.sock', ), ),
The default setting in php.ini for pdo_mysql.default_socket is /tmp/mysql.sock - which works for non-drupal PHP, but I had to create a soft link for the 'unix_socket' value above, as is explained in the document above.
I should add here, that when I went to install drupal 'by hand', rather than using the bitnami stack installer, I ran into a problem installing the 'by hand' version of drupal with mysql.
I got error messages saying that drupal could not resolve or read /tmp/mysql.sock.
Setting up the softlink at /opt/local/var/run/mysql5/mysqld.sock solves this problem.
That value has to be changed in php.ini code : pdo_mysql.default_socket=/opt/local/var/run/mysql5/mysqld.sock and restart apache.
Changing the pdo_mysql.default_socket value does not seem to affect the operation of non-drupal PHP, phpinfo and phpmyadmin et. al.
To clarify: installing drupal 'by hand' is to copy the contents of the downloaded and untarred drupal package to some path recognized by apache (beneath whatever is set as apache's doc root) and then pointing the browser to it...