Previously, I introduced the php development tool Zend studio7 getting started tutorial. In fact, it is very convenient to debug PHP using Zend studio. Zend Studio supports the debugging tool Zend Debugger by default and allows the use of third-party debugging tools, today I will share with you how to use Zend studio to configure xdebug to debug PHP in the form of a PHP tutorial. Program .
Before using xdebug to debug the PHP source code in Zend studio, install and configure xdebug. This is a basic tutorial. For more information, see the xdebug installation and configuration tutorial of the PHP debugging tool, xdebug and Zend studio are different in configuration.
Before using xdebug to debug PHP source code in Zend studio, configure xdebug for Zend studio. Otherwise, xdebug cannot be used to debug PHP.
Xdebug for Zend Studio
Open the PHP installation directory (how to install and configure PHP ?) Under the php. ini configuration file, my directory is c: \ PHP, find the xdebug configuration information, add the following xdebug configuration information
1 2 3 4 |
Xdebug. remote_enable = true // xdebug allows remote ide connection Xdebug. remote_host = 127.0.0.1 // ip address of the Zend studio that can be connected Xdebug. remote_port = 9000 // port used by Zend studio for reverse connection Xdebug. remote_handler = dbgp // application layer communication protocol used for remote debugging of Zend Studio |
Important: Xdebug is a problem that is easily overlooked here. configure remote_host information. If you are using a LAN or wireless router, run xdebug. it is useless to configure remote_host to 127.0.0.1, and Zend studio cannot be used to debug PHP. The single-step debugging button of Zend studio is also invalid! You must configure xdebug. remote_host to the actual address of the Zend studio installation machine. You can view the IP address through ipconfig. Because I use a wireless router, I configure xdebug. remote_host to 192.168.1.100.
Restart the Apache server.
OK. Now we can use xdebug for debugging in Zend studio.
Zend Studio supports debugging of PHP by default. Therefore, you must configure the Zend studio PHP debug option to xdebug before using xdebug.
Step 1 of Zend studio using xdebug to debug PHP
Open Zend studio7, select project> properties, and select the PHP debug option on the left in the pop-up interface,
Configure xdebug to debug PHP in Zend Studio
Select the ENABLE project specific settings option, select the xdebug option in the PHP debugger option, and click OK.
Description: When Zend studio is used to debug PHP, sometimes a problem occurs, that is, Zend studio does not use xdebug for debugging when debugging the PHP file, you can select a specific project or project file by clicking the project window at the top left, right-click and select the properties option for configuration, and the interface is the same.
Use xdebug to debug PHP source code in Zend Studio
Use Zend studio to debug PHP. The debug as menu contains three options: PHP script, PHP Web page, and PHP unit test, because xdebug is not selected when Zend studio is used to debug PHP before the same PHP file may exist, you need to clear the old debugging file. You can clear the files in the preceding three Zend studio debugging methods from the debug debuations menu, the PHP Web page is selected here, so you only need to clear the files in this item.
Debug configurations can be entered in three ways: 1. Right-click the PHP file to be debugged, select debug as or open the PHP file for debugging; 2. Select debug as under the run menu on the menu bar to enter; 3. Click the down arrow next to the little spider icon under the run menu in the menu bar and select debug deployments.
After the debug configurations configuration is complete, open the PHP file that needs to be debugged using Zend studio and select the php web page option in debug as. Check the launch URL and click OK to debug the file, figure of xdebug debugging PHP file in Zend Studio
Use xdebug to debug PHP in Zend-studio
You can debug the PHP file through one-step debugging (F5), as long as the xdebug configuration is correctCodeThe selected light green background code appears in the window. Otherwise, the single-step debugging (F5) function is invalid.
Finally, you can see the debug information file cachegrind output by xdebug in the Directory D: \ phpweb \ xdebug \ trace and D: \ phpweb \ xdebug \ profiler. out. * And trace. *. XT.
Now, the basic tutorial for configuring xdebug to debug PHP source code using Zend studio is complete. In the future, we will introduce more PHP tutorials for Zend studio to debug PHP source code.
Note: PhP website development tutorial -leapsoul.cn All Rights Reserved. Please indicate the original source and this statement in the form of a link during reprinting. Thank you.