Page 1 of 1

myfirstfile.php

PostPosted: 04. September 2014 05:13
by Artorius
Hello everyone. I'm am trying to learn php and after downloading the xampp I started a tutorial on youtube (Beginner PHP Tutorial) https://www.youtube.com/watch?v=iCUV3iv9xOs&list=PL1E54E155E0A2E86F
I am on lesson 4 of 200 and I've hit a wall. Lesson 4 takes you into the HTDOCS folder and tells you to create a file calling it "myfirstfile.php"....well I've done this however when I run the command http://localhost/myfirstfile.php i receive the following error:

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.10 (Win32) OpenSSL/1.0.1i PHP/5.5.15


I've checked to make sure xampp was running...and it is
I've can put localhost/xampp in the command line and it goes to the display window.
But when I run "localhost/myfirstfile.php" the error appears. ????

So I must be overlooking something.

Any ideas?
Thank you for any assistance you are able to provide.

Artorius (the newbie)

Re: myfirstfile.php

PostPosted: 04. September 2014 11:55
by Nobbie
Artorius wrote:Lesson 4 takes you into the HTDOCS folder and tells you to create a file calling it "myfirstfile.php"


a) What is the full pathname of your HTDOCS folder (i.e. full pathname of myfirstfile.php)? It must be the folder created by Xampp (i.e. c:/xampp/htdocs or c:/xampp/htdocs/myfirstfile.php).

b) how did you create myfirstfile.php? If you used Notepad for example, there is an ugly behaviour in Notepad that it defaults to *.txt files, so if you save a file like "myfirstfile.php", Notepad instead saves it as "myfirstfile.php.txt".

And, to make things even more worse, Explorer supresses the file extension for known extensions (like *.txt), so if you look up the file in explorer, it appears as "myfirstfile.php", but the file type says "Text file" (or similar - and that is the clue that something goes wrong). If that is the case, change explorer options NOT to suppress extensions for known files types, after then you should be able to see the full file name and after you might rename it (by removing the trailing .txt). This generally issues a warning, that you are going to change the file type by renaming, but thats exactly what you want.