Webserver down: "Invalid command 'php_value'"

Well this one took me by surprise I’ll say. It’s never fun when Zabbix lights up saying half of your websites have dropped out!

Starting httpd: Syntax error on line 31 of /etc/httpd/conf.d/php.conf:
Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration [FAILED]

Firstly DO NOT comment out the bottom two lines as some sites have recommended. The reason being this will allow your webserver to start up however PHP will not be processed, dumping all of your site’s code into the browser as plain text for anyone to see!

To summarise what happened I had done a yum update which bumped up php – apparently the Atomicorp (Atomic Rocket Turtle RPM Repository) repo I use had a bit of trouble with their packages, meaning the php.conf that ends up in /etc/httpd/conf.d/php.conf was a tad broken.

If you’re just in a bit of a panic rush like I was and would just like the quick fix, I had to add the following back to the very top of the file above everything else and then restarted httpd ( service httpd restart )

# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
<IfModule prefork.c>
LoadModule php5_module modules/libphp5.so
<IfModule worker.c>
LoadModule php5_module modules/libphp5-zts.so

Hoping this helps you quicker than it took me to find the fix! I’m not sure if the issue has been fixed at atomic, only a couple of my web servers were affected by this while they’re all at the same version of php.┬áLuckily it was just dev server for ICNerd that was affected by this issue.

A couple of other sites did flail off the internet into a broken php abyss though ­čÖü

Update: All of the sites using this repo were affected, they just hadn’t tried restarting or reloading httpd configs yet… that was fun


Side note. The featured image in this post is from openclipart: nuclear explosion by tzunghaor

Leave a Reply