Error 404

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Error 404

Postby The Coop » 22. November 2019 14:33

I am fairly new to this and perhaps this topic has been answered before but I am getting frustrated.
I am quite experienced with HTML and CSS but I am trying to learn PHP. I have written the following to test my wamp server:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Untitled 1</title>
</head>

<body>

<?php
$number = "5";
$sum = 15 + $number;
$sum = "Twenty";
?>

</body>

</html>


This was saved to xampp/htdocs folder. I typed "localhost/stringnumber.php" into my Chrome browser address bar and got the following message:

Not Found
HTTP Error 404. The requested resource is not found.

I have had the same error message with the Easyphp and Abyss webservers a well.

I am using an Acer E5 laptop with 1Tb hhd and 8Gb memory running W10 home and using MS Expression Web 4.

Any ideas please?
The Coop
 
Posts: 6
Joined: 22. November 2019 14:21
XAMPP version: 3.2.4
Operating System: Windows 10 home

Re: Error 404

Postby Nobbie » 22. November 2019 22:03

The Coop wrote:This was saved to xampp/htdocs folder.


Oh, what a pity, unfortunately you didnt tell us, which NAME you choose for saving it to xampp/htdocs folder?! Could you tell us now? Actual that is MOST IMPORTANT and i really wonder, why you left out that crucial information?!

The Coop wrote:I typed "localhost/stringnumber.php" into my Chrome browser address bar


Aha. And why did you so? Why not "localhost/lirumlarum.php" or for example "localhost/blubblubb.php"? Or any other senseless string?
Nobbie
 
Posts: 13214
Joined: 09. March 2008 13:04

Re: Error 404

Postby The Coop » 23. November 2019 12:29

As I said, I am new to PHP. I saved the file as stringnumber.php and tried to run it by entering localhost/stringnumber.php. From what I read, this is the way it is done. If this is not so could you please let me know.

I was rather hoping for a more constructive response rather than this sarcastic approach.
The Coop
 
Posts: 6
Joined: 22. November 2019 14:21
XAMPP version: 3.2.4
Operating System: Windows 10 home

Re: Error 404

Postby Altrea » 23. November 2019 18:24

Are you sure your XAMPP Apache server is actually running and not a different one?

Because from your explanation is should work exactly that way.

What happens if you request just http://localhost/ ?
What is the contents of your Apache access.log?
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11952
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: Error 404

Postby Nobbie » 23. November 2019 20:40

The Coop wrote:As I said, I am new to PHP


Yes, but file names are not unique for PHP scripts, every file has a name and if you save a file, you have to assign a name. It's a bit of a fake dumb trick if you claim to be a "PHP novice". This is artificial and I don't like this artificial kind of "I'm such a poor newbie".

Anyway, if you used Notepad to edit/write your PHP script, it may happen that Notepad appends ".txt" to your file, which results in "stringnumber.php.txt". But in most Windows installations, explorer hides the extension for "known file types". This results in the incorrect display of "stringnumber.php" as filename instead of stringnumber.php.txt", so the user may think everything is fine. But as the real filename is "stringnumber.php.txt", it cannot be called via "localhost/stringnumber.php".

I do not know if this is really the problem here, but it is a known problem and it is worth investigating.
Nobbie
 
Posts: 13214
Joined: 09. March 2008 13:04

Re: Error 404

Postby The Coop » 24. November 2019 17:57

Altrea wrote:Are you sure your XAMPP Apache server is actually running and not a different one?

Because from your explanation is should work exactly that way.

What happens if you request just http://localhost/ ?
What is the contents of your Apache access.log?


Yes. I have the green light on all the services. when I request http://localhost/ I get the same error message.

As for the access.log, I am unsure about the contents as I didn't want to change anything and screw the entire thing up.
The Coop
 
Posts: 6
Joined: 22. November 2019 14:21
XAMPP version: 3.2.4
Operating System: Windows 10 home

Re: Error 404

Postby Altrea » 24. November 2019 18:02

The access.log contents is important for us to see if the requests are getting all the way to your Apache or not.

Did you change anything in the Configs like any ports or ServerName?
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11952
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: Error 404

Postby The Coop » 24. November 2019 18:06

Yes, but file names are not unique for PHP scripts, every file has a name and if you save a file, you have to assign a name. It's a bit of a fake dumb trick if you claim to be a "PHP novice". This is artificial and I don't like this artificial kind of "I'm such a poor newbie".


Are you always this negative or are you saving it all up just for me? There is nothing artificial about my request for help and I certainly didn't expect to get trolled by someone on this website.

Please, if you cant help me just move on. There are more important things to do than read your pitiful ramblings.
The Coop
 
