Cloudlinux API for setting php version?

tuxie

Registered
Jun 6, 2022
1
0
1
Sweden
cPanel Access Level
Root Administrator
Hi.

I am writing a script for moving some 80+ websites to a cpanel setup. It creates a customer, domain, database etc via the various API's.

But, the host uses the cloudlinux php selector for cpanel. I need to change the PHP versions for every single site I upload, and it seems like none of the functions listed in the cpanel website works or are available for it.

Does anyone have experience and know how to change the cloudlinux php version selector via any sort of API? :)
 

plesk4lyf

Active Member
PartnerNOC
May 21, 2018
37
7
8
Sydney
cPanel Access Level
Root Administrator
I doubt the host only uses the cloudlinux php versions. If the cPanel versions are present, then set the account to use the "native" ( ie server default ) PHP version
selectorctl -b native -u $username

And just use the cPanel ea-php versions.
 

MagnusJGL

Registered
Jun 7, 2022
2
1
3
Sweden
cPanel Access Level
Root Administrator
Unfortunately, I don't have *root access* to the server, and doing it via logging into a customer nets me the message 'selectorctl does not work in CageFS for PHP interpreter' :).

We are on a managed host, where we have access to api tokens for whm, but we don't have access to the root linux user. This is due to the supplier having an uptime and management guarantee, and them having disabled a random set of functionality. I can log in and set the php version manually in cpanel, but doing it manually for every time we are doing this is a bit harsh, especially since its so tantalizingly close :)
 

MagnusJGL

Registered
Jun 7, 2022
2
1
3
Sweden
cPanel Access Level
Root Administrator
So, wound up experimenting a bit more.


^--- I figured out how to do it, but it's not exactly.. nice. More or less a *fourth* way to perform cpanel calls, one where you generate a cookie and call the interface directly. It's not sexy, it's not good and might not be stable long term, but it does *work* at least. Mostly posted it here in case someone is in a tight spot and winds up finding the thread via googling.
 
  • Like
Reactions: cPRex