Tim Fisher has 30+ years' professional technology support experience. He writes troubleshooting content and is the General Manager of obatambeienwasirherbal.com.

Đang xem: What is a php file (what it is & how to open one), how to open a php file: 13 steps (with pictures)

A file with the .PHP file extension is a PHP Source Code file that contains Hypertext Preprocessor code. They are often used as web page files that usually generate HTML from a PHP engine running on a web server.

The HTML content that the PHP engine creates from the code is what”s seen in the web browser. Since the webserver is where the PHP code is executed, accessing a PHP page doesn”t give you access to the code but instead provides you the HTML content that the server generates.


Some PHP Source Code files might use a different file extension like .PHTML, PHP3, PHP4, PHP5, PHP7 or PHPS.

How to Open PHP Files

Notepad in Windows is one example of a PHP file opener, but syntax highlighting is so helpful when coding in PHP that a more dedicated PHP editor is usually preferred.

Some text editors include syntax highlighting; see our list of the best text editors for some options like Visual Studio Code. Here are some other ways to edit PHP files: Atom, Sublime Text, Coda, Codeanywhere, Programmer”s Notepad, Vim, and CodeLobster IDE.

However, while those programs will let you edit or change PHP files, they don”t let you actually run a PHP server. For that, you need something like Apache Web Server. See theInstallation and Configuration guide on PHP.net if you need help.

Some .PHP files might actually be media files or images that were accidentally named with the .PHP file extension. In those cases, just rename the file extension to the right one and then it should open correctly in the program that displays that file type, such as a video player if you”re working with an MP4 file.

See the documentation on json encodeonPHP.net to learn how to convert PHP arrays into Javascript code in the JSON format (JavaScript Object Notation). This is only available in PHP 5.2 and up.

Xem thêm:

You can”t convert PHP files to non-text-based formats like MP4 or JPG. If you have a file with the .PHP file extension that you know should have been downloaded in a format like one of those, just rename the file extension from .PHP to .MP4 (or whatever format it should be).

Renaming a file like this isn”t performing a real file conversion but instead just allowing the right program to open the file. Real conversions normally take place either within a file conversion tool or a program”s Save as or Export menu.

How to Make PHP Work With HTML

PHP code embedded in an HTML file is understood as PHP and not HTML when it”s enclosed in these tags instead of the common HTML tag:

To link to a PHP file from within an HTML file, enter the following code in the HTML file, where footer.php is the name of your own file:

You can sometimes see that a web page is using PHP by looking at its URL, such as when the default PHP file is called index.php. In this example, it might look like http://www.examplesite.com/index.php.

More Information on PHP

PHP has been ported to nearly every operating system and is completely free to use. The official PHP website is PHP.net. There”s a whole Documentation sectionthat serves as an online PHP manual if you need help learning more about what you can do with PHP or how it all works. Another good source is W3Schools.

The first version of PHP was released in 1995 and was called Personal Home Page Tools (PHP Tools). Changes were made throughout the years with new versions being released every few months.

Server-side scripting is the most common use for PHP. As described above, this works with a PHP parser, web server and web browser, where the browser accesses a server running the PHP software so that the browser can display whatever it is that the server is producing.

Another is command-line scripting where neither a browser or server is used. These types of PHP implementations are useful for automated tasks.

Xem thêm:

PHPS files are syntax-highlighted files. Some PHP servers are configured to automatically highlight the syntax of files that use this file extension. This must be enabled by using the httpd.conf line.

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *