cPanel Migration - cloudlinux php selector

murmaider

Member
PartnerNOC
Apr 5, 2012
5
2
53
South Africa
cPanel Access Level
DataCenter Provider
I've noticed that when migrating cPanel accounts between servers, if the account has a PHP version selected (not native) this setting isn't carried over to the new server during the cpanel copy/transfer. So when doing a mass migration of 100's of accounts, we need to go through each of them individually and set their php version again.

Is this intended or a bug?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,201
363
Hello :)

cPanel will not transfer PHP selector configuration values when an account is copied to another server. You may find more information directly related to where Cloud Linux settings are stored (in order to manually copy that data for all accounts) on the Cloud Linux support forums or their documentation.

Thank you.
 

ivan.g

Member
Mar 5, 2008
9
1
53
Cloudlinux documentation has command line tool to manually set PHP version for specified usernames. So assuming you have 4 versions of PHP you may need to run it 4 times setting proper PHP verson for usernames requiring it. Same applies to your source server - using CL terminal utilities you can get a list of usernames and their PHP versions. Comes down to running few commands in terminal.
 

ivan.g

Member
Mar 5, 2008
9
1
53
To be precise:

Get the list of all users in the old system, then find the PHP version:

/usr/bin/cl-selector --current=php --user=USERNAME will retrieve PHP version set for a particular user. The script gets the path from /var/cagefs/USERID/USERNAME/etc/cl.sel/php symlink, compares it with contents of /etc/cl.selector/selector.conf file and if path is valid, prints out the current interpreter version.


In the destination server, repeat in reverse, setting PHP version for all usernames
/usr/bin/cl-selector --select=php --version=5.3 --user=USERNAME sets the current PHP version for particular user by creating symlink in /var/cagefs/USERID/USERNAME/etc/cl.selector directory. All old symlinks are removed, and new symlinks are set.

For bulk information retrieval and updates regex commands are your friends.