phpmysqlzend-frameworkzend-serverzend-server-ce

Lost connection to MySQL on MAMP after installing Zend Server CE


I had MAMP running on my Mac. I installed Zend Server CE to debug the code in Zend's htdocs folder. PHP debugging works but the site cannot connect to MySQL on "localhost". Do I need to specify that it connects to Zend Server's MySQL? If so, how would I do that?

P.S. Zend Server is on //localhost:10081/, MAMP on //localhost:7777 , mamp's db has data in it, referred to as "localhost"..


Solution

  • Zend Server configures its instance of MySQL to listen on a unix socket rather than a TCP port, so if you have loaded your database onto Zend's instance of MySQL you will need to make sure your php.ini file has the following parameters:

    mysql.default_port =
    mysql.default_socket = /usr/local/zend/mysql/tmp/mysql.sock
    

    Alternatively, if you want to use the Zend Server instance of PHP and Apache but access to the database you already have in MAMP's instance of MySQL, you will need to change the above to look something like this:

    mysql.default_port = 3306
    mysql.default_socket =
    

    Hopefully I haven't overlooked any other pertinent settings.

    Having more than one instance of Apache/PHP/MySQL on the one machine can get confusing, so if you make changes to php.ini but they don't appear to be working, run a small script that displays the output of phpinfo(), as this will tell you which version of php.ini it is using, along with all of the configuration parameters for each module.