MultiPHP Manager set to 8.1.1, and "php -v" gives 8.1.1 in public_html folder, but 5.6.4 in root directory?

Kadence

Active Member
Nov 25, 2006
29
1
153
My web host recently upgraded my PHP 5.6 to 8.1, and installed MultiPHP Manager. For a domain, I used cPanel to set the PHP for the account to 8.1, and if I do "php -v" inside the public_html folder for the user, it says I have 8.1.1. But if I go to the root folder for the user, it says I have 5.6.4.

It doesn't seem to a problem if I create .php files inside public_html. Though I have a programmer who says he needs to place some files below the web server root, and he doesn't have access to 8.1 there.

Is this normal? For MultiPHP manager to give 8.1.1 in the public_html folder only, and inherit it for the user root folder. And is there anything I can do to get 8.1.1 in the root folder? I presume that if I modified the PHP level for the whole server to 8.1.1 via WHM, the user root folder would inherit the 8.1.1, but I don' t want to do that as it might break other sites that wouldn't be compatible with PHP 8.
 

kodeslogic

Well-Known Member
PartnerNOC
Apr 26, 2020
428
202
118
IN
cPanel Access Level
Root Administrator

Kadence

Active Member
Nov 25, 2006
29
1
153
You can refer to the official documentation to know how to set PHP version for a domain
Thank you. I did set the PHP version to 8.1.1 using cPanel and MultiPHP manager.

My issue is that I am getting different versions within the /public_html folder, and above the /public_html folder. If I type "php -v" from somewhere inside the /public_html directory, it says 8.1.1. If I go to the / folder, or to say /var or /public_ftp or /mail, "php -v" gives me 5.6.40.

Is this a known issue, or a bug with my installation?
 

ffeingol

Well-Known Member
PartnerNOC
Nov 9, 2001
712
278
363
cPanel Access Level
DataCenter Provider
If you are outside the home folder, you're going to get the system default. If you are in a sites home folder then you'll get whatever version of PHP that site is set to.
 
  • Like
Reactions: Kadence

andrew.n

Well-Known Member
Jun 9, 2020
875
325
63
EU
cPanel Access Level
Root Administrator
+ you can set different version for Home Directory and for the domain itself.
 

Kadence

Active Member
Nov 25, 2006
29
1
153
When attempting to install certain packages from github via composer, I am getting a PHP compatability error. My host thinks this is because of MultiPHP manager, but they don't provide support for it or know any solution.

I am getting this for all PHP 8 libraries from github that I tried, but I will use PHP Panther as an example.

I use the command, "composer req symfony/panther" as described in the readme. But I get the error:

[InvalidArgumentException]
Package symfony/panther has a PHP requirement incompatible with your PHP version, PHP extensions and Composer version
According to the composer.json:

Here are the requirements:
"require": {
"php": ">=8.0",
"ext-dom": "*",
"ext-libxml": "*",
"php-webdriver/webdriver": "^1.8.2",
"symfony/browser-kit": "^5.3 || ^6.0",
"symfony/dependency-injection": "^5.3 || ^6.0",
"symfony/deprecation-contracts": "^2.4 || ^3",
"symfony/dom-crawler": "^5.3 || ^6.0",
"symfony/http-client": "^5.3 || ^6.0",
"symfony/http-kernel": "^5.3 || ^6.0",
"symfony/process": "^5.3 || ^6.0"
},
The PHP for my server is 5.6.4, but for the account/domain I am using composer with, in cPanel MultiPHP manager, I set the PHP to 8.1. I also tried setting it to 8.0. But composer still gives me these PHP version compatibility errors.

Is there anything I can do about this? Or is MultiPHP manager incompatible with composer? Would composer work if I set the PHP for the server to 5.6.4? I don't know if the issue is the inherited PHP version for the default server PHP version, or something else.
 

Kadence

Active Member
Nov 25, 2006
29
1
153
Hello! If you set up a PHP Info page for domains experiencing this PHP version concern, do you see the right version?
If I set up a page with phpinfo(); or "echo phpversion();", it shows 8.1.1. Since the .php is located within the /public_html folder.

But I am using MultiPHP, and the main server version is 5.6.4. Composer seems to interact with this version, I think. Even though I am calling composer from within the public_html folder.
 

ffeingol

Well-Known Member
PartnerNOC
Nov 9, 2001
712
278
363
cPanel Access Level
DataCenter Provider
Are you physically in the public_html folder or are you supplying the path to the public_html folder. You may also want to search for "run composer with a specific verison of PHP" or something similar. The wrong version of PHP may have been hardcoded in the composer config.
 
  • Like
Reactions: Kadence

Kadence

Active Member
Nov 25, 2006
29
1
153
Are you physically in the public_html folder or are you supplying the path to the public_html folder. You may also want to search for "run composer with a specific verison of PHP" or something similar. The wrong version of PHP may have been hardcoded in the composer config.
In Linux, I am in a sub-folder of the /public_html folder when I am calling the composer command. If I call "php -v" from this same location, it gives me 8.1.1.

I had kept the main server PHP version to 5.6.4, because I was worried about other sites breaking. But I edited all the other user accounts (other than the account I was talking about in this thread) from inheriting the PHP version, to actively being set to 5.6.4. Then I set the main server PHP version to 8.1.1. This seems to have solved the issue of composer giving a PHP compatibility error. The packages now install properly.

Though now I'm getting errors of the following variety, across different libraries:
"Fatal error: Uncaught Error: Class "Symfony\Component\BrowserKit\Client" not found in /home/compareng/public_html/goutte/vendor/fabpot/goutte/Goutte/Client.php:32 Stack trace: #0 {main} thrown in /home/compareng/public_html/goutte/vendor/fabpot/goutte/Goutte/Client.php on line 32"
-----
"Fatal error: Uncaught Error: Class "Symfony\Component\BrowserKit\AbstractBrowser" not found in /home/compareng/public_html/panther/vendor/symfony/panther/src/Client.php:55 Stack trace: #0 {main} thrown in /home/compareng/public_html/panther/vendor/symfony/panther/src/Client.php on line 55"
I think I'll have to try and find assistance from a composer expert on this. Thank you all for the assistance.