Cannot change PHP version or Server API

I have spent a week searching and trying all sorts of solutions for my problem to no avail.

Here is the scenario:
PHP version 5.4 was installed.
Now installed PHP version 5.6.

System settings - recheck configuration shows:
The following PHP versions are available : 5.4.16 (/bin/php-cgi), 5.6.25 (/opt/rh/php56/root/usr/bin/php-cgi)

System settings - server templates - apache shows:
Apache mod_php and Default PHP version 5.6.25 (5.4 can also be selected on the dropdown)
NOTE: whatever I change here makes no difference - for eg. change to FCGId - still shows Server API : Apache 2.0 Handler (mod_php) even after server reboot.

php -v and phpinfo() shows PHP5.4.

However when I type in:
scl enable rh-php56 bash
Then php -v shows PHP5.6!
but phpinfo() on one domain and Woocommerce on another domain both show PHP5.4
Reboot server and php -v shows PHP5.4 again.

The template located at:
is empty.

I am running NGINX.

This is my Apache global configuration (/etc/httpd/conf/httpd.conf):

ServerRoot “/etc/httpd”
StartServers 2
MinSpareServers 6
MaxSpareServers 12
MaxClients 30
MaxRequestWorkers 256
MaxRequestsPerChild 3000
Listen :8080
Include conf.modules.d/
User apache
Group apache
ServerAdmin root@localhost

AllowOverride none
Require all denied

DocumentRoot “/var/www/html”
<Directory “/var/www”>
AllowOverride None
# Allow open access:
Require all granted

<Directory “/var/www/html”>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted

DirectoryIndex index.html

<Files “.ht*”>
Require all denied

ErrorLog “logs/error_log”
LogLevel warn

LogFormat “%h %l %u %t “%r” %>s %b “%{Referer}i” “%{User-Agent}i”” combined
LogFormat “%h %l %u %t “%r” %>s %b” common

LogFormat “%h %l %u %t “%r” %>s %b “%{Referer}i” “%{User-Agent}i” %I %O” combinedio

CustomLog “logs/access_log” combined

ScriptAlias /cgi-bin/ “/var/www/cgi-bin/”

<Directory “/var/www/cgi-bin”>
AllowOverride None
Options None
Require all granted

TypesConfig /etc/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml

AddDefaultCharset UTF-8

MIMEMagicFile conf/magic

