Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialmahmoud saeed
14,071 Points404 Error- Localhost
I'm using Windows. I am trying to connect using localhost/test.php after I installed XAMMP. I keep getting a 404 error. I can't seem to figure it out.
13 Answers
Randy Hoyt
Treehouse Guest TeacherCool! Let me know if you have any more trouble getting it to work. :~)
James White
6,159 PointsDid you start the server? You have to launch the app then on the application you'll click a button to start servers.
mahmoud saeed
14,071 PointsYes I start running Apache. Correct ports and all. Could a Firewall have anything to do with it?
Randy Hoyt
Treehouse Guest TeacherIs the test.php file in the htdocs directory? How do you know its a 404 error and not a 500 error? What is the code in that test.php file?
mahmoud saeed
14,071 PointsI have the test.php file in the htdocs folder. In that folder i have 3 other folders (forbidden, restricted & XAMMP) when i type in the site localhost/test.php it says the following...
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 Apache/2.4.3 (Win32) OpenSSL/1.0.1c PHP/5.4.7
The code that is in the test.php file is this:
<?php
"Hello World";
?>
Randy Hoyt
Treehouse Guest TeacherWhat happens if you go to [http://localhost/xampp/]?
mahmoud saeed
14,071 PointsIt pulls up the orange XAMMP site from the video (looks like a homepage to me)
Randy Hoyt
Treehouse Guest TeacherTry adding an echo command to your test.php file:
<?php echo "Hello World"; ?>
(Without that echo statement, it won't display anything.) Any chance that fixes it?
mahmoud saeed
14,071 PointsNot fixed. Same thing. I remember from your video that you did something with the firewall. Would that have anything to do with it? Im also running Vista.
Randy Hoyt
Treehouse Guest TeacherIf the ports or the firewall weren't set correctly, then I don't think you could see the localhost/xampp page.
What happens when you go just to [http://localhost/]?
mahmoud saeed
14,071 PointsIt won't let me. It defaults to the XAMMP page. localhost/xammp/
Randy Hoyt
Treehouse Guest TeacherWhat folder is all this in? Is it [c:\xampp\htdocs]?
mahmoud saeed
14,071 PointsAhhh!!! There we go. The folder I had this on was a desktop shortcut. I wasn't using the above example and I remembered that part now. You are awesome thank you so much. Can't say enough good things about you guys!