现在的位置: 首页 > 综合 > 正文

linux(ubuntu) php 调试环境安装

2013年06月19日 ⁄ 综合 ⁄ 共 2053字 ⁄ 字号 评论关闭

eclipse php 插件(http://wiki.eclipse.org/PDT/Installation):

http://download.eclipse.org/tools/pdt/updates/2.2/milestones

-----------------------------------------------------------------------------------------

http://www.wenhq.com/article/view_635.html

软件开发的断点调试是必不可少,这里介绍ubuntu10.04中eclipse工具中php的调试配置。

本打算配置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 gedit /etc/php5/apache2/php.ini

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

;xdebug配置
[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

;开启自动跟踪
xdebug.auto_trace = On
;开启异常跟踪
xdebug.show_exception_trace = On
;开启远程调试自动启动
xdebug.remote_autostart = On
;开启远程调试
xdebug.remote_enable = On
;收集变量
xdebug.collect_vars = On
;收集返回值
xdebug.collect_return = On
;收集参数
xdebug.collect_params = On

xdebug.collect_assignments = On

--------------------------------------------------------------------------------------

http://techmania.wordpress.com/2008/07/02/debugging-php-in-eclipse-using-xdebug/

在xdebug.ini中添加下列配置:
sudo gedit /etc/php5/conf.d/xdebug.ini

xdebug.remote_enable=On
xdebug.remote_host="localhost"
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"

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

--------------------------------------------------------------------------------------

http://www.txstudy.com/wap.aspx?nid=2638&cid=11&sp=386

配制eclipse的浏览器

打开eclipse,找到window->preferences->general->web browser,看一下有没浏览器,没有就添加一下,当然是firefox

配制运行及调试选项

window->preferences->PHP->>php executables->add->设置如下

php5/usr/bin/php5 (注意这里要选择php5,不要是php,因为我们安装的是php5-xdebug)

继续配制debug(麻烦啊)

window->preferences->PHP->run/debug->perspectives->可以找到php script和php web page,分别设置他们的debug,及运行程序。

建立PHP脚本后,最后调试运行

打开Run->Open Debug Dialog ,选择调试所需要用的名称和环境,仔细看一下,应该没问题。

然后就可以单步调试了

抱歉!评论已关闭.