Apache: [core:alert] /var/www/html/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
A .htaccess file uses a directive the server can't handle, causing 500 errors for the whole directory.
.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration[core:alert] .htaccess: Invalid command.htaccess: Invalid command 'RewriteEngine'.htaccess: Invalid command 'ExpiresActive'500 Internal Server Error .htaccess Invalid command Meaning
Common: php_value/php_flag under PHP-FPM/CGI (use .user.ini instead), RewriteEngine without mod_rewrite, Header without mod_headers, or Require syntax from Apache 2.2 vs 2.4. Enable the module, wrap in <IfModule>, or remove incompatible directives. Check the Apache error log for the exact line.
Common causes
php_valuewith PHP-FPM/FastCGI- mod_rewrite/mod_headers/mod_expires not enabled
- Apache 2.2
Order allow,denyon 2.4 AllowOverride Noneignoring or blocking directives- Typos
⚡ Quick fix
sudo a2enmod rewrite headers expiresand restart- Replace
php_valuewith.user.inifor FPM - Wrap optional directives in
<IfModule mod_headers.c>
Detailed fix by platform
Linux
sudo tail -20 /var/log/apache2/error.log
How to diagnose
- Directive — Named in error log?
- Module — Enabled?
- PHP — mod_php or FPM?
🔧 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
- 499 Client Closed Request / client prematurely closed connection Nginx: [info] client prematurely closed connection while reading response header from upstream / access log status 499
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