Heim  >  Artikel  >  php教程  >  php调试: Eclipse + xampp

php调试: Eclipse + xampp

WBOY
WBOYOriginal
2016-06-06 19:59:251403Durchsuche

在windows下调试php弄了半天,在网上也查了,大多版本过久,没起作用,好不容易最后弄好了。 主要参考以下两篇文章: http://www.laokboke.net/2011/05/09/how-to-debug-php-using-xdebug/ http://my.oschina.net/u/1017069/blog/119963 1、工具: Eclipse f

在windows下调试php弄了半天,在网上也查了,大多版本过久,没起作用,好不容易最后弄好了。

主要参考以下两篇文章:

http://www.laokboke.net/2011/05/09/how-to-debug-php-using-xdebug/

http://my.oschina.net/u/1017069/blog/119963


1、工具:

Eclipse for PHP Developers  http://www.eclipse.org/downloads/packages/eclipse-php-developers/heliossr2

xampp http://www.apachefriends.org/en/xampp-windows.html


2、Eclipse设置

下载eclipse for php developers后,解压就可以使用了,打开后eclipse工具后就可以配置php和xdebug的相关信息了。

window->Preferences->php,

php调试: Eclipse + xampp

如何调用php网站1

先配置php运行程序

php调试: Eclipse + xampp

如何调用php网站2

配置运行环境

php调试: Eclipse + xampp

如何调用php网站3

选择php版本

php调试: Eclipse + xampp

如何调用php网站4

配置服务器

php调试: Eclipse + xampp

如何调用php网站5

配置xdebug

php调试: Eclipse + xampp

如何调用php网站6

3、php.ini设定

 在XAMPP中已经包含了Xdebug,所以只要稍微设置即可。

     〇php.ini的修改:在文件的最后将以下内容【;】删除

        ;zend_extension = "C:\xampp\php\ext\php_xdebug.dll"
      ↓
      zend_extension = "C:\xampp\php\ext\php_xdebug.dll"


       ;xdebug.remote_enable = 0
       ↓
      xdebug.remote_enable = 1     *记得【0】要改成【1】


       ;xdebug.remote_host = "localhost"
       ↓
       xdebug.remote_host = "localhost"

php调试: Eclipse + xampp


设定完成后重新启动apache。可以在xampp控制中心里启动。

4.Eclipse中创建工程

重要:请把workspace建立在工作目录:C:\xampp\htdocs 这样可以省去很多麻烦,修改也容易。

建立在apache的工作目录:C:\xampp\htdocs\PhpStudy

php调试: Eclipse + xampp

然后右键选择工程,Debug Configurations。出现以下画面,Server Debug选择Xdebug。

     然后File选项选择你要debug的php文件

php调试: Eclipse + xampp

debug开始

php调试: Eclipse + xampp

中途会出现的一些问题。

  1,apache启动失败

      解决方法:查看那个进程占用80或443端口然后将其关闭

  2,debug开始时出现【Web Launch Already Running】错误

      解决方法:因为你已经启动过php Server,所以先将其关闭,再重新启动即可。



Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Vorheriger Artikel:php_solrNächster Artikel:Sphider + SCWS,打造完美PHP中文搜索引擎