As I've said many times, I am an avid user of Zend Server for local development on my Mac. It has pretty much everything you need, including a simple to use back-end for viewing issues occuring on your server which make debugging easier. Well, on the debugging front it has a major shortcoming: it comes with Zend Debugger which only works with the very expensive Zend Studio IDE. All other IDEs (Eclipse, NetBeans, phpStorm, ...) only provide support for XDebug. Every time I update Zend Server I have to install and enable XDebug instead of Zend Debugger. It's easy and will help you debugging your PHP applications easily on your local environment. This article describes how to do it.
Even though Zend Server ships with the XDebug extension, I have found that it doesn't actually work. Bummer. Compiling from sources is one option, but I take it that most PHP developers are not hardcore UNIX geeks. Luckily, there is a source for a good quality precompiled package. So start by downloading the "PHP Remote Debugging Client" from ActiveState. Remember to download the Mac OS X package.
Extract the package you downloaded. You will see several directories. You need to go inside the directory corresponding to your Zend Server PHP version, i.e. 5.3 for PHP 5.3 or 5.4 for PHP 5.4. Copy the xdebug.so file into the /usr/local/zend/lib/debugger directory on your Mac.
Now create the file /usr/local/zend/etc/conf.d/xdebug.ini with the following contents:
xdebug.default_enable=1 xdebug.max_nesting_level=100 xdebug.scream=0 xdebug.overload_var_dump=1 xdebug.var_display_max_children=128 xdebug.var_display_max_data=1024 xdebug.var_display_max_depth=5 xdebug.collect_includes=1 xdebug.collect_params=0 xdebug.collect_vars=0 xdebug.dump_globals=1 xdebug.dump_once=1 xdebug.dump_undefined=0 xdebug.show_exception_trace=0 xdebug.show_local_vars=0 xdebug.show_mem_delta=1 xdebug.extended_info=1 xdebug.remote_connect_back=1 xdebug.remote_enable=1 xdebug.remote_handler="dbgp" xdebug.remote_host="localhost" xdebug.remote_mode="req" xdebug.remote_port=9000
Feel free to change the XDebug configuration parameters to your liking. They are documented in the XDebug site.
We now need to tell PHP to load XDebug and not load Zend Debugger.
Edit the file /usr/local/zend/etc/conf.d/zend_extension_manager.ini. Find this line:
and add the following line before it:
It will now look like this:
Go to http://localhost:10081/ZendServer/Login and click on Configurations, Components. Select Zend Debugger and click on Disable. Then click on the Restart PHP button (looks like a recycle button in the upper right hand corner of the page).
If you now load a phpinfo() page you will see something like the following below the first table:
This program makes use of the Zend Scripting Language Engine: Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies with Xdebug v2.3.2-komodo, Copyright (c) 2002-2013, by Derick Rethans with Zend Extension Manager v6.0.0, Copyright (c) 2003-2013, by Zend Technologies - with Zend Data Cache v6.0.0, Copyright (c) 2004-2013, by Zend Technologies [loaded] [licensed] [enabled] - with Zend Job Queue v6.0.0, Copyright (c) 2004-2013, by Zend Technologies [loaded] [licensed] [enabled] - with Zend Utils v6.0.0, Copyright (c) 2004-2013, by Zend Technologies [loaded] [licensed] [enabled] - with Zend Optimizer+ v6.0.0, Copyright (c) 1999-2013, by Zend Technologies [loaded] [licensed] [enabled] - with Zend Code Tracing v6.0.0, Copyright (c) 2009-2013, by Zend Technologies [loaded] [licensed] [enabled] - with Zend Monitor v6.0.0, Copyright (c) 1999-2013, by Zend Technologies [loaded] [licensed] [enabled] - without debugger [not loaded] - with Zend Page Cache v6.0.0, Copyright (c) 2004-2013, by Zend Technologies [loaded] [not licensed] [disabled]
The line reading "with XDebug" tells you that XDebug is loaded and working. Congratulations, you are now ready to debug your PHP applications with pretty much every PHP IDE out there!
Changelog: 2014-05-26 Updated instructions for Zend Server 6.3.0