12

After updating my vps, I get the follow error:

Failed to start apache : 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]

Enable modules on PHP:

[PHP Modules] bz2 calendar Core ctype curl date dom ereg exif fileinfo filter ftp gd gettext gmp hash iconv imap intl ionCube Loader json libxml mbstring mcrypt mhash mysql mysqli openssl pcntl pcre PDO pdo_mysql pdo_sqlite Phar readline Reflection session shmop SimpleXML sockets SPL sqlite3 standard suhosin tokenizer wddx xml xmlreader xmlrpc xmlwriter xsl zip zlib [Zend Modules] the ionCube PHP Loader

Line relative to error:

php_value session.save_handler "files"

What does the error mean and how can I fix it?

12

I recently ran into this exact problem using Plesk 9.5 on CentOS.

I cannot say for sure whether it was caused by an update to Plesk, or not. The customer doesn't think any changes were made recently, but Apache failed to start with this error.

After an assesment of the system to ensure it wasn't due to a breach, I did some troubleshooting and determined that mod_php had been removed from the Apache config. After checking Plesk settings, every vhost on the box was using FastCGI and SuExec.

When using FastCGI and SuExec, you cannot change PHP directives in php.conf (FastCGI) and .htaccess (SuExec).

The customer had originally commented out the offending lines, but this broke session support for everything. The only way I was able to resolve it was to manually add mod_php back to httpd.conf.

Add the following line to the section with the other LoadModule's. Make sure the path (../modules/) matches the rest of the modules in there. Chances are good that it already exists on your system and was simply removed from the config during the update.

bash# vi /etc/httpd/conf/httpd.conf
LoadModule php5_module ../modules/libphp5.so

bash# apachectl restart

This caught me off guard, and I cannot say for sure it is the upgrade that caused the issue or whether this is the best fix. I am open for comment, but highly advise against commenting out the php directives in /etc/httpd/conf.d/php.conf as it will break stuff.

  • thanks David, saved the day. My yum log shows an auto update to php 5.3.26 but don't really understand why httpd.conf was over written. Regards – user177890 Jun 14 '13 at 19:04
  • Thank you! I went to httpd.conf and I saw that the line LoadModule php5_module pathfilename had been commented out,I just removed the # and everything is back to normal. – Nickool Jan 15 '16 at 23:10
  • I obtained this error after an upgrade from Ubuntu 16.04 to 18.04.1. I don't know the cause and there is no modules directory, instead a mods-available and mods-enabled directory. I added symlinks for php7.2.conf and php7.2.load to mods-enabled pointing to mods-available and then apache2 was able to start. – Chris Jenks Aug 20 '18 at 15:18
5

Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration

The Apache httpd-2.4 can failed with above error if you by mistake configured it to use other mpm module than prefork (as only prefork mpm works fine with php on Linux (CentOs7/RHEL7). Correcting Apache httpd configuration to use prefork mpm will solve the issue.

  1. /etc/httpd/conf.modules.d/10-php.conf

    LoadModule php5_module modules/libphp5.so

  2. /etc/httpd/conf.modules.d/00-mpm.conf

    LoadModule mpm_prefork_module modules/mod_mpm_prefork.so

1

This could happen if you configured Apache to use other MPM than mod_prefork. Check what module is in use by httpd -V command. It should show you something like:

...
Server MPM: prefork
...

If it's not, check

/etc/httpd/conf.modules.d/00-mpm.conf

like described here and make sure the next line is present in it and uncommented:

LoadModule mpm_prefork_module modules/mod_mpm_prefork.so

In case you need to use other module than mod_prefork you will have to comment or delete these lines.

1

As commented by David previously, this is likely because the PHP mod has been disabled from Apache2.

To me, it appeared as an error when (re)starting Apache:

Job for apache2.service failed because the control process exited with error code. See "systemctl status apache2.service" and "journalctl -xe" for details.

Then, inside journalctl -xe:

AH00526: Syntax error on line 31 of /etc/apache2/sites-enabled/host.conf Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration

This happened when upgrading from Ubuntu 17.10 to 18.04 (and in consequence from PHP7.1 to 7.2), which apparently disabled libapache2-mod-php* completely.

On Ubuntu, the following should fix it:

sudo a2enmod php7.2
sudo systemctl restart apache2
0

Just comment those lines out.

I had

#php_value session.save_handler "files"
#php_value session.save_path    "/var/lib/php/session"

Then run the "reconfigure if your in Plesk, then restart apache" seemed to work fine. Had this happen after plesk update #53 10mins ago.

  • Hi, I'am not using Plesk, using Zpanel. What I need reconfigure? Thanks – David E. Jun 13 '13 at 0:21
  • I basically removed those lines and then an apache restart may fix it. But i had to re-configure the vhost in plesk. It is just a button, not sure the equivalent in cpanel. – Jimmy Jun 13 '13 at 1:03
  • This is a bit disturbing. This is part of the core php - you need to jump through hoops at compile time to disable session support. And according to the manual, they are both changeable in PHP_INI_ALL (but it might be worth trying php_admin_value). Does your session handler work? Are you using mod_php? – symcbean Jun 13 '13 at 9:36
  • 1
    Just had this happen. Commenting out the offending lines will allow Apache to start, but removes session support among other things. Chances are mod_php was disabled. I am using Plesk also. – David Houde Jun 14 '13 at 5:51
0

Before running the upgrade from Atomic make a backup of file php.conf. Then after the upgrade completes overwrite the new file with the old one.

0

I had the similar problem, realized that php5 module was commented, which means could not load and in phpmyadmin conf it was giving me errors because of having php_admin_value which probably was working with php5_module and it was not in place. I went to httpd.conf and uncommented:

LoadModule php5_module "c:/wamp/bin/php/php5.5.12/php5apache2_4.dll"
0

Edit: After implementing my comments below, I found that there was another reason I was running into this issue. The server has PHP-FPM implemented. Part of the implementation of PHP-FPM meant that /etc/httpd/conf.d/php.conf was disabled (i.e. renamed to php.conf.bak). The recent update brought in a new php.conf. As a result the PHP-FPM configuration was conflicting and causing the errors mentioned. The fix was to simply rename php.conf to something like php.conf.bak.feb2019. As a result, php.conf does not get loaded and therefore there is no conflict with php-fpm.

/// Before edit: /////

The solution for me was a combination of the answers provided here.

I noticed this error after updating an Oracle Linux 7 server that hand't been updated in a long

As suggested by @dasharathmasirkar, @davidhoude @alexlanger, the problem stems from mpm prefork config being overridden after the update.

To address this:

check /etc/httpd/conf.modules.d/00-mpm.conf and ensure that the following line is uncommented:

# prefork MPM: Implements a non-threaded, pre-forking web server
# See: http://httpd.apache.org/docs/2.4/mod/prefork.html
LoadModule mpm_prefork_module modules/mod_mpm_prefork.so

Also, make sure that the other worker mpm is commented-out so it does not conflict:

# worker MPM: Multi-Processing Module implementing a hybrid
# multi-threaded multi-process web server
# See: http://httpd.apache.org/docs/2.4/mod/worker.html
# LoadModule mpm_worker_module modules/mod_mpm_worker.so

Then restart apache: apachectl restart

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.