Setting PHP version for subdomain issue

Karthikeyan18

Member
Jun 29, 2018
9
0
1
coimbatore
cPanel Access Level
Root Administrator
I am using cent os 6.9 in VPS server and having the root administrator access.I stored all my applications in /home/(cpanel-name)public_html folder.I have already set the default System php version as 7.1 in WHM.
But when creating the new sub domain into the public_html folder it sets the php version as 5.6.So i unable to run composer in my Default php version.
 

cPanelLauren

Forums Analyst II
Staff member
Nov 14, 2017
7,995
645
263
Houston
cPanel Access Level
DataCenter Provider
Hi @Karthikeyan18

If you go to cPanel>>Software>>MultiPHP Manager you should be able to update the php version for any domain in the account there. You should also be able to change this through WHM>>Software>>MultiPHP Manager

How are you creating accounts? By default, they should be set to inherit unless you have a custom configuration determining the PHP version or PHP-FPM.

Thanks!
 

Karthikeyan18

Member
Jun 29, 2018
9
0
1
coimbatore
cPanel Access Level
Root Administrator
Hi Lauren,
I already did that WHM multiPHP manager as 7.1 for sub domain i have set.I tried to check the PHP version using php -v command in SSH,it showed as 5.6.
My subdomain's application folder exists in this path /home/Username/public_html/.But when i check that creating the another sub domain's folder into /home/Username it shows my default version as 7.1 in ssh.
 

cPanelLauren

Forums Analyst II
Staff member
Nov 14, 2017
7,995
645
263
Houston
cPanel Access Level
DataCenter Provider
Hi @Karthikeyan18

Can you create a php info page in the subdomain's root directory and let me know what the PHP version shows as in the phpinfo? Mine for example looks like this:

Code:
[[email protected] bin]# cat /home/example/public_html/phpinfo.php
<?php

phpinfo();

?>
Then you can view it by going to http://yourdomain.tld/phpinfo.php

Thanks!
 

Karthikeyan18

Member
Jun 29, 2018
9
0
1
coimbatore
cPanel Access Level
Root Administrator
Hi Lauren,

I am getting the following output using the "/usr/bin/php -v",

PHP 7.0.30 (cgi-fcgi) (built: Jun 26 2018 20:34:46)
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies

and "/bin/php -v" shows

-bash: /bin/php: No such file or directory


I have put this subdomain's directory as subdirectory(eg. /home/username/public_html/(Anothor domain's Projectfiles) with sub domain directory) Will this make problem?.Because i already set the sub domain php version as default 7.0 but when checking in ssh at the subdomain directory path php version shows incorrectly.
Otherwise, changing the sub domain directory path will fix this Issue?
 

cPanelLauren

Forums Analyst II
Staff member
Nov 14, 2017
7,995
645
263
Houston
cPanel Access Level
DataCenter Provider
Hi @Karthikeyan18

There is some strangeness occurring with the PHP versions - if you set 7.1 as the default it shouldn't be returning as 7.0 when running
Code:
/usr/bin/php -v
Can you please open a ticket for this using the link in my signature? Once opened please update this thread with the Ticket ID so we can follow up here on the outcome of the ticket.

Thanks!