Skip to content
Step by Step Internet 馃寪 Guides for learning to surf the Net

File extension .PHP What are they and how to open this type of file?

UPDATED ✅ Do you want to know which are the best programs and applications to open .PHP files on your computer and smartphone? ⭐ ENTER HERE ⭐ and discover how to do it ✅ EASY and FAST ✅

Programming is the basis of the digital world today. Since its appearance, we have been improving and developing new languages ​​that allow creating programs and websites that are more efficient.

It is precisely in the field of web development where more changes have occurred so far in the 21st century. PHP is a programming language used to create applications that can be run from a computer or mobile application.

Files containing source code written in PHP carry the extension with the same acronym. These may contain the coded structure of an application or part of it, being able to copy it to create another app based on the original.

What is it and what are files with the .PHP extension used for?

files with .PHP extension

Files with a .PHP extension are known as a feasible scripting language on the server. These are used in web development, as well as as a regular programming language.

This file was created by Rasmus Lerdorf in the year of 1995 and today it is installed on at least 240 million websites. They also symbolize web pages that have codes in the programming language. These files contain code that is used to run certain online processes.

The PHP engine of a web server decrypts the PHP character included in the pattern and quickly create HTML code from him. This character can be used by the person using the web page, which is why the pattern and the PHP file cannot be visible to the user.

How to open and edit .PHP files from any computer?

Although a PHP file acquires this extension due to the code contained inside it, this is nothing more than a simple set of text, so any basic processor like Windows “Notes Blog” can easily read it.

Here we show you how to open these files in the main operating systems:

from Windows

Opening a PHP file in Windows is an extremely simple task since any text editor can both view and edit this type of file. Therefore, for this task we are going to use the tool “Notes blog”which is already installed from the factory on computers with a Microsoft operating system.

  • All you have to do is locate the file PHP that you want to visualize, and once this is done, simply right click on it.
  • Among the options that will be displayed, select “To open with”, which will open a window in which you must check the option “Select a program from the list of installed programs”.
  • Once the program explorer opens, you must click on “Notes blog”.

Open-DLL-in-Windows-with-notebook-

Once you do all this, the program will start automatically and you will be able to see each and every one of the codes that make up the file. To understand what is inside it is necessary to have advanced knowledge of programming with this language.

On Mac computers

You should download and install BBEdit., which is a free program that lets you view and edit several different formats, including PHP. If you want to install it you must do the following:

Download BBEdit 12 for Mac

Now open Spotlight. For that you must go to the icon that of the magnifying glass that is in the upper left part of the screen, to do this you must write “BBEDIT” and double click, so a dropdown menu will appear.

If it is the first time that you open BBEdit after installing it, you must click on the button “Open” at the time you request it, and then give it in “Continue” so you can start a thirty-day trial.

Now that you are in the program, you must click on “File, Archive” in the menu bar at the top of the screen, and among the options that are displayed select “Open”.

Open PHP from BBEdit on MacOS

Afterwards, you must go to the location where the PHP file is saved to click and choose it. Finally click on it and by doing this the PHP file will be opened in BBEdit and with this you can observe the text that is contained in it.

on linux

To open a file on Linux you must download the VI application, although you can also use the free VI-M version that comes pre-installed. This is a text editor that helps you edit the large number of files you have.

To be able to open a PHP file in your Vi editor, you only have to perform the following steps:

  • Put the name of the file. For a file named php.txt, you would put php.txt.
  • When it opens, you must press the key on the keyboard. “insert” with the intention of entering edit mode.
  • Also the key “Esc” it helps you exit edit mode, but not the VI editor.

It should be noted that VI’s interface is not like other text editors. In this case you will have to have certain knowledge that will allow you to execute each of the commands necessary to manage the tool.

How to run a .php file?

We already taught you how to open it but How can these files be executed? At some point you may need to run one that contains a script that can help you troubleshoot a problem. Here we show you how to do it on different platforms.

in XAMPP

This is an application that helps you test various websites on your computer in case you need to load an online web server. With it you can easily execute a PHP file or several in one go. What you need to do is simply install the program and follow the steps below:

  • Start the program. This will load into the icon tray. Click on the XAMP icon to expand the control panel.
  • To continue click the button “Start” beside “Apache” so you can start the Apache web server. When it is running you will see that the word appears next to it “In action” highlighted in green. You will also need to run “mysql” in case your scripts require a database to work.
  • The next thing is to place the PHP files that you want to execute in the folder “htdocs”, this is inside “XAMMP” on drive C. The files must have the extension “.php”.
  • Now what you should do is open any of the browsers you use and enter “localhost”. A list of files stored in the folder will automatically open “htdocs” within “XAMP”. Click on the link of a PHP file and open it to run a script.

From the terminal or CMD

Running a file from the terminal requires a series of technical knowledge, but we will explain it to you in the best possible way to make it easier for you. Before you begin you must configure your Windows operating system to run PHP files. To do this you must have a root program that allows the execution of PHP as WAMP or MAMP.

Once you have it, what you should do is the following:

  • Go to the folder inside MAMP where the PHP file is saved and copy the path. This is usually usually “C:wampbinphpphp5.6.8”.
  • Now you must go to “Control Panel” and in the section “Security system”we choose “System” and then in “Advanced System Settings” and then in “Environment Variables”.

Set Windows system variables

  • Once here you must select the variable “PATH” and you give in “Edit”. In the second field of the variable you will get a route. To this path you must add a semicolon (;) at the end and then copy the path where the PHP file is, to finish by clicking on “To accept” for the changes to be saved.

After this you will be all set to run PHP from the terminal, which is a bit easier than the previous one. What you need to do is simply the following:

  • press the keys “Ctrl+R” for the box to open “Run” where you should write “CMD” to open the terminal.
  • Once the terminal is open, you must write the path where the PHP file is saved to execute it.

List of the best applications and alternative programs to open a document with a .Php extension without using NotePad++

In addition to NotePad++, there are other programs in which you can read documents with a PHP extension without problems. Here are some of the best alternatives.

PHP Compiler

It is an instrument with which gather a PHP plan into an .exe file. Said file would be a window application program, which can be used without the need to use any browser. Using it requires specific technical knowledge.

PHPMySQL

This is a program that can be used easily and through which you can create several PHP pages which manage the MySQL databases. In addition, it also allows you to open files that have already been created to view their content.

Computing