How to open a .php file
Quick, free ways to open PHP on any system.
A .php file is a PHP Source File. If double-clicking does nothing, your computer simply does not have an app that reads PHP yet. Here is how to fix that on each operating system, using free software wherever possible.
Open a .php file step by step
- Confirm the file really is a .php. Drop it into the WhatFileType file identifier, which reads its signature without uploading anything.
- On Windows, open it with VS Code or PhpStorm.
- On Mac, use VS Code or PhpStorm.
- On Linux, try VS Code or vim.
- Still stuck? Search for a dedicated PHP viewer.
Best apps to open .php files
Windows
- VS Code
- PhpStorm
- any text editor
macOS
- VS Code
- PhpStorm
- any text editor
Linux
- VS Code
- vim
- any text editor
Web
- Runs on a PHP-enabled web server
!
Before you open it: Caution. PHP is server-side code. Do not run untrusted .php files on a live web server; read them first.
Frequently asked questions
Why can't I open my .php file?
Almost always because no installed app understands PHP. Install one of the apps above, or convert the file to a format your existing software already reads.
How do I run a .php file?
Place it under a PHP-enabled web server, or run php file.php from a terminal with PHP installed for command-line scripts.
Why does my .php file show as text in the browser?
The server is not processing PHP. Opening the file directly, or a misconfigured server, sends the raw source instead of running it.