php debug 安装技巧


本打算配置ZendDebugger 进行调试,配置了老长时间没配置成功,在phpinfo看不到ZendDebugger生效,经查发现是php5.3的问题,必须先卸载,本文介绍使用xdebug了。

软件安装太简单了,分别执行如下命令:

sudo apt-get install apache2
sudo apt-get install php5
sudo apt-get install php5-cli
sudo apt-get install php5-xdebug

php的配置:

php.ini在/etc/php5/下的几个文件夹里,应该有三个文件夹:apache2、cli、conf.d,我们应该修改apache2和cli 下的php.ini. 在conf.d下有一个xdebug.ini文件,记录了xdebug的文件路径。

sudo vi /etc/php5/apache2/php.ini

sudo vi /etc/php5/cli/php.ini
用超级用户权限分别打开上面说的两个php.ini,添加如下代码

[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

重新启动apache:sudo /etc/init.d/apache2 restart

配置eclipse的调试和运行环境

打开eclipse的菜单-[windows]->[preferences]

选择php -debug在右面窗口中的php debugger中选择xdebug,下面的字符集选择与开发的代码字符集一致,然后应用。

选择php executables的窗口右面新建,名称:php5;excute phth:/usr/bin/php5;ini file :/etc/php5/apache2/php.ini;type:cli;debugger:xdebug。

好了,现在一切顺利,就可以进行断点调试程序了。
« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3