PHP Versions option is not working , stuck in PHP5.4

I am running CentOS 7 and i am up to dated

I have in every account in Virtuemart Fast CGI
I Re-Check Configuration

I am going to Virtuamin(user) --> Server Configuration --> PHP Versions --> change the version from 5.4 to 5.6 or 7
When i save there is no error and i see that the Version is the one i chose now

But i still if i login via ssh as root or as the user, go to user directory and run:
php -v or run a .php file with phpinfo();
i see php 5.4

I searched the forums but it didn’t help.

Any advice how to proceed with this?

i managed to change the php version for the root user with the command

scl enable rh-php56 bash

php -v
PHP 5.6.25 (cli) (built: Oct 21 2016 18:00:07)
Copyright © 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright © 1998-2016 Zend Technologies

but still not for the user directories,
from System Settings -> Re-Check Configuration i get the following

The following PHP versions are available : 5.4.16 (/bin/php-cgi), 5.6.25 (/opt/rh/php56/root/usr/bin/php-cgi), 7.0.10 (/opt/rh/rh-php70/root/usr/bin/php-cgi), 5.4 (mod_php)

so it’s getting detected but why it is not working?

That probably indicates you’re using mod_php; versions are not switchable for mod_php…it’s always whatever version is enabled in Apache.

Don’t use mod_php, as it’s a bad idea on many fronts (security, memory usage, performance, etc. are all worse with mod_php). Use either mod_fcgid or PHP-FPM execution mode. PHP-FPM should be the default in a fresh installation, but it can be changed on a per-domain basis.

*"i managed to change the php version for the root user with the command

scl enable rh-php56 bash"*

As you noticed, this doesn’t actually do anything. It only affects the current path for the logged in user (and only for the current shell session). It has literally no impact on Apache or any user or any other things.

i have already set all the domains by default to use fastcgi, ofc i restart httpd but still changes are not affecting

how can i remove php5.4 or mod_php completely?

What do you see in the Server API field in your phpinfo output?

i fixed the issue, now i understand how webmin/virtuemin works

I selected the PHP from PHP VERSIONS and In front end the phpinfo file now shows the correct PHP version, after running:

systemctl restart httpd

Basically my main issue was the Composer, i was trying to install packages and it was saying that my PHP is not compatible >=PHP56

so i found out that you can change the php for the current SSH session as i mentioned before by running this command

scl enable rh-php56 bash

and it worked but php extensions was missing so i tried to update them via ssh and all the extensions was up to date.
then i stuck for a while and i found out that i could install them via software packages.

Webmin > System Software Packages > Choose Package from YUM > Click Browse YUM, type the php extension name in the search box and click find packing matching button, and then click the package name install.

then by running composer update/install

and it worked fine not extensions missing

at some point i run this command which points to alternate PHP

ln -s /opt/rh/rh-php56/ /opt/rh/php56

i don’t know if that did the trick for the Virtuemin PHP Versions

I’m glad you got it sorted, and thanks for the update!

That last link command wouldn’t actually do anything…you’ve just linked /opt/rh/php56 to itself.