Fix: Apache Serving PHP Files as Downloads
Apache server is configured to serve files with specific extensions as certain content types. One common issue faced by users is when PHP files are downloaded instead of being displayed by Apache. This occurs when the Apache configuration lacks the necessary directives to recognize and process PHP files.
To resolve this problem, ensure the following directives are present in your httpd.conf and php.conf files:
# Load PHP module LoadModule php5_module modules/libphp5.so # Add handlers for PHP files AddHandler application/x-httpd-php .php # Specify content type for PHP files AddType application/x-httpd-php .php
Additional Troubleshooting Tips:
The above is the detailed content of Why is Apache Serving My PHP Files as Downloads Instead of Executing Them?. For more information, please follow other related articles on the PHP Chinese website!