Apache2 and mod_php

It seems that when a server is on FCGID on centos. it doesnt remove the mod_php php_admin_value directives, causing a configuration check to fail.

I used the transfer server feature between a ubuntu box and a centos box. I disabled the web feature on the server and also switch from fcgid to mod_php and back. It doesn't seem to remove the statements.

Thanks.

Status: 
Active

Comments

Does the system on which the config check is failing have mod_php disabled in Apache?

If it does, its a stock setting as I did not change the modules.

Also why are the apache2 module selection not available on centos?

A stock install should support mod_php by default ... what config check error message are you getting?

service httpd start

the php_admin_value stay even if fcgid is used.

That's actually normal for those directives to remain -- that's normally only a problem if mod_php is removed entirely from Apache.

Was mod_php removed in this particular case?

It was never removed or added. It was a stock CentOS install and the module settings werent changed.

Hmm, what is the output of these two commands:

rpm -qa | grep php-5
cat /etc/httpd/conf.d/php.conf

Ah, you don't appear to have a stock/default CentOS installation there.

I suspect the third party PHP version that's installed is causing the issue you're seeing, as that doesn't occur normally.

If you don't need mod_php, what you could do is comment out the contents of that php.conf file, as well as comment out the existing "php_admin_value" values in the Apache config, then restart Apache.

Once you do that, Virtualmin will stop adding additional php_admin_value lines.

Actually it happened before I switched php versions. I am using the centos 6 x64 template from openvz.org, so you may should test it yourself.

Just to update, I created a new openvz box recently.

  • ran yum upgrade
  • installed and setup virtualmin
  • edited /etc/sysconfig/httpd and uncommented HTTPD, then set it to /usr/sbin/httpd.worker.
  • restarted httpd and got the same issue again when the panel is showing defaulting to FCGID.

Stopping httpd: [ OK ]
Starting httpd: Syntax error on line 1045 of /etc/httpd/conf/httpd.conf:
Invalid command 'php_admin_value', perhaps misspelled or defined by a module not included in the server configuration

This is a stock issue on CENTOS/RHEL 6 that needs fixing.

It seems I also had to run

mv /etc/httpd/conf.d/php.conf /etc/httpd/conf.d/php.conf.disabled

to force mod_php to disable as it was overriding fcgid?

I think this needs to be looked at further.

Regarding mod_php overriding other PHP execution modes -- are you by chance using a third party PHP version at the moment?

Unfortunately, the issue you're seeing there is a known issue when using PHP from a third party repository. Third party PHP versions can setup a config that causes mod_php to override other PHP Execution Modes.

We actually have some documentation about there here in the section titled "Why does PHP / ProFTPd no longer work after performing updates? (I'm using CentOS, and enabled third party repositories)":

https://www.virtualmin.com/documentation/system/faq

As far as the issue you mentioned above, when commenting out the prefork mode -- mod_php can't load when using the Apache prefork mode, as Apache doesn't support mod_php in worker mode.

When switching to Apache's worker mode, you would need to comment out the various "php_admin_value" options.

I'd be curious what the output of this command on your server is:

rpm -qa | grep php

No I am not. I use stock rpm's.

And if your not on prefork mode, virtualmin should check that and not use mod_php statements. Heck virtualmin should allow you to change execution modes..

this has happened again. on CentOS 7.

I found /etc/httpd/conf.modules.d/10-php.conf has

< IfModule prefork.c >
  LoadModule php5_module modules/libphp5.so
< /IfModule >

I have the event mpm running.