How to open .PHP files on Android

To open .PHP files on Android, .php files are typically edited and executed in a server environment; for reliable viewing/editing, transfer the file to a desktop OS and open it in a code editor like Visual Studio Code.

Step-by-step instructions

  1. .php files are typically edited and executed in a server environment; for reliable viewing/editing, transfer the file to a desktop OS and open it in a code editor like Visual Studio Code.

Common issues

Browser shows PHP source code instead of a web page

This usually means the server is not executing PHP for .php files and is serving them as plain text (a misconfiguration that can also leak secrets in the code).

  1. Verify the site is hosted on a server configured to execute PHP (for example using PHP-FPM) rather than a static file host.
  2. Check your web server configuration to ensure .php requests are handled by PHP (for Apache, confirm the PHP handler configuration).

Double-clicking a .php file doesn’t “run” it

.php is source code intended to be executed by a PHP runtime, typically through a web server request; opening it directly usually just shows the text in an editor.

  1. Open the file in a code editor (such as Visual Studio Code) to inspect or edit it.
  2. If you need to see its output, run it on a PHP-enabled web server (commonly with PHP-FPM) and view it through a browser.

Web server returns an unexpected content type for .php

Servers may label PHP-related responses with non-standard or configuration-dependent MIME types (commonly seen as application/x-httpd-php), which can confuse tooling or downloads.

  1. If you control the server, review how it maps .php to handlers and content types; ensure PHP is executed and the response is sent with an appropriate type for the generated output (often text/html for HTML pages).
  2. If you do not control the server, treat the .php file as source code and open it in an editor rather than relying on browser rendering.

Security note

.php files can contain executable server-side code. Never deploy a .php file from an untrusted source on a server, because it may execute actions with your server’s permissions.

Back to .PHP extension page