`
bluecrystal
  • 浏览: 265621 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

eclipse+pdt下php调试环境的搭建

    博客分类:
  • php
阅读更多
  最近一个项目用到lamp体系来构建,这其中采用了php作为脚本开发语言,于是搭建一个方便的php开发调试环境就成了必须。在该项目中我们采用了eclipse+pdt来作为开发环境,但是其调试环境却要稍微配置一下。本文就介绍如何来配置(很多地方我都是指出解决问题的出处,我不想通过转述来表达其自身文档已经说明的很清楚的问题evil)。 

  1  前提 eclipse + pdt(PHP Development Tools);

  2  不要以为在eclipse中安装好了pdt,就可以调试php代码了,必须下载一个调试器,这里我们选择ZendDebugger,请到官方网站下载(需要注册一个用户),下载地址为:http://www.zend.com/en/products/studio/downloads

  3  下载后请按照压缩包中的readme.txt的说明进行安装;

Zend Debugger installation instructions
---------------------------------------

1. Locate ZendDebugger.so or ZendDebugger.dll file that is compiled for the
   correct version of PHP (4.3.x, 4.4.x, 5.0.x, 5.1.x, 5.2.x) in the
   appropriate directory.

2. Add the following line to the php.ini file:
   Linux and Mac OS X:     zend_extension=/full/path/to/ZendDebugger.so
   Windows:                zend_extension_ts=/full/path/to/ZendDebugger.dll
   Windows non-tread safe: zend_extension=/full/path/to/ZendDebugger.dll
   
   (*) the windows non-thread safe is used only with Zend Core 2.0
   
3. Add the following lines to the php.ini file:
   zend_debugger.allow_hosts=<ip_addresses>
   zend_debugger.expose_remotely=always

4. Place dummy.php file in the document root directory.

5. Restart web server.

  大家请注意红色字体部分,需要更改为您自己的路径或配置,第4条请勿忽略;

   4  设置完zend debugger后,回到eclipse中,选择Window-Preferences-php-php executables里面添加一条记录,指向你的php安装目录;

  5  设置完毕以上事项后,在eclipse中,选择Help-Help Contents-PDT User Guide-Getting Started-Basic Tutorials-Working with the Debugger,请参照此文档学习如何在该环境下调试php代码,需要提醒注意的是在进行php web程序调试的时候,一定要把工程文件复制到apache服务器目录下,并且做好与本地文件之间的对应关系,这样一旦开始进入调试模式,调试器才能找到源代码。

  后注:其实zend debugger和pdt的在线文档写的相当的清楚,各位同学只要养成使用什么软件就阅读其自带文档的习惯,很多问题都是可以在其自身文档中获得帮助的。lol
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics