Zend Server CE is an awesome product. We had installed it just after it’s release but hadn’t really delved into all it’s features until today. We were just using it as a quick web server, but we weren’t doing any development in the environment. But that is about to change. We decided to re-work some architecture to enable development on our local computers (24″ iMacs with OS X 10.6 Snow Leopard FTW). With that decision, it meant we had to setup a solid, testable environment locally, so we decided to really put Zend Server CE to the test. That action should have been much easier than it ended up being…
Basically, Zend Server CE and Snow Leopard don’t really play well together. Out of the box, Zend Server CE’s management console does not work at all. We actually found this out a few weeks ago when we were passively using Zend Server CE. It has to do with the watchdog service in OS X. Hopefully this will be solved in the next version of Zend Server CE. Here is a work-around to get past the issue.
- Stop Everything: sudo zendctl.sh stop
- Replace the contents of /usr/local/zend/bin/lighttpdctl.sh with the contents from http://is.gd/2O2om
- Restart Everything: sudo zendctl.sh start
- Now your management console should work at http://localhost:10081/
UPDATE: You can also fix this issue by switching out the watchdog binary. More info here: http://forums.zend.com/viewtopic.php?f=44&t=1115&start=30.
Once we got Zend Server CE up and running, we needed more. PHPUnit, Xdebug, the server running on port 80….all that good stuff. I had seen Rob Allen’s post a few months back about Zend Server CE configuration, so I headed over to his blog and went through his instructions (great job, btw) for setting up paths, hosting off port 80, installing PHPUnit and installing Xdebug. Everything went smoothly until I restarted Apache the final time and Xdebug just didn’t show up. After lots of messing around, here is what I finally did to get Xdebug installed.
- Go to http://localhost:10081 and pick the Server Setup tab. Turn off the Zend Debugger and Zend Data Cache.
- Stop Apache: sudo zendctl.sh stop-apache
- Go grab the .tar file from ActiveState Programmer Network for Komodo 5.2 Remote Debugging Packages -> PHP Remote Debugging -> Mac OS X (http://aspn.activestate.com/ASPN/Downloads/Komodo/RemoteDebugging)
- Unzip the package, and go to the 5.3 folder and copy the xdebug.so file to /usr/local/zend/lib/php_extensions/
- You will need to make sure xdebug.so has the same permissions as the other modules in the file. From the terminal you can type “ls -l” when in /usr/local/zend/lib/php_extensions/ to see the permissions. When I did this, I had to do the following commands: sudo chown :wheel xdebug.so and then sudo chmod 644 xdebug.so
- Edit /usr/local/zend/etc/php.ini and add above the [zend] section new the bottom:
zend_extension=”/usr/local/zend/lib/php_extensions/xdebug.so”
[xdebug]
xdebug.remote_enable=1
xdebug.remote_host=”localhost”
xdebug.remote_port=9000
xdebug.show_local_vars=On
xdebug.var_display_max_data=10000
xdebug.var_display_max_depth=20 - Start Apache: sudo zendctl.sh start-apache
- The Server Setup->Extensions section of the admin interface should now show xdebug
- xDebug is now installed, but if you go to Monitor -> PHP Info in the Zend Server CE management console, it will error out. The problem is that the php.ini file shipped with Zend Server CE doesn’t include the required option for date.timestamp.
- Stop Apache again: sudo zendctl.sh stop-apache
- Edit /usr/local/zend/etc/php.ini and add the following to the [Date] section of your php.ini file. Pick the correct timezone for your location. (You can find a list of the possible timezone options here) date.timezone = ‘America/New_York’
- Start Apache again: sudo zendctl.sh start-apache
- You may have to turn xdebug on. To do so, in the Zend Server CE management console, go to Server Setup -> Extensions and find xdebug. If it is not enabled, click “Turn On”. You will have to restart PHP for the change to take effect.
- Now if you go to the phpinfo tab, it should work fine. You should also have an “xdebug” section in the phpinfo page.
UPDATE! Jess from Zend has responded and sent another option for installing Xdebug that has been posted on the Zend Server CE Forums. Thanks Jess!
So a little explanation. Rob’s tutorial says to grab the xdebug package from pecl, so I did that the first time and everything compiled just fine, but when I tried to run it, I got nothing. I looked through the apache logs to see if I could figure out what was going on and I got this problem:
Failed loading /usr/local/zend/lib/php_extensions/xdebug.so: dlopen(/usr/local/zend/lib/php_extensions/xdebug.so, 9): no suitable image found. Did find:
/usr/local/zend/lib/php_extensions/xdebug.so: mach-o, but wrong architecture
After searching numerous blogs and finding no info on Xdebug and Snow Leopard except a bunch of questions, I found some similar issues with other modules. From what we figure from the “wrong architecture”, there is something wrong with the compiled executable that Snow Leopard generates. We went on to try to figure out how to compile Xdebug ourselves, but found the ActiveState Programmer site first and used their module. Some other folks had luck with using this, so we tried it and it worked.
Another thing, Rob’s tutorial says to shut down apache first, then disable Zend Debugger and Cache. When we tried this, we got an error from Zend Server CE stating that the web server was unreachable. That is the reason for disabling the Debugger and Cache first, then stopping Apache.
The php.ini file problem cropped up after we got Xdebug installed and working. It may be possible that you already have date.timezone in your php.ini file, so you may not need that step but we did.
I hope this helps people get Zend Server CE up and running on Snow Leopard. It really is a powerful tool and combined with Zend Studio for Eclipse, it can do some amazing stuff.
Excellent write up!
Funny how we make assumptions isn’t it? When I say to disable the Zend Server Debugger and Cache, I meant to edit the config files
This whole web gui thing is new to me!
Regards,
Rob…
ah hah! I was wondering how you got that to work
Glad to know I wasn’t crazy…well…about that anyway.
Hello,
Very nice article.
About XDebug, please see here:
http://forums.zend.com/viewtopic.php?f=44&t=2186&hilit=+xdebug
If you follow the instructions as described above, it should work
We intend to release 4.0.6 shortly which will be a 64bit build and would avoid these kinds of issues.
Feel free to drop me a line should you require more assistance.
Oh, and please download a fixed watchdog binary from here:
http://forums.zend.com/viewtopic.php?f=44&t=1115&start=30
After doing so, you can revert back to the original /usr/local/zend/bin/lighttpdctl.sh.
Thanks Jess! I scoured Google looking for info and never came across that thread. Looks like you found a solution to the pecl install, which is great. Any idea when Zend will release a new version of CE for Snow Leopard with these issues resolved? Esp. the lighthttpd/watchdog issue?
[...] See more here: Zend Server CE, Xdebug and Snow Leopard [...]
[...] Visit link: Zend Server CE, Xdebug and Snow Leopard [...]
Very helpful and informative post. I’ve been looking for the right tool that is compatible with my MAC snow leopard. It’s really great to have this wonderful solution. To Jason, thank you for recommending the Zend Server CE. I will definitely look forward for more great posts here. Thanks a lot!
We’re working on it as we correspond
I cannot commit to a specific date and I know “soon” is a somewhat vague answer, but very soon
Thanks for your post and your interest.
Jason,
A small request, I hope you won’t think its rude
Can you edit your post to include the links I provided? I’m asking because some users may not go through the comments and I’d like them to get to them.
Thanks in advance,