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
7 comments on “Enable Zend PHP Debugging under IntelliJ 11.1
  1. It’s fitting time to make a few arrangements for the future and the time has come to be glad. I have perused this post and on tt to be very difficult for learners much like me. However, you have made it very easy for me to fully grasp and I now have in mind the correct thing. Your continued reputation as one of the top experts on this topic may be increased through words with appreciation from visitors like me. Thanks, again. I definitely enjoying every little bit of it. It is a great website and nice share. I want to thank you. Good job! You guys do a great blog, and have some great contents. Keep up the good work.

  2. I’m Really Impressed With Your Article, Such Great & Usefull Knowledge You Mentioned Here

  3. Thanx For Sharing Such Useful Post Keep It Up :)

  4. I greatly strengthening looking article. I discovered this as an educational and intriguing post, so I think it is to a psyche boggling degree relentless and skilled. I may need to thank you for the exertion you have made in making.

  5. This article is use simple, straightforward sentences with few modifying phrases and clauses.I enjoy articles that have one big word that fits perfectly. It makes me feel the article was worthwhile , no matter what. Thank you for this information.

  6. 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>