I have recently started using Zend Framework. I started developing on my local XAMPP server which went fine but when I uploaded to my 1and1 account, I keep getting the following error:
Message: SQLSTATE[HY000] [2002] Can’t
connect to local MySQL server through
socket ‘/var/run/mysqld/mysqld.sock’
(2)
I have tried changing the resources.db.params.unix_socket line in my application.ini file to the different ones mentioned in phpinfo but with no success. I found here that someone answered
Is the MySQL server on the same host
as the web application? If not, you
can’t use a socket connection, and
will need to connect via TCP.
I think that is the case with my web host. How can I change ZF to connect via TCP instead? I am currently using PDO_MYSQL.
I had left the line:
in my index.php as is but had changed public/.htaccess to
It looks like the .htaccess was not being read. I changed the else statement in index.php to ‘production’ to use the production database settings and it worked. Quite frustrating. I wonder why the environment variable was not being read. Thanks for your help.