如何在Eclipse中调试php

4

我刚接触PHP...在Eclipse IDE中,如果我使用Run As --> "PHP Script"运行PHP代码,那么一切都正常,但是如果使用Run As --> "PHP Web Page"运行,则会出现错误。

Object not found!
The requested URL was not found on this server. 
If you entered the URL manually please check your spelling and try again. 

If you think this is a server error, please contact the webmaster. 

Error 404
localhost
03/22/11 12:04:12
Apache/2.2.11 (Win32) DAV/2 mod_ssl/2.2.11 
OpenSSL/0.9.8i mod_autoindex_color PHP/5.2.8 

Please help me.... Gnanendra


2
我以为 var_dump 是 PHP 的调试器。 - Ben
2个回答

4
如果您使用XAMPP,请将您的eclipse项目工作空间放在XAMPP\htdocs\文件夹中。如果您使用WAMP,则请将其放在WAMP\www\文件夹中。您会在安装目录下找到XAMPP或者WAMP文件夹。
供您参考: enter image description here

我可以在htdocs目录(文件夹)中拥有多个项目吗? - Gnanendra
是的,您可以在htdocs中拥有多个项目,只要它们都在不同的目录中。例如:要运行每个项目,在浏览器中只需键入目录名称;http://localhost/project1/,http://localhost/project2/等。 - Maggie

1
你是否使用任何XAMPP或WAMP服务?你是否正确放置了你的文件?它说Apache找不到你的文件。也就是说,你要么没有正确配置你的环境,要么你的文件放错了位置。

1
是的,我已经安装了XAMPP,其中包含Apache、MySql和php。 - Gnanendra
1
你的文件可能放错位置了。它是否在htdocs目录下?你的Eclipse工作空间也需要在这里设置。 - J Bourne
1
是的,我的Eclipse工作区不在htdocs目录下,而是在除了"C"驱动器之外的其他位置。请问您能告诉我htdocs目录的路径吗? - Gnanendra
1
你也可以在XAMPP中设置htdocs的路径。这样你就不必移动Eclipse项目了... - strauberry
请问您能否解释一下如何在XAMPP中设置到htdocs的路径? - Gnanendra
1
你可以参考这个问题:如何让XAMPP/Apache在htdocs之外提供文件服务 - Maggie

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接