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

Tim Fisher has 30+ years' professional công nghệ tư vấn experience. He writes troubleshooting content and is the General Manager of obatambeienwasirherbal.com.

Bạn đ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 tệp tin with the .PHP tệp tin 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 PHPhường. engine running on a website hệ thống.

The HTML nội dung that the PHP engine creates from the code is what"s seen in the website browser. Since the webserver is where the PHP code is executed, accessing a PHPhường page doesn"t give you access to the code but instead provides you the HTML nội dung that the server generates.


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

How lớn xuất hiện PHPhường Files

Notepad in Windows is one example of a PHP tệp tin 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 danh sách of the best text editors for some options lượt thích Visual Studio Code. Here are some other ways to lớn edit PHP files: Atom, Sublime Text, Codomain authority, Codeanywhere, Programmer"s Notepad, Vyên ổn, và CodeLobster IDE.

However, while those programs will let you edit or change PHP files, they don"t let you actually run a PHP hệ thống. For that, you need something lượt thích Apache Web Server. See theInstallation & 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 .PHPhường tệp tin extension. In those cases, just rename the tệp tin extension khổng lồ the right one & then it should open correctly in the program that displays that file type, such as a đoạn Clip player if you"re working with an MP4 file.

See the documentation on json encodeonPHP.net to lớn learn how to convert PHPhường arrays inlớn Javascript code in the JSON format (JavaScript Object Notation). This is only available in PHP.. 5.2 and up.

Xem thêm: Phishing Email Là Gì ? Cách Ngăn Chặn Phishing Email Mới

You can"t convert PHPhường files to lớn non-text-based formats lượt thích MP4 or JPG. If you have sầu a file with the .PHP file extension that you know should have sầu been downloaded in a format lượt thích one of those, just rename the file extension from .PHPhường to lớn .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 tệp tin conversion tool or a program"s Save sầu as or Export thực đơn.

How khổng lồ Make PHP.. Work With HTML

PHP.. code embedded in an HTML tệp tin is understood as PHP & not HTML when it"s enclosed in these tags instead of the common HTML tag:

To liên kết to a PHP file from within an HTML tệp tin, 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 PHPhường by looking at its URL, such as when the default PHPhường tệp tin is called index.php. In this example, it might look like http://www.examplesite.com/index.php.

More Information on PHP..

PHPhường has been ported khổng lồ nearly every operating system và is completely free to use. The official PHP.. website is PHPhường.net. There"s a whole Documentation sectionthat serves as an online PHP manual if you need help learning more about what you can vì chưng with PHP.. or how it all works. Another good source is W3Schools.

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

Server-side scripting is the most comtháng use for PHPhường. As described above, this works with a PHP parser, web VPS và web browser, where the browser accesses a hệ thống running the PHP.. software so that the browser can display whatever it is that the hệ thống 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.

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