Navigate

STUDIO

Cosenza

Via Savinio 87036
(+39) 3534255790
[email protected]

Medan

Jl. Amal No. 7F
(+62) 851 753 400 40
[email protected]

The first that we have to do is to install the PHP version that you want to run for your website.

The following command will install LSPHP 8.0:

For Ubuntu/Debian

$

[sourcecode language=”plain”]apt-get install lsphp80 lsphp80-common lsphp80-mysql lsphp80-gd lsphp80-process lsphp80-mbstring lsphp80-xml lsphp80-mcrypt lsphp80-pdo lsphp80-imap lsphp80-soap lsphp80-bcmath[/sourcecode]Copy to clipboard

For CentOS

$

[sourcecode language=”plain”]yum install lsphp80 lsphp80-common lsphp80-mysql lsphp80-gd lsphp80-process lsphp80-mbstring lsphp80-xml lsphp80-mcrypt lsphp80-pdo lsphp80-imap lsphp80-soap lsphp80-bcmath[/sourcecode]Copy to clipboard

I would like to recommend you use the latest stable version of PHP as possible. It will keep your website secure and also boost your website speed, especially if your website has many plugins installed which have tons of functions.

But for some reason maybe you need another PHP version like plugin compatibility or else. Let’s say you want to install PHP 7.3 or 7.4 etc simply replace 80 above with 73 or 74 and it will install PHP 7.3 or PHP 7.4 version. The LiteSpeed Repository automatically installs PHP to /usr/local/lsws/lsphp8x/bin/lsphp where 8x is the version and subversion. Thus PHP 8.0 would be installed to /usr/local/lsws/lsphp80/bin/lsphp.

Now you will have folders of lsphp80 under: /usr/local/lsws/ .

Define External App for the New PHP Version.

After you installed the new php, you need to tell the openlitespeed server that there is new version of PHP available.

So to do that, you have to login to Openlitespeed WebAdmin. Now, point your web browser to domain name or IP address followed by :7080 to specify the port:

[sourcecode language=”plain”]https://server_domain_or_IP:7080[/sourcecode]

ignore the SSL security warning, and then use the admin credentials you set.

Add an external application (in the WebAdmin console > Server Configuration > External App > Add).

Add an external application (in the WebAdmin console > Server Configuration > External App > Add). 

I already add PHP Version that I have for my website. When you add new. You will see this option:

Choose LiteSpeed SAPI App for the application type. then you have to fill in this configuration:

  • Name:
    lsphp80
  • Address:
    uds://tmp/lshttpd/lsphp80.sock
  • Max Connections:
    50
  • Environment:
    PHP_LSAPI_MAX_REQUESTS=500
    PHP_LSAPI_CHILDREN=35
  • Initial Request Timeout (secs):
    60
  • Retry Timeout :
     0
  • Response Buffering: no
  • Auto Start: yes
  • Command:
    $SERVER_ROOT/lsphp80/bin/lsphp
  • Back Log:
    100
  • Instances:
    1
  • Memory Soft Limit (bytes):
    2047M
  • Memory Hard Limit (bytes):
    2047M
  • Process Soft Limit:
    400
  • Process Hard Limit:
    500

Setup script handlers for your website

Script handlers will tell OpenLiteSpeed which scripts should go to which external application. We will be setting up a script handler at the virtual host level to tell OpenLiteSpeed that .php scripts in this virtual host should be served with our new lsphp80 external application. This will override any server-level script handler settings.

So, Go to Virtual Hosts > Yoursite > Script Handlers > Add).

Choose the suffix this script handler will handle, make the Handler Type LiteSpeed SAPI, and direct it toward the external application you just created.

After you set the configuration and save it. You have to do a graceful restart to save your changes.