How can you open PHP files?

PHP file in Coda

Question: I received a file with the extension .php for a free script. Now I wonder how I can open the file. Is there a special program for?

Answer: In principle, any text editor is suitable for opening PHP files with the extension .php. The endings .php3 and .php4 were also used in the past. However, these have been abolished in favor of the uniform .php ending. If you open the PHP file in a text editor, you can look at the programming code of the file. So you can see the PHP commands.

In practice, these files are uploaded to a web server and the PHP code is then executed there when the file is called. That means, in the text editor you can see these lines, for example:


But the output on the web server would then only be:

Hello world!

On a Windows PC, it is best to use editors such as Notepad ++, Eclipse PDT, Scriptly or Textpad to open the PHP files. On the Mac under OS X, for example, TextEdit (included with the system for free), BBEdit, Dreamweaver or Coda 2 can be used.

PHP file in Coda

This is what the little PHP script looks like when you open it in the Mac Editor Coda.

If you want to tinker with the scripts, you have to run a web server with a PHP interpreter. There are ready-made solutions for this, such as WampServer (Windows PC) or mamp (Mac OS X).

I hope that I could help you with how and what to do with PHP files. :)


Did you like the article and did the instructions on the blog help you? Then I would be happy if you the blog via a Steady Membership or at Patreon would support.

Leave a Comment

Your e-mail address will not be published.