PHP Script — PHP scripting language source file.
Quick facts
What is .php
A .php file is a PHP Script — PHP scripting language source file.
In the mime-db registry it maps to application/x-httpd-php, and it is marked as compressible. When serving .php over HTTP, set the Content-Type header as shown in Developer info below.
Related entities: it maps to application/x-httpd-php and is used by Hack, PHP among others — and is delivered over HTTP via the Content-Type header.
How to open .php files
Developer info
When served over HTTP, responses should set the following header:
Content-Type: application/x-httpd-php
Common software that reads/writes .php:
Relation chain
Related extensions
Related MIME types
Related programming languages
Common uses
How to edit .php files
How to create .php files
Frequently asked questions
Common options include VS Code, PhpStorm, PHP. You can also open many of these files with built-in viewers or a browser.
Create a new file in any text editor or the app that owns the format and save it with the .php extension.
application/x-httpd-php is the media type identifier used for .php files during network transfer (for example in the HTTP Content-Type header).
Sources & standards
Updated 2026-08-18
Explore this reference