Posts: 6
Joined: 22. November 2019 14:21
XAMPP version: 3.2.4
Operating System: Windows 10 home

Re: Error 404

Postby Nobbie » 24. November 2019 18:15

The Coop wrote:Are you always this negative or are you saving it all up just for me?


No, you can be reassured, of course, always, not just for yourself.

The Coop wrote:There are more important things to do than read your pitiful ramblings.


Simply skip them - did anybody force you to read my postings? Did you actually follow the advice about Notepad or are you busy crying that you have so much more important things to do?
Nobbie
 
Posts: 13214
Joined: 09. March 2008 13:04

Re: Error 404

Postby The Coop » 24. November 2019 21:51

Simply skip them - did anybody force you to read my postings?

You are under the assumption that we can foretell what your ramblings are going to be prior to reading them. Unfortunately I failed O-Level Precognition.

Did you actually follow the advice about Notepad or are you busy crying that you have so much more important things to do?

Your advice about Notepad was read, understood then ignored, as I had already said in my very first post, I used MS Expression 4.

I did however, read your profile. Its as blank as your charisma. Now, if you don't really have any way of helping me then perhaps you can move to one side and let other people through.
The Coop
 
Posts: 6
Joined: 22. November 2019 14:21
XAMPP version: 3.2.4
Operating System: Windows 10 home

Re: Error 404

Postby Altrea » 24. November 2019 22:36

This thread is going to a very wrong direction here.

Nobbie is correct with his suggestion about hidden file extensions for the following hints:
- You said you have tested with three different webserver stacks and all of them are showing this behavior. This makes a xampp based issue very unlikely.
- the majority of the issues at this forum here with not found webserver ressources are based on user actions, like typos, wrong editor, hidden file extensions, etc.

It is valid to push you in this direction, because it is the most common one.

I see only these possible reasons for your problem here (ordered, started with the less common one up to the most common ones):
- a operating stack issue related to your loopback adapter (reset your ip stack and winsock)
- a browser configuration issue like auto proxy configuration, browser plugins (commonly in commercial environment)
- a different name resolution issue related to localhost (like DNS, HOSTS file, etc)
- a user based Apache config issue by changing any of the configs
- a user based error report information issue like telling us something wrong or hiding some information
- a basic user action issue like using the wrong editor, typo in filename or url, etc.

Because i have not enough information to narrow this problem down (and because i don't like the direction of this thread here), i will stop investing any more time here.

You are asking for help here. You should be polite and answer our questions to trying to help you identifying the issue. Not the other way round.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11952
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: Error 404

Postby The Coop » 25. November 2019 09:25

Oh, what a pity, unfortunately you didnt tell us, which NAME you choose for saving it to xampp/htdocs folder?! Could you tell us now? Actual that is MOST IMPORTANT and i really wonder, why you left out that crucial information?!

The Coop wrote:
I typed "localhost/stringnumber.php" into my Chrome browser address bar

Aha. And why did you so? Why not "localhost/lirumlarum.php" or for example "localhost/blubblubb.php"? Or any other senseless string?

I did so because that was the name I saved the file under.

Yes, but file names are not unique for PHP scripts, every file has a name and if you save a file, you have to assign a name. It's a bit of a fake dumb trick if you claim to be a "PHP novice". This is artificial and I don't like this artificial kind of "I'm such a poor newbie".

Very helpful. I would not have asked for help if i didn't need it but after a week of trying several WAMP's I finally bit the bullet.

Anyway, if you used Notepad to edit/write your PHP script, it may happen that Notepad appends ".txt" to your file, which results in "stringnumber.php.txt".

I had already said in my first post that I was using MS Expression 4.

Perhaps its me. Perhaps I was expecting too much. Perhaps I am on the wrong forum.
Perhaps if Nobbie just stuck to the facts and not made sarcastic remarks, no one would have written bad things.

Thanks for your genuine response but for me, Nobbie is a bit of a nob.

Goodbye.
The Coop
 
Posts: 6
Joined: 22. November 2019 14:21
XAMPP version: 3.2.4
Operating System: Windows 10 home

Re: Error 404

Postby Nobbie » 25. November 2019 12:01

The Coop wrote:I did so because that was the name I saved the file under.


No, you did not. You may BELIEVE you did so, but Error 404 tells you, there is no such file. Maybe you put xampp "somewhere" so that Apache does not have sufficient rights to read it - you did not tell us, where you installed Xampp. Maybe on a NAS without sufficient rights for Apache. Maybe your editor appends an additional .html to your file, maybe your editor puts the file somewhere else. Stop being a childish newbie and start thinking! Crying like a baby does not solve your problem.
Nobbie
 
Posts: 13214
Joined: 09. March 2008 13:04


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 142 guests