Recently I dubbed into PHP development, and have chosen Zend Studio for Eclipse as my development platform. Eclipse is so different than Visual Studio in terms of usability that I have to spend some time in familiarizing myself with the tool. I had some difficulties in even setting up a simple Eclipse project . So to help other people, I wrote a post on how to do just that.
Now, this is a post on how to debug a PHP file. It doesn't take a genius to figure out what's the latest problem I had run into.
Here are the steps on how to debug a PHP file as a webpage using Zend Studio for Eclipse
- Download and install Zend Studio for Eclipse , of course.
- Download Zend Core . Install it on your web server. So if you are using your own machine as the server, then install it on your machine. If you want to do remote debugging, you have to install it on the real server.
- Create a new project, name it as WebPageGo, choose the default workspace for Eclipse.
- Put in a dummy.php in your htdocs folder ("C:\Program Files\Apache Software Foundation\Apache2.2\htdocs").
- In the Conf\Extra folder ("C:\Program Files\Apache Software Foundation\Apache2.2\conf\extra"), Create a new configure file StupidWorkPlace.conf. Type in the following content:
DocumentRoot "C:\Documents and Settings\%YourUsername%\Zend\workspaces\DefaultWorkspace" DirectoryIndex index.html index.php AddDefaultCharset UTF-8 AllowOverRide none Options FollowSymlinks Order allow,deny Allow from all
- In your httpd.conf file, type in
- Create a a PHP script call DoesItMatter.php ( don't ask me what's the reason behind this name). Put it under the WebPageGo workspace.
- Type In the following scripts:
Hello word <br/> <?php echo "I want to debug"; phpinfo(); ?>
- Choose Debug As->PHP Web Page, but before that set a breakpoint at the echo statement.
- And voila! You can now step into the web page for debugging!