Is it possible to configure the Zend PDT debugger in eclipse to hit a breakpoint from a browser action in a similar way to that of the Java debugger for eclipse? I.e. Set a breakpoint, start the debugger, browse a site then drop into a breakpoint when it is hit.
I can debug individual scripts and Web pages however I am trying to debug a script that is called from a webpage. I am using Joomla and want to be able to traverse the dependency stack while click on page content.
Thanks in advance for any advice..!
I found out how to do this but it is quite long winded. It enables you to debug PHP like you debug Java as in you can browser your site and only drop into the debugger when you hit one of your break points. Here's the config for Linux.
First you will need to install and configure the Zend Debugger:
Configure php.ini to point to the ZendDebugger.so file.
php5 -i | grep "Loaded Conf"
into a terminal to find the correct php.ini file you need to edit and open it in a text editor
locate ZendDebugger.so
into a terminal and copy the location to the php5 Debugger file.
[Zend]
Zend_extension="[path to your ZendDebugger.so file]"
zend_debugger.allow_hosts="127.0.0.1, [your IP address if required]"
zend_debugger.expose_remotely=always
substituting in the path returned from your locate command and your IP address.
Restart PHP by typing
sudo /etc/init.d/apache2 restart
into a terminal.
Then type the
php5 -m
command into your terminal to ensure the Zend Debugger is properly configured. You will see something like:
xmlreader
xmlwriter
Zend Debugger
zip
zlib
[Zend Modules] Zend Debugger
near the end of the dump. If you don't see the Zend Debugger then make sure you have edited the correct php.ini file and ensure that the path to your ZendDebugger.so file is valid. Make sure to restart PHP for any changes to propagate.
Next you will have to configure Eclipse:
Select the project you want to debug and click OK.
PHP Debugger: Zend Debugger
Server: [local URL path to your project (should configure this in hosts file)]
PHP Executable: 5.3.x (or later)
Default Base URL / Base Path: /
Auto-generated Base URL: http://[local URL path to your project]
http://[local URL path to your project]
this should be the same URL as in your host config that you use in dev' to get to your home page. Give the config a name and set it as default. Click Finish and OK then restart Eclipse.
After installing the Opera browser go to the Window > Preferences > General > Web Browser settings again and select New and use these parameters:
Name: Opera
Location: /usr/bin/opera
Parameter: %URL%
click OK, select Firefox if it exists and remove it then check Opera and click OK.
Restart Eclipse again and you will be ready to start debugging PHP.
You may see an alert window asking you to confirm the debug URL. Remove eveything after the base URL to leave just:
http://[local URL path to your project]
as the URL and click OK.
If eclipse doesn't switch to the PHP Debug Perspective automatically then switch to it manually.