converting php versions from php-fpm to litespeed

#1
Hi, i've used a test licence for litespeed and noticed a problem that forced me to revert back to apache and stop migrating to litespeed.
I'm on centos 7, latest whm and cloudlinux.

I've know from an older cpanel thread with the support that :
The handler lines within the .htaccess are primarily designed to inform apache of the php versions when php-fpm is not in use; However, when php-fpm is in use the user configurations at /var/cpanel/userdata/username/domain.tld contain the actual php version
As i'm using php-fpm (used suphp before) my accounts php version is stored in /var/cpanel/userdata/username/domain.tld
Every account has, in the document root of every domain, handlers in .htaccess that do not always match the running version of php, or have no handlers at all.

For example:
domain.com has phpversion: ea-php56 in /var/cpanel/userdata/username/domain.com, but AddType application/x-httpd-ea-php72 .php .php7 .phtml in .htaccess
domain.net has phpversion: ea-php70 in /var/cpanel/userdata/username/domain.net and an empty .htaccess

When reverting from apache to litespeed i understand that the .htaccess version of php is used in order litespeed to know which php version will use.
That resulted in many websites to show 500 errors, as some use ioncube for a specific php version, or use cms that need php5.6 to run.

Is there a way to rebuild the .htaccess handlers from the current php version of php-fpm, in order to continue the migration, so when litespeed is up, all the correct php version are on every domain (also subdomain/addon domain)?

best regards,
 
Last edited by a moderator:

mistwang

LiteSpeed Staff
#2
if you can submit a ticket to cPanel, they probably have better solution for this.
To me, you can try switching PHP handler from php-fpm to suphp or CLoudLinux mod_lsapi temporarily, see if that can trigger cPanel to update all .htaccess.
If it does, then switch to litespeed.
If it does not, you may need to write a script to scan and comment out "AddType application/x-httpd..." configuration in .htaccess.
 
#3
Hi, thank you for your reply.
I've posted to cpanel, in order to get a solution.
It would be easy to just remove the .htaccess handlers with a script, but wouldn't then litespeed used the default php version for all?
Does litespeed uses .htaccess cpanel handler to set the php version, or uses some other file (i dont know about that)?
If i have a AddType application/x-httpd-ea-php56 .php .php5 .phtml in .htaccess will litespeed use php56 for that account?

best regards,
 

Pong

Administrator
Staff member
#4
After removing "AddType ...", Apache and LSWS should use the inherited default PHP version. Normally cpanel MultiPHP manager will add such "AddType ..." or "AddHandler ..." to .htacess to set PHP handler and version. Both Apache and LSWS will use such to determine the handler to be used for that domain.

You are correct, AddType application/x-httpd-ea-php56 .php .php5 .phtml in .htaccess will force apache and LSWS to use php56 for that account. Normally you control such change through cpanel MultiPHP manager, instead of manual adding/removing.
 
Last edited by a moderator:
#5
Thank you for your response.

"Normally you control such change through cpanel MultiPHP manager, instead of manual adding/removing."
That's correct, but in case of php-fpm cpanel does not update .htaccess as it keeps in other files the php version.
For example when a new domain is created, cpanel adds handlers for php72 (default in my case) in .htaccess and sets ea-php72 to /var/cpanel/userdata/username/domain.com file.
Then when i change the php version to 7.0, the /var/cpanel/userdata/username/domain.com file is updated as i'm using php-fpm and not .htaccess.
When reverting to litespeed, wrong php version is used, as it reads .htaccess handler.

So the only way to make it work is to add or edit to the correct php version to .htaccess in case i want to move from php-fpm to litespeed.
I've opened a thread to cpanel forums and waiting for an answer, as there are many domains to do it by hand.

best regards,
 
Last edited by a moderator:
#6
Just in case someone else having the same problem, the internal case "CPANEL-23998 Wrong PHP version detected after version change when using PHP-FPM and LiteSpeed"is opened to address this problem.
Until resolved, php versions should be set manually to .htaccess before migration.

best regards,
 
Top