4 Replies - 1401 Views - Last Post: 21 October 2011 - 05:55 PM

#1 soniya_php  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 28-August 11

php files are showing as php.txt

Posted 28 August 2011 - 09:49 PM

i hve started learning php but when i run php code it displays the script instead of interpreting it.my servers are installed properly and i have saved file in .php extension but in browser it shows as .php.txt file how should i get it correct?
Is This A Good Question/Topic? 0
  • +

Replies To: php files are showing as php.txt

#2 EnvXOwner  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 357
  • View blog
  • Posts: 2,319
  • Joined: 10-August 09

Re: php files are showing as php.txt

Posted 28 August 2011 - 10:28 PM

That's more than likely happening because of the text editor your using and the way you're saving.. I'm not sure this is accurate, but I'm assuming you're using notepad. You may need to select "All File Types" or something when saving. I use notepad++ when coding. I also use Aptana 3 for a lot of projects.
Was This Post Helpful? 1
  • +
  • -

#3 no2pencil  Icon User is offline

  • Head MFIC
  • member icon

Reputation: 5069
  • View blog
  • Posts: 26,456
  • Joined: 10-May 07

Re: php files are showing as php.txt

Posted 28 August 2011 - 10:33 PM

View Postsoniya_php, on 29 August 2011 - 12:49 AM, said:

my servers are installed properly and i have saved file in .php extension

I doubt it. This is what happens when your web server is not listening for php file extensions.

If your files are getting a .txt extension added to them, then as EnvXOwner suggested it is likely from how you are saving the file. If you are using notepad for example, it could auto save with .txt, correct the file name before you upload it.

** moved to web servers & hosting **

Question has nothing to do with the php language.
Was This Post Helpful? 2
  • +
  • -

#4 supercorey  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 119
  • View blog
  • Posts: 207
  • Joined: 15-February 09

Re: php files are showing as php.txt

Posted 05 September 2011 - 02:30 PM

Most likely what is going on here, like everyone had said, is that whatever software you are using is appending a '.txt' extension to the file. If you are using Windows, which I'm assuming you are, you can go under folder options and set it to show all file extensions. That is most likely your problem.
Was This Post Helpful? 0
  • +
  • -

#5 JacksonD  Icon User is offline

  • D.I.C Head

Reputation: 9
  • View blog
  • Posts: 215
  • Joined: 18-October 11

Re: php files are showing as php.txt

Posted 21 October 2011 - 05:54 PM

Your text editor has .txt automatically enabled when it comes to saving. If possible, click Save As > All Files> Make sure file path is .php.

That should work, works on wordpad and notepad. If your a windows user, works with Tomboy notes for Ubuntu and a lot of others work.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1