Category: LiteSpeed

  • 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

    apt install -y lsphp74 lsphp74-apcu lsphp74-common lsphp74-curl lsphp74-dbg lsphp74-dev lsphp74-igbinary lsphp74-imagick lsphp74-imap lsphp74-intl lsphp74-ioncube lsphp74-json lsphp74-ldap lsphp74-memcached lsphp74-modules-source lsphp74-msgpack lsphp74-mysql lsphp74-opcache lsphp74-pear lsphp74-pgsql lsphp74-pspell lsphp74-redis lsphp74-snmp lsphp74-sqlite3 lsphp74-sybase lsphp74-tidy
    

    To change PHP version, i edited file

    vi /usr/local/lsws/conf/httpd_config.conf
    

    Find

    extProcessor lsphp{
        type                            lsapi
        address                         uds://tmp/lshttpd/lsphp.sock
        maxConns                        10
        env                             PHP_LSAPI_CHILDREN=10
        env                             LSAPI_AVOID_FORK=200M
        initTimeout                     60
        retryTimeout                    0
        persistConn                     1
        pcKeepAliveTimeout
        respBuffer                      0
        autoStart                       1
        path                            lsphp73/bin/lsphp
        backlog                         100
        instances                       1
        priority                        0
        memSoftLimit                    2047M
        memHardLimit                    2047M
        procSoftLimit                   1400
        procHardLimit                   1500
    }
    

    In that, find

        path                            lsphp73/bin/lsphp
    

    Replace with

        path                            lsphp74/bin/lsphp
    

    Now restart PHP and openlitespeed

    killall -9 lsphp
    systemctl restart lsws
    

    Now the site will use the new PHP version.

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

    apt-cache search lsphp
    

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

    root@ip-172-31-22-59:~# apt-cache search lsphp | grep common
    lsphp74-common - Common files for packages built from the PHP source
    lsphp80-common - Common files for packages built from the PHP source
    lsphp81-common - Common files for packages built from the PHP source
    lsphp82-common - Common files for packages built from the PHP source
    root@ip-172-31-22-59:~# 
    

    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

    apt install -y lsphp82 lsphp82-apcu lsphp82-common lsphp82-curl lsphp82-dbg lsphp82-dev lsphp82-igbinary lsphp82-imagick lsphp82-imap lsphp82-intl lsphp82-ioncube lsphp82-json lsphp82-ldap lsphp82-memcached lsphp82-modules-source lsphp82-msgpack lsphp82-mysql lsphp82-opcache lsphp82-pear lsphp82-pgsql lsphp82-pspell lsphp82-redis lsphp82-snmp lsphp82-sqlite3 lsphp82-sybase lsphp82-tidy
    

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

    See OpenLiteSpeed

  • OpenLiteSpeed move Swapping Directory

    OpenLiteSpeed move Swapping Directory

    By default OpenLiteSpeed use /tmp/lshttpd/swap for temp files. If your /tmp partition is small, disk may get full.

    To move OpenLiteSpeed swap partition to / partition do the following.

    mkdir -p /lswstmp/lshttpd/swap
    chmod 750 /lswstmp/lshttpd
    chmod 700 /lswstmp/lshttpd/swap
    chown -R nobody:nobody /lswstmp/lshttpd
    

    Now login to OpenLiteSpeed admin interface at

    https://your-server-ip:7080/login.php
    

    If you don’t have user name and password, you can reset it by running command

    /usr/local/lsws/admin/misc/admpass.sh
    

    Once logged in, go to

    Server Configuration > General
    

    OpenLiteSpeed

    Under “Server Process’ section, you need to edit value of “Swapping Directory”. Default value is “/tmp/lshttpd/swap”, change it to “/lswstmp/lshttpd/swap”.

    Restart OpenLiteSpeed. You can do it using web interface or using SSH.

    systemctl restart lsws
    

    See OpenLiteSpeed

  • Install LiteSpeed Web Server

    Install LiteSpeed Web Server

    LiteSpeed is a high performance web server. Unlike most other web servers, this is a paid software, so you will need to purchase a license or get trail key before you can use it.

    To install LiteSpeed, download latest version of the software from

    https://www.litespeedtech.com/products/litespeed-web-server/download

    At this time of writing this post, latest version of LiteSpeed is 5.4.7

    cd /usr/local/src
    wget https://www.litespeedtech.com/packages/5.0/lsws-5.4.7-ent-x86_64-linux.tar.gz
    tar -xvf lsws-5.4.7-ent-x86_64-linux.tar.gz
    cd lsws-5.4.7
    ./install.sh
    

    Before you can run the install.sh script, you need to copy your license key to this folder. It will ask you few questions. Once installed, admin interface will be available on URL

    http://your-server-ip-here:7080

    LiteSpeed Web Server

  • Install Zend OpCache on OpenLiteSpeed Server

    Install Zend OpCache on OpenLiteSpeed Server

    To install Zend OpCache on OpenLiteSpeed Server, run

    apt install -y lsphp73-opcache
    

    Now restart PHP with command

    killall -9 lsphp
    

    Zend OpCache GUI

    Zend OpCache GUI shows stats for OpCache. This is for monitoring purpose only.

    You can download it from

    https://github.com/amnuts/opcache-gui

    All you need to do is download the files, exact it, upload it to your web site. It will show nice graphs with cache statistics.

    Zend OpCache GUI