Disable mod_php option not removing php_* lines from httpd.conf

SYSTEM INFORMATION
OS type and version CentOS 7.9
Webmin version 1.991
Virtualmin version 7.0
Related packages Apache 2.4.6

I’ve just tried out the new feature to remove mod_php after being prompted on the dashboard when logging in to Virtualmin 7.0 (Great feature/idea btw).

The output of the script is as follows:

Disabling
Apache mod_php
Removing LoadModule line ..
.. done
Removing php_value directives from virtual servers ..
.. updated 5 servers
Removing global php_value directives ..
.. done
Applying web server configuration ..
.. done

All seems OK and the websites continue working, however after the next restart Apache it fails to start with the following:

May 03 10:43:51 <HOSTNAME> systemd[1]: Reloading The Apache HTTP Server.
May 03 10:43:52 <HOSTNAME> httpd[9110]: AH00526: Syntax error on line 395 of /etc/httpd/conf/httpd.conf:
May 03 10:43:52 <HOSTNAME> httpd[9110]: Invalid command 'php_admin_value', perhaps misspelled or defined by a module not included in the server configuration
May 03 10:43:52 <HOSTNAME> systemd[1]: httpd.service: control process exited, code=exited status=1
May 03 10:43:52 <HOSTNAME> systemd[1]: Reload failed for The Apache HTTP Server.

Upon checking httpd.conf there is indeed still a number of lines such as:

php_admin_value engine Off
php_value memory_limit 32M

For various virtual hosts.

It appears that when the mod_php removal script says it is removing php_value settings, it does not actually do it.

I have tried this on three servers so far, all the same issue.

Manually removing php_* lines form httpd.conf resolves the issue.

1 Like

Hi,

Thanks for heads up.

It looks we had a bug in the code —

Please apply this patch and see if that works for you.

2 Likes

I did the manual edit in the httpd.conf by commenting the lines by using the recheck-config to find problem lines, I guess this ok once patch roles out? (I mean no need to uncomment)

Steve

This is not all. There is one more patch to address this issue —

1 Like

Hi, I got caught by the bug too.

How do we make use of the patch?

Thanks,
Brian

You shouldn’t apply this patch manually. You should fix Apache config and remove all php_* directives instead.

1 Like

Thanks, issue resolved.

Brian

SYSTEM INFORMATION
OS type and version Ubuntu Linux 18.04.6
Webmin version 1.991
Usermin version 1.840
Virtualmin version 7.0-4
Theme version 19.91.2
Package updates 3 package updates are available

I’m relatively new to server management, I did not understand how to apply this patch. (/etc/apache2/sites-available/*.conf on Ubuntu/Debian), do I have to edit each file in the folder or how do I go about this. Thanks.

If you already clicked the button to Disable mod_php on the Dashboard, then there is no reason to apply the patch.

You need to go through Apache configs and remove all php_* directives by editing configs manually.

When this is done, try starting Apache manually by running:

systemctl start apache2

If that fails, check on status, which will show what is wrong and which config line exactly needs attention:

systemctl status apache2

Thanks, Lila, please could you explain this to me

You’re welcome.

Yes, you can use Servers ⇾ Apache Webserver: Edit Config Files page to filter and remove all mod_php related directives (all those that start with php_):

@llia thanks it works!

1 Like