Cannot change PHP version or Server API

12 posts / 0 new
Last post
#1 Fri, 06/09/2017 - 02:38
carloadmin

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: /etc/webmin/virtual-server/templates/1 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/.conf User apache Group apache ServerAdmin root@localhost AllowOverride none Require all denied DocumentRoot "/var/www/html" AllowOverride None # Allow open access: Require all granted Options Indexes FollowSymLinks AllowOverride None Require all granted DirectoryIndex index.html 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/" 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 SSLCipherSuite ECDHE-RSA-AES256-SHA384:AES256-SHA256:AES256-SHA256:RC4:HIGH:MEDIUM:+TLSv1:+TLSv1.1:+TLSv1.2:!MD5:!ADH:!aNULL:!eNULL:!NULL:!DH:!ADH:!EDH:!AESGCM ServerTokens Minimal ServerSignature Off TraceEnable Off

SuexecUserGroup "#509" "#503" ServerName lala.net ServerAlias www.lala.net ServerAlias webmail.lala.net ServerAlias admin.lala.net 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 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 allow from all AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch Require all granted RewriteEngine on RewriteCond %{HTTP_HOST} =webmail.lala.net RewriteRule ^(.) https://lala.net:20000/ [R] RewriteCond %{HTTP_HOST} =admin.lala.net RewriteRule ^(.) https://lala.net:10000/ [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!

Fri, 06/09/2017 - 22:44
lvlpost
lvlpost's picture

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.

php php-5.3 php-5.4 php-5.6 php7-0

Sat, 09/30/2017 - 13:34 (Reply to #2)
Joe
Joe's picture

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.

--

Check out the forum guidelines!

Sat, 09/30/2017 - 06:38
vitoreafeliciano

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.

Sat, 09/30/2017 - 13:35 (Reply to #4)
Joe
Joe's picture

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.

--

Check out the forum guidelines!

Wed, 11/22/2017 - 10:45
justlaurent

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.

Tue, 02/27/2018 - 21:34
r3chn3r

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.

Sat, 03/03/2018 - 12:32
fakemoth
fakemoth's picture

@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 https://www.virtualmin.com/documentation/developer/cli/set_php_directory 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.

Don't take the name of root in vain...

Tue, 04/24/2018 - 19:57
alvesjc

Hello,

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.

Sat, 04/28/2018 - 13:06
alvesjc

Anyone?

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.

Sun, 04/29/2018 - 05:01
alvesjc

Found the solution for this.

just follow:

https://www.virtualmin.com/node/46837

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... :(

Update:

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

Can someone shed some light here please?

Thanks

Wed, 11/07/2018 - 14:24 (Reply to #11)
philipnewmannz

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.