Question:

My php files aren't saving in php format

by  |  earlier

0 LIKES UnLike

When I try to save php files they wont save in php format. How do I fix this? Right now they save in the default format of the program I'm using (such as saving test.php in notepad, saves as test.php, but in text format).

 Tags:

   Report

4 ANSWERS


  1. You could go set windows to show known file extensions under Folder Options (Control Panel (Classic View) -> Folder Options).  

    Then when you view the file in Explorer, it should show the file name and extension.

    If you see "Test.php.txt" then just erase the .txt

    If you see "Test.php" then things are working just fine.

    Remember, to create/test php files, you need to have php and a hosting service installed.  search for WAMP to get yourself started.

    Unless you have hosting service and php installed on your computer, your php files will just be text files.  the .php files also have to be in the directory pointed to by the host.  (WAMP default I believe to be C:\WAMP\WWW).


  2. When using notepad:

    a) either type in "test.php" (INCLUDING the double quotes)

    or

    b) Select "All files" in "save as type" drop down then type in test.php

  3. They're in the right format, they just don't have the right extension.  According to the morons at Micros**t, only a .txt file is a valid text file.  As for fixing the problem, you don't have to copy and delete.  All you have to do is rename, which you can do from either DOS or Windows.

    The best thing to do is get cygwin and use vi, which doesn't make asinine assumptions about filenames.

  4. First, open up an explorer menu (folder or something) then click Tools > Folder Options > View Tab, then uncheck the "Hide known extension types" box. Then go back into the folder where you have the files and try renaming them (it will probably show up as test.php.txt, it needs to be just test.php). if that doesn't work then...

    Open up your command prompt (Start > Run > Type "cmd" without the quotes). Navigate to the directory where the files are stored and use the following command (change it to fit your filenames obviously):

    copy test.php.txt test.php

    This will make a copy of the file named test.php. Delete the original, open the test.php file, and go from there.

Question Stats

Latest activity: earlier.
This question has 4 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.