Skip to content
TheFilesGuy
en
Menu

Web & code · .php

What Is a PHP File?

A .php file is a server-side script for websites written in PHP.

Extension
.php
Full name
PHP script
Type
Web & code
MIME type
application/x-httpd-php

Free PHP Tools

These run in your browser. Your PHP files are never uploaded.

About PHP Files

PHP files contain code that a web server runs to build pages before sending them to the browser. WordPress, Wikipedia and many other sites are written in PHP. If you download a .php file instead of seeing a web page, the server sent you the script's output with the wrong name, often a PDF or document; renaming it may fix it. Otherwise open it in a text editor to read the code.

How to Open a PHP File

Any device
Open it in a text editor or VS Code to read the code.
Run it
Install PHP and run php file.php, or place it on a web server with PHP.

PHP File Questions

I downloaded a .php file instead of a PDF. What happened?

The website sent the document with the wrong file name. Check its real type with the File Info tool, then rename it to the right extension.

Can I open a PHP file in a browser?

Only through a web server with PHP installed. Opening the file directly shows the code or nothing.

See all file formats