Tag Archives: php

xdebug no longer working after php upgrade [SOLVED]

I recently upgraded php to version 5.4.6 and my debugging with vim and xdebug got broken with no visible error message. I found out that xdebug was not correctly updated. “cat /etc/php5/conf.d/20-xdebug.ini” reveals following content: zend_extension=/usr/lib/php5/20090626+lfs/xdebug.so A quick “ls /usr/lib/php5” returns the following: 20100525+lfs  libexec  maxlifetim Conclusion: xdebug.ini is pointing to a no-longer existing folder. Solution Uninstalling php5-xdebug and reinstalling it did not solve the issue. Simply manually edit the 20-xdebug.ini file to point towards correct folder, in that case: zend_extension=/usr/lib/php5/20100525+lfs/xdebug.so  

Enable debugging in php

Installation Below are great tutorials on how to enable php debugging with vim and xdebug: https://mutelight.org/minimal-guide-to-debugging-php-with-xdebug-and-vim http://www.weberp.org/forum/archive/index.php/thread-9.html In a nutshell: sudo apt-get install vim php5-xdebug sudo vi /etc/php5/conf.d/xdebug.ini and append below content: xdebug.remote_enable=1 xdebug.remote_host=localhost xdebug.remote_port=9000 xdebug.remote_autostart=1 Note: remove last line when in production, it’s pupose is to avoid having to run ?XDEBUG_SESSION_START=1 before debugging sudo apache2ctl restart download debugger.tar.gz from above link mkdir -p ~/.vim/plugin cd ~/.vim/plugin ; tar -xzf <path_to_debugger.tar.gz_file> Vim usage To learn how to use vim, open a shell and run ‘vimtutor’ to go through the tutorial! Vim debugging tips Once vim and xdebug are working together […]

XPath, SimpleXML and default namespace

I explained in a previous post (SimpleXML and default namespace) how to register default namespace on SimpleXMLElement in order to execute an xpath query, and why in some cases this step is simply mandatory. Bad news is that xpath-namespaces are registered on a per-node basis. Ie. if you execute an xpath query on another SimpleXMLElement (let’s say a child of the node on which you registered your default namespace), then you need to register it on this node too for your xpath query to get successfully executed. You need to register xpath-namsepaces on each SimpleXMLElement on which an xpath query […]