November 29th, 2012 Add Your Comments

Zend Server CE is a great stack for PHP developers, especially those that like to develop with the Zend Framework framework. Unfortunately, the server experiences some issues for the latest OSX users. I’ve created some other blog posts that walk you through a setup…

http://www.cmiwebstudio.com/blog/zend-server-ce-for-mac-osx-10-lion/
and
http://www.cmiwebstudio.com/blog/osx-mountain-lion-and-zend-server-ce/

but you will need to fix this issue with MySQL for the DB to work correctly. At first, you may not have an issue, but quickly you will run into the issue that many others have faced, including getting the following error:

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/usr/local/zend/mysql/tmp/mysql.sock’ (2)

And if you navigate to this directory, you’ll see this file doesn’t even exist / was removed over time from a software issue. Here’s the fix…

Fire up the terminal, and enter…

sudo nano /usr/local/zend/bin/zendctl.sh

On the fifth line you’ll see the following statement:

MYSQL_EN=”false”;

Change it to the following:

MYSQL_EN=”true”;

Now, go further down within the file, until you come to the start sequence. Here we’re going to add one line that’ll issue the “start-mysql”-command.

“start”)
$ECHO_CMD “Starting $PRODUCT_NAME $PRODUCT_VERSION ..\n”
$0 start-zdd %
$0 start-monitor-node
$0 start-mysql %
$0 start-apache %
$0 start-lighttpd %
$0 start-jb %
$0 start-jqd %
$ECHO_CMD “\n$PRODUCT_NAME started…”
;;
Below the start sequence you’ll find the restart sequence, which should look like this.

“restart”)
$0 restart-zdd
$0 restart-monitor-node
$0 restart-apache
$0 restart-mysql
$0 restart-lighttpd
$0 restart-jb
$0 restart-jqd
;;

And, if you go further down you’ll find the stop sequence, which should look like this.

“stop”)
$ECHO_CMD “Stopping $PRODUCT_NAME $PRODUCT_VERSION ..\n”
$0 stop-apache %
sleep 2
$ZCE_PREFIX/bin/clean_semaphores.sh
$0 stop-lighttpd %
$0 stop-jb %
$0 stop-mysql %
$0 stop-jqd %
$0 stop-zdd %
$0 stop-monitor-node %
$ECHO_CMD “\n$PRODUCT_NAME stopped.”
;;
Now, save and exit by pressing ctrl+x, select “Yes” to the question “Save modified buffer” and write to the same filename.

The next thing we need to do is to make sure that the correct script is executing when starting up OS X. To do this you’ll need to go to the startup directory, remove the old script and link in the new script:

cd /Library/StartupItems/ZendServer_init/
sudo rm zendctl.sh
ln -s /usr/local/zend/bin/zendctl.sh ./
To ease maintenance we’re going to setup a link within the our sbin-folder.

cd /usr/sbin
ln -s /usr/local/zend/bin/zendctl ./

Now restart the server: sudo zendctl.sh restart

***************

STILL not working? Well, that’s not unheard of, as many online can attest to. Unfortunately, Zend doesn’t seem to have an official answer to this issue either.

When in doubt… download MAMP. MAMP is a GREAT stack to use. Very easy to use and setup, includes virtually everything you’d want to install out of the box, incredibly easy to config on the fly, and for MAC users that like things that “just work”, MAMP is a great option. You can learn more at MAMP