Home >Backend Development >PHP Tutorial >Why is Nginx Downloading My .php Files Instead of Executing Them?
Nginx Servers .php Files as Downloads, Rather Than Executing Them
When configuring Nginx with PHP, it's essential to ensure that .php files are executed as scripts instead of being treated as downloads. Here's a detailed explanation of the issue and steps to resolve it:
The issue arises when Nginx does not properly recognize .php files as PHP scripts. This occurs due to an incorrect configuration in the Nginx site configuration file. To address this, follow the steps below:
These modifications ensure that Nginx correctly identifies .php files as PHP scripts and executes them accordingly, rather than downloading them as files.
The above is the detailed content of Why is Nginx Downloading My .php Files Instead of Executing Them?. For more information, please follow other related articles on the PHP Chinese website!