Enable Zend PHP Debugging under IntelliJ 11.1

Use case

In this tutorial I assume that you have already installed and configured the Web server and the PHP engine properly.
If not, please have a look at this tutorial.

Solution

In our configuration we use all default properties (like debug port, broadcasting port etc).

Enable PHP plugin (PHPStorm)

  • Select your project and open the settings menu.
  • Under the project settings you find a PHP entry
  • Select the PHP version
  • Confiure an interpreter
    • Click on the … button
    • Click the plus button in the left-handed upper corner
    • Chose a name (something like PHP<5.3.6>)
    • Under General->PHP Home point to you PHP location (in my case /usr/bin)
    • As debugger choose the Zend Debugger
    • Submit the form
  • If you don’t see the newly configured interpreter directly push the refresh button
  • Now you should see the new interpreter (PHP<5.3.6>)
  • By clicking on the question mark you can see an overview of your PHP configuration.
    Notice that you dont see any debug parts yet. you should not

Download Zend Debugger

  • Download the Zend Debugger package which corresponds to your operating system here (Studio Web Debugger)
  • Locate the ZendDebugger.so file in the directory which corresponds to your version of PHP (e.g. 4.3.x, 4.4.x, 5.0.x, 5.1.x, 5.2.x)
  • Copy the file to your Web server in a location that is accessible by the Web server (like /home/foo, /opt/bar or whereever you like the file to be stored).

Enable Zend Debugger in PHP

  • Create a phpinfo-page (HowTo)
  • Search for the key “Loaded Configuration File” to see which php.ini your system is using
  • Edit the php.ini
  • Add or extend the zend-section by adding following settings:
    [Zend]
    zend_extension=<path_to_ZendDebugger.so
    zend_debugger.allow_hosts=127.0.0.1
    ;zend_debugger.allow_hosts=127.0.0.1,localhost
    zend_debugger.expose_remotely=allowed_hosts
  • Restart apache.

Create Debug-Configuration in IntelliJ

  • Click on “Edit Configurations” (it’s located in the toolbar next to the play-button)
  • Add a new configuration- Chose “PHP Web Application” as type
  • Set a unique name for your project debug configuration
  • Chose “localhost” as server- Point the start URL to the project http root
  • Click OK

Debug

  • Set a breakpoint somewhere in your code (that of course gets executed)
  • Start the debugger (debug icon next to the play button)
  • Open (if IntelliJ did not already opened a browser on its own) a browser and access the root URL

Conclusion

Now IntelliJ should stop at your breakpoint.

Tagged with: , ,
Posted in Debugging, IntelliJ, kubuntu, Linux, PHP, Webserver, Zend
One comment on “Enable Zend PHP Debugging under IntelliJ 11.1
  1. I use Codelobster PHP Edition for it
    It has great free PHP bedugger

1 Pings/Trackbacks for "Enable Zend PHP Debugging under IntelliJ 11.1"
  1. [...] here: Enable Zend PHP Debugging under IntelliJ « Blog @ CWILL … Bookmark on Delicious Digg this post Recommend on Facebook share via Reddit Share with Stumblers [...]

Leave a Reply

Your email address will not be published. Required fields are marked *

*

Anti-spam protection

Prove that you are Human by typing the emphasized characters:


Protected by Gab Captcha 2

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>