Browser shows <?php code or downloads index.php — mod_php / PHP-FPM handler not configured in Apache
Apache serves PHP files as plain text because no PHP handler is active.
Apache shows PHP source code instead of executingApache downloads php file instead of running<?php code displayed in browser ApacheApache PHP not working shows sourcephp file downloading Apache2 Meaning
Enable PHP: sudo a2enmod php8.3 (mod_php with prefork MPM) or configure PHP-FPM with proxy_fcgi (a2enmod proxy_fcgi setenvif && a2enconf php8.3-fpm). Restart Apache. With the event MPM, mod_php won't work — use FPM. Also check AddHandler/SetHandler and that the file extension is mapped.
Common causes
- PHP module/handler not enabled
- Event MPM with mod_php
- PHP-FPM conf not enabled
AddTypemissing- Vhost overriding handlers
⚡ Quick fix
sudo a2enmod proxy_fcgi setenvif && sudo a2enconf php8.3-fpm && sudo systemctl restart apache2- Or
a2dismod mpm_event && a2enmod mpm_prefork php8.3 - Verify with
php -vand aphpinfo()test
Detailed fix by platform
Linux
apachectl -M | grep -E "php|proxy_fcgi|mpm"
How to diagnose
- Handler — Enabled?
- MPM — Compatible?
- FPM — Running?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- AH00015: Unable to open logs Apache: AH00091: apache2: could not open error log file /var/log/apache2/error.log. AH00015: Unable to open logs (Permission denied)
- AH00037: Symbolic link not allowed or link target not accessible Apache: [core:error] AH00037: Symbolic link not allowed or link target not accessible: /var/www/html/current
- AH00072: make_sock: could not bind to address 0.0.0.0:80 Apache: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80 / AH00015: Unable to open logs
Most viewed in Nginx / Apache
- nginx: [emerg] unknown directive Nginx: nginx: [emerg] unknown directive "x" in /etc/nginx/sites-enabled/x:12 — configuration file test failed
- upstream timed out Nginx: upstream timed out (110: Connection timed out) while reading response header from upstream
- AH00898: Error reading from remote server (502 Proxy Error) Apache: [proxy_http:error] AH01102: error reading status line from remote server 127.0.0.1:3000 / AH00898: Error reading from remote server returned by /api
Other ways to find it
Where this error sits
Origin: Edge & web server. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 5 Nov 2026