I have been writing PHP programs for more than a year. I still use the original print_r (); exit (); and var_dump (); exit (); for debugging, the biggest problem with it is that it cannot trace the code flow. It can also solve the problem of simply viewing the value of basic variables. If you use a large framework like Zend framework, without a deep understanding of the process,
It is difficult to write highly efficient code. As our boss often said, PHP is easy to get started and can be written by anyone, but it is difficult to become a master. I think an important part of becoming a master is
Code debugging and understanding of the entire process. Today, I thought my colleague was a master. I organized this tool together. Today I want to talk about how to use the toolbar plug-ins of Zend studio and Zend Firefox to track and debug the code process:
System configuration instructions:
Windows 7, 2 GB memory, 2.5 GHz processor clock speed, Zend studio 8.0, Firefox 3.6
First from http://www.zend.com/en/products/studio/downloads
Download Zend studio 8.0 and search for serial numbers.
|Zend Studio 8
||(Windows MSI) 350.53 MB
Download (Firefox toolbar) 0.21 MB, which is a FF plug-in. Drag and Drop it to versions earlier than FF 3.6.
|Zend server (PhP 5.3)
||(Exe) 65.28 MB
When installing Zend server, you only need to ensure that other services do not occupy port 80. If you use integration tools like apmserv, you can stop the apache service and install Zend server. apache service is enabled by default. The current version is apache2.2-Zend.
If the above installation is successful, you can trace and debug it. However, it is most convenient to install the root directory of the website locally. For example, if your Zend server is installed on E:/program files/Zend/zendserver by default, the default installation directory of Apache is: e:/program files/Zend/apache2/. You can find httpd in Conf. conf, and then add the VM, for example:
# Apmserv default Virtual Host
<Virtualhost *: 880>
Options followsymlinks IncludesNOEXEC Indexes
Directoryindex index.html index.htm default.htm index. php default. php index. cgi default. cgi index. pl default. pl index.shtml
AllowOverride none # If set to none, all. htaccess files are ignored.
Order deny, allow # order command controls the default access status and the order in which the allow and deny commands take effect. By default, all accesses are allowed.
Allow from all
Then in your system directory, such as C:/Windows/system32/Drivers/etc/hosts, open it and add a line:
Then restart the Apache server. At this time, enter www.example.com in FF to view your local root directory file.
At this time, you click the debug button on the toolbar in the FF toolbar. At this time, it will prompt you if you do not need to be prompted in the future. You can simply select OK.
Then you can see the debugging status in Zend studio. Then you can click F5 or F6 to debug it step by step. The value of each variable is displayed on the right,
Hope to help new PHP debugging!