How to Change PHP version in OpenLiteSpeed

I installed OpenLiteSpeed on a server. The default PHP version was 7.3. I wanted PHP 7.4 on this server.

To install PHP 7.4, run

To change PHP version, i edited file


In that, find

Replace with

Now restart PHP and openlitespeed

Now the site will use the new PHP version.

You can install multiple PHP versions, to find other PHP versions available, run the command.

As of 2023-01, openlitespeed image provided by AWS have PHP versions 7.4, 8.0, 8.1 and 8.2

If you need to install any other available PHP version, use the same apt install command as above, and replace lsphp74 with another version you need. For example, to install PHP 8.2

After installing, you need to edit the OpenLiteSpeed config file to switch php version.

See OpenLiteSpeed

Need help with Linux Server or WordPress? We can help!


Leave a Reply

Your email address will not be published. Required fields are marked *