I planned to configure ZendDebugger for debugging, but the configuration failed for a long time. I couldn’t see ZendDebugger taking effect in phpinfo. After investigation, I found that it was a problem with php5.3 and must be uninstalled first. This article introduces the use of xdebug.
Software installation is too simple, execute the following commands respectively:
sudo apt-get install apache2
sudo apt-get install php5
sudo apt-get install php5-cli
sudo apt-get install php5-xdebug
php configuration:
php.ini is in several folders under /etc/php5/. There should be three folders: apache2, cli, conf.d. We should modify php.ini under apache2 and cli. There is one under conf.d The xdebug.ini file records the file path of xdebug.
sudo vi /etc/php5/apache2/php.ini
sudo vi /etc/php5/cli/php.ini
Open the two php.ini mentioned above with super user privileges and add the following code
[xdebug]
xdebug.remote_enable = 1
xdebug_remote_host = "localhost"
xdebug.remote_port = 9000
xdebug.remote_handler = "dbgp"
zend_extension=/usr/lib/php5/20090626+lfs/xdebug.so
Restart apache: sudo /etc /init.d/apache2 restart
Configure the debugging and running environment of eclipse
Open the eclipse menu-[windows]->[preferences]
Select php -debug Select xdebug in the php debugger in the right window, the following character set Select a character set that is consistent with the code you developed, and then apply.
Select php executables and create a new one on the right side of the window, name: php5; excute phth: /usr/bin/php5; ini file: /etc/php5/apache2/php.ini; type: cli; debugger: xdebug.
Okay, now that everything is going well, you can start debugging the program with breakpoints.
The above introduces the php debug installation skills, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.