Why does my browser download the website’s PHP files instead of displaying the pages?

Why does my browser download the website’s PHP files instead of displaying the pages?

If your browser downloads a PHP file, the server may be delivering source code instead of executing it. Treat this as a potential security incident: temporarily restrict public access using a method that does not depend on PHP, and notify your server administrator or hosting provider.

Check whether the issue started after a PHP version change, a server configuration change or the deployment of new rules. The administrator should check how PHP files are assigned to a handler and whether the PHP service is working. Avoid applying configuration changes copied from elsewhere without checking them.

If files containing passwords or keys could have been downloaded, replace the affected credentials and review available logs. Restore public access after the issue has been fixed and tested.

RELATED QUESTIONS

Here are a few more questions whose answers may interest you. We answer important, practical questions for our customers.

SUBSCRIBE TO OUR NEWSLETTER

Join our newsletter. We only use it to share important information.

Newsletter subscription illustration