怎样在eclipse下运行php程序

如题所述

笔者刚刚接触PHP-Eclipse,今天刚把debug PHP的方法弄好,发出来与大家共享一下。
  第一步:到Eclipse的官网去下载PHP-Eclipse:  
  第二步:下载Xdebug
  第三步:在PHP5里面找到php.ini,在这个文件的最后面加入如下配置信息:
  [xhtml] view plaincopyprint?
  [Xdebug]
  zend_extension_ts="C:/Program Files/phpStudy/PHP5/ext/php_xdebug.dll"
  xdebug.auto_trace = On
  xdebug.show_exception_trace = On
  xdebug.remote_autostart = On
  xdebug.remote_enable = On
  xdebug.remote_host = 127.0.0.1
  xdebug.remote_port = 9000
  xdebug.remote_handler = dbgp
  xdebug.profiler_enable = on
  xdebug.profiler_output_dir="C:/Program Files/phpStudy/PHP5/log
  这里要特别注意:如果在文件里有其他的zend_extension_ts,需要注释掉,否则apache无法启动。
  第四步:启动apache。
  第五步:在eclipse的项目里的Properties里面找到"PHP Debug",在PHP Debugger里面选择"XDebug"  
  再配置一下:
  第六步:再在Windows->Preferences里面配置下PHP Servers
  接下来,进入debug界面,就可以开始设置断点进行debug了。
温馨提示:内容为网友见解,仅供参考
第1个回答  推荐于2017-12-16
我安装的是PHP Version 5.3.26,按照网上提示在Eclipse中使用XDebug进行调试,不过配置了却使用不了,下面把解决方法简要说一下。
XDebug老是加载不了
From PHP 5.3 onwards, you always need to use the zend_extension PHP.ini setting name, and not zend_extension_ts, nor zend_extension_debug. However, your compile options (ZTS/normal build; debug/non-debug) still need to match with what PHP is using.
Php.ini中的配置
;debug configuration
zend_extension="D:/servers/php-5.3.8/ext/php_xdebug-2.1.3-5.3-vc9.dll"
;xdebug配置
[Xdebug]
xdebug.remote_enable=1
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.auto_trace = On
xdebug.show_exception_trace = On
xdebug.remote_autostart = On
xdebug.collect_vars = On
xdebug.collect_return = On
xdebug.collect_params = On
Eclipse配置
在eclipse的项目里的Properties里面找到"PHP Debug",在PHP Debugger里面选择"XDebug"

再配置一下:

再在Windows->Preferences里面配置下PHP Servers本回答被提问者采纳
相似回答