PHP File Extension  What is .Php and how to open them? ▷ 2020

Programming is the foundation 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 the most 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 that contain source code written in PHP carry the extension with the same acronym. These can 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 .PHP files and what are they used for?

files with .PHP extension

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

This file was created by Rasmus Lerdorf in 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 have code that is used to run certain processes found online.

The PHP engine of a web server decrypts the PHP character included in the pattern and agilely create the HTML code from him. This character can be used by the person who uses 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 within it, it is nothing more than a simple set of text, so any basic processor like Windows “Blog Notes” can easily read it.

Here we show you how to open these files on 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 these types of files. Therefore, in for this task we are going to use the tool “Notes blog”, which is already factory installed on computers with Microsoft’s operating system.

  • What you should do is locate the file PHP you want to visualize, and once you have done this, 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 mark the option “Select a program from the list of installed programs”.
  • Once the program explorer opens, click on “Notes blog”.

Open-DLL-in-Windows-with-blog-notes-

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, it is necessary to have advanced knowledge of programming with this language.

On Mac computers

You must download and install BBEdit., which is a free program that lets you observe 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 of the magnifying glass that is in the upper left part of the screen, to do this you must write “BBEDIT” and double click, for which a drop-down menu will appear.

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

Now that you are in the program, you must click on “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

Subsequently, you must go to the location where the PHP file is saved to click and choose it. Finally click and when you do this the PHP file opens in BBEdit and with this you can see the text that is contained in it.

On linux

To open a file in Linux you must download the VI application, although you can also use the free version VI-M 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 just have to carry out the following steps:

  • Enter the name of the file. For a file called php.txt, you would put php.txt.
  • When it is opened, press the key on the keyboard “insert” with the intention of entering the edit mode.
  • Also the key “Esc” helps you get out of edit mode, but not VI editor.

It should be noted that the VI interface is not like that of 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 handle the tool.

How to run a .Php file?

We already teach you to open it but How can these files be run? You may at some point have 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 should do is simply install the program and follow the steps below:

  • Start the program. This will be loaded into the icon tray. Click on the XAMP icon to expand the control panel.
  • To continue click on the button “Start” next to “Apache” so you can start the Apache web server. When this is running you will see that next to it appears the word “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 put the PHP files you want to run in the folder “htdocs”, this is inside “XAMMP” on drive C. 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 for a PHP file and open it to run a script.

From 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 starting you must configure your Windows operating system to run PHP files. For 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 “C: wamp bin php php5.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”.

Configure Windows system variables

  • Once here you must select the variable “PATH” and you give it 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 have everything done to run PHP from the terminal, which is a little easier than the previous one. What you should do is simply the following:

  • Press the keys “Ctrl + R” so that the box opens “Run” in which you should write “CMD” to open the terminal.
  • Once the terminal is open, you must write the path in which the PHP file is saved to execute it.

List of the best alternative applications and 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 PHP extension without problems. Here are some of the best alternatives.

PHP Compiler

It is an instrument with which put together a PHP plan in an .exe file. Said file would be a window application program, which can be used without using any browser. Using it requires specific technical knowledge.

PHP MySQL

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 already created files to view their content.

If you have any questions, leave them in the comments, we will answer you as soon as possible, and it will surely be of great help to more members of the community. Thank you! 😉

You may be interested:

Rate this post

Leave a Comment