EnableSendfile on
IncludeOptional conf.d/*.conf
SSLProtocol ALL -SSLv2 -SSLv3
ServerTokens Minimal
ServerSignature Off
TraceEnable Off

<VirtualHost [abcdef]:8080>
SuexecUserGroup “#509” “#503
DocumentRoot /home/lala/public_html
ErrorLog /var/log/virtualmin/lala.net_error_log
CustomLog /var/log/virtualmin/lala.net_access_log combined
ScriptAlias /cgi-bin/ /home/lala/cgi-bin/
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/lala/public_html>
Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch +ExecCGI
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
AddType application/x-httpd-php .php
AddType application/x-httpd-php5 .php5

<Directory /home/lala/cgi-bin>
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted

RewriteEngine on
RewriteCond %{HTTP_HOST}
RewriteRule ^(.) [R]
RewriteCond %{HTTP_HOST}
RewriteRule ^(.
) [R]
php_value memory_limit 32M
php_value suhosin.session.encrypt Off

Apache Log files show this on every reboot:
[Thu Jun 08 16:37:41.746759 2017] [core:notice] [pid 9267] AH00094: Command line: ‘/usr/sbin/httpd -D FOREGROUND’
[Thu Jun 08 20:00:30.678476 2017] [mpm_prefork:notice] [pid 9267] AH00170: caught SIGWINCH, shutting down gracefully
[Thu Jun 08 20:01:19.281138 2017] [suexec:notice] [pid 4057] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Thu Jun 08 20:01:20.005418 2017] [auth_digest:notice] [pid 4057] AH01757: generating secret for digest authentication …
[Thu Jun 08 20:01:20.007244 2017] [lbmethod_heartbeat:notice] [pid 4057] AH02282: No slotmem from mod_heartmonitor
[Thu Jun 08 20:01:23.446113 2017] [mpm_prefork:notice] [pid 4057] AH00163: Apache/2.4.6 (CentOS) OpenSSL/1.0.1e-fips mod_fcgid/2.3.9 PHP/5.4.16 SVN/1.7.14 configured – resuming normal operations
[Thu Jun 08 20:01:23.446502 2017] [core:notice] [pid 4057] AH00094: Command line: ‘/usr/sbin/httpd -D FOREGROUND’

Server configuration - PHP versions shows:
This virtual server is using the mod_php execution mode for PHP, such does not allow per-directory version selection.

I do not know if it is Apache or NGINX that is reading the wrong information.
I just cannot change the PHP version at all.

Please help!

I’m having the same problem. After trying to switch PHP versions Apache won’t start, even after rebooting. This is on a Windows 7 Pro 32 bit install. The only way to recover is to reboot, un-install Ampps, delete the C:\Program Files\Ampps directory tree, reboot and re-install.

I have the following PHP folders.


This thing not working, and it will never work properly. I have to manually edit nginx server’s config to get php properly working. Waste off time doing so if webmin reedit nginx server’s config’s.

That’s not at all the same problem. Virtualmin does not work on Windows. I’m surprised you got anywhere near far enough to see any issues related to PHP versions.

You’re going to have to be more specific. Can you post a new topic with the specific details of your problem, including your distribution and version? If we can reproduce your problem, we can fix it. Otherwise, there’s not much we can do.

I’m not sure that this will resolve your issues but I’ve found that when you have multiple versions of PHP installed you need to edit the virtual server to set the PHP version for the domain in question in order to serve it up correctly. If you navigate to Virtualmin select the domain/server you’re looking at, expand “Server Configuration” and select PHP Versions; There you can set the PHP version for the default directory of the domainand define versions for sub-directories as well.

I’ve run into a similar problem and the fix isn’t simply expanding server configuration and selecting a php version. That is where the problem lies. Despite having multiple versions installed it does not let you pick a php version to use. In my case it says, “This virtual server is using the mod_php or FPM execution mode for PHP, such does not allow per-directory version selection.” and does not allow me to make changes whatsoever.

While the error is probably true, I’m not clear without options on how to change it.

@r3chn3r you shouldn’t use mod_php, for a whole lot of reasons, but FCGID: go to System Settings > Server templates > click on your template (do this for all of them) > PHP Options (from the dropdown) > Default PHP execution mode and select FCGId (run as virtual server owner).

After that be sure to Re-Check Configuration so Virtualmin can see all your PHP versions. Does this solve your problem? Also read up on how you can switch Apache (only vs 2.4.x) to event mode, pretty sure you are using the prefork/worker… and that is not a proper Apache setup.

@Joe Hi there, any ideea why in my case Virtualmin can’t see php 7.2? Of course it’s newish, but still? And is there an API command to change the version for a lot of certain domains at once, can’t find it if such thing exists?

LATER EDIT: found it just please can you give me an example? I don’t need for a specific directory but for the whole domain, the root of public_html.


I’m having issues also using php other then 5.6.

I’ve set it to use 7.2, but phpinfo always show 5.6.

In fpm, it doesn’t even allow to change version.

Help appreciated.


Still can’t change it.

I do the change, it says it’s saved, but phpinfo continues to report 5.6…

This happens in all virtual-servers

Help please.

Found the solution for this.

just follow:

now it’s the folder php settings that doesn’t work…

I’ve one site with oscommerce, need 5.6 in that folder, but doesn’t work… :frowning:


Now I can’t get off php7.2.4 for any virtual server.

Can someone shed some light here please?


I have the same problem, I’ve installed php7.2.4 and it changed all the servers to this version. I can’t select per host - And the CGI defaults to www-data not the hosts username.