среда, 16 января 2013 г.

Configure ZendDebugger for PHP5.4

Params:
OS: Ubuntu12.10 - Linux A230512 3.5.0-21-generic #32-Ubuntu SMP Tue Dec 11 18:51:59 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
Web server: Apache2
PHP: PHP 5.4.6-1ubuntu1.1  Zend Engine v2.4.0

Problem:
Need to debug php scripts with ZendStudio10(beta!). But officially Zend doesn't produce Debugger for PHP v5.4, latest version for v5.3

Solution:
Main idea: download ZendServer package for PHP5.4 get ZendDebugger from this pacakge and install it manually. Follow those steps and you will be fine!

1) Get deb package of ZendServer(depending your system 64 bit or 32) for PHP5.4
> wget http://repos-source.zend.com/zend-server/preview-php5.4/deb/pool/php-5.4-debugger-zend-server_5.3.33+b7_amd64.deb
2) Unpack it:
dpkg -x php-5.4-debugger-zend-server_5.3.33+b7_amd64.deb php54debugger
3) Copy ZendDebugger.so to the right place:
cp ./usr/local/zend/lib/debugger/php-5.4.x/ZendDebugger.so /usr/lib/php5/20100525/ZendDebugger.so
4) Copy zend debugger.ini to the right place:
cp ./usr/local/zend/etc/conf.d/debugger.ini /etc/php5/mods-available
5) Now you need to replace one string that ini file. Find this string
zend_extension_manager.dir.debugger=/usr/local/zend/lib/debugger
and replace it to this
zend_extension=/usr/lib/php5/20100525/ZendDebugger.so
6) Enable this ini file:
ln -s /etc/php5/mods-available/debugger.ini /etc/php5/fpm/conf.d/30-debugger.ini
7) Restart web server:
/etc/init.d/apache2 restart

This works for me from the box, no additional actions.

PS. All scripts and commands depends of your OS, in this version its Ubuntu.
Giant thanks to the author of this post original version