Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » PHP Development Tools (PDT) » Get 404 when running .php project(Built in browser looks in the wrong place?)
Get 404 when running .php project [message #725455] Wed, 14 September 2011 20:38 Go to next message
suzitech2334  is currently offline suzitech2334 Friend
Messages: 2
Registered: September 2011
Junior Member
Hi,
just installed PHP Dev tools into my eclipse. Which works fine in java mode.

Wrote the 'echo "Hello World!";' php file and ran it as a Web Page. I got an 'HTTP 404 can't display web page' error. The built in browser(?) was trying to load 'localhost/test1/hellox.php'. This might work if localhost == C:/Users/Suzanne/Workspace/ but I suspect it's just = 127.0.0.1

I put 'C:/Users/Suzanne/Workspace/test1/hellox.php' in the URL and then got a 'HTTP 403 don't have permission to read this location' message. I think this could be a Windows 7 thing on the C:.

Question: what do I have to tweak to get the 'run as a web page in the built in browser' to work properly/find the right file?

The hellox.php file works fine when put in the right place for my Apache to find it. I'm running Windows 7 SP1.

Many thanks,

Suzanne.
Re: Get 404 when running .php project [message #725486 is a reply to message #725455] Wed, 14 September 2011 22:45 Go to previous messageGo to next message
don  is currently offline don Friend
Messages: 16
Registered: August 2010
Junior Member
Hi Suzanne:

What Server are you running and have you set it up to run PHP?

For Apache the Document Root normally defaults to htdocs. But if you want you can change it to point at your Eclipse work space.

You probably need to configure your Server for PHP.

Provide some more information and you will probably find someone who can help.

D.
Re: Get 404 when running .php project [message #725795 is a reply to message #725486] Thu, 15 September 2011 19:23 Go to previous messageGo to next message
suzitech2334  is currently offline suzitech2334 Friend
Messages: 2
Registered: September 2011
Junior Member
Hi Don,

thanks for your reply. I'm running the latest version of XAMPP which has Apache and PHP ready configured.

I don't think this is a problem with that setup. As you say when I put the .php file in the htdocs directory it appears in my Chrome browser fine.

I've looked at the config part of Eclipse but I can't see anywhere obvious to change for this built in browser.

Anybody got any idea about how it works?

Thanks again,

Suzanne.
Re: Get 404 when running .php project [message #725874 is a reply to message #725795] Fri, 16 September 2011 03:53 Go to previous messageGo to next message
don  is currently offline don Friend
Messages: 16
Registered: August 2010
Junior Member
Hi Suzanne:

Sorry I must have missed the part about the hellox.php works fine in the right place. I don't think the browser is the issue, you can change browser in Eclipse using the Windows menu select Web Browser (at least in Helios). You might try to run the php file from within Eclipse, opening the context menu and run as PHP Script.

I'm not familiar with XAMPP but from what I have read it sounds like it comes pretty much setup to run php. If it is working when you load the php file in the Apache2.2/htdocs directory run phpInfo() to get a listing of the settings and variables.

I just completed creating a development environment using Eclipse Helios, PHP 5.2, Zend and Apache2.2. The browser errors aren't very informative - check the Apache Error logs. They helped me.

If this is a development environment be sure to turn on the error directives in the php.ini file. If it is a production environment you should leave them off.

If you decide to run the phpInfo() post the key configuration and environment variables and maybe someone will see something that can help.

Sorry I can't be of more assistance.

D.
Re: Get 404 when running .php project [message #734613 is a reply to message #725874] Sat, 08 October 2011 21:59 Go to previous message
Donald F Coffin is currently offline Donald F CoffinFriend
Messages: 1
Registered: October 2011
Junior Member
Hi Suzanne:

I just installed XAMPP and the PHP development tools on my system which is also running Windows 7 SP1. Everything looks fine until I attempt to run the project's Index.PHP file as a "Web Page". What appears in the Eclipse browser is a 404 error. I believe the 404 error is due to the fact the Eclipse internal browser is NOT including the Eclipse Workspace folder as part of the URL. In my case, the Index.PHP file is located in the "C:/xampp/htdocs/joomla_development/Joomla 1.5 Source" directory, but the internal browser is requesting to display "http: //localhost/Joomla 1.5 Source/index.PHP". When I execute PHPINFO() the "Document_Root" value is "c:/xampp/htdocs/" which explains the 404 error.

I don't know if the error is being caused because the Eclipse Project Wizard is creating the source file in a sub-directory or because there is no way to alter the value being used by the internal browser for the "localhost" variable. I tried to change the Apache server's "Document Root" value but then the Xampp PHP files obtain a 404, since PHP is no longer looking in "C:/xampp/htdocs" as the location for it's PHP and HTML files.

I also attempted to update the "Document Root" location for the default web server in the Window -> Preferences -> PHP -> PHP Servers dialog by selecting the only listed server and then the "Edit" button. This brought up a dialog box that contains a field entitled "Enter the URL that points to the document root of this server" which has a default entry of "http: //localhost". However, when I entered "http: //localhost/joomla_development" I obtained the following error:

Please enter a valid Server URL (<protocol>://<server url>:[:<port>])

Additionally, if I attempt to run the Index.PHP file on a server I obtain the error "The selection does not contain any resources that can run on a server".

If anyone in the forum has a solution for this problem, please post it as I am just beginning to use the Eclipse platform and am not sure where to look on the Internet for a solution.
Previous Topic:Console information doesn't show up while remote debugging
Next Topic:Unbound build path container: 'org.eclipse.php.core.LANGUAGE
Goto Forum:
  


Current Time: Thu Apr 25 21:09:24 GMT 2024

Powered by FUDForum. Page generated in 0.03068 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top