How to Downgrade to PHP 7.4 on an OpenLiteSpeed WordPress VPS (Ubuntu 24.04 “noble”)

GeneralHow to Downgrade to PHP 7.4 on an OpenLiteSpeed WordPress VPS (Ubuntu...

Running legacy code on the latest Ubuntu can be tricky because Canonical and LiteSpeed no longer ship PHP 7.4 for 24.04. This guide shows three workable methods—with screenshots, commands, and fall-back tips—so you can publish your WordPress (or any PHP app) today and still roll forward later.

Contents

  1. Why PHP 7.4 isn’t in the repo any more
  2. Quick comparison of the three downgrade paths
  3. Method A (recommended) – Point OpenLiteSpeed at an external php-fpm 7.4 pool
  4. Method B – Compile lsphp 7.4 from source (keeps LSAPI speed)
  5. Method C – Redeploy on Ubuntu 22.04/Debian 12 where lsphp74 is still packaged
  6. FAQ & troubleshooting matrix
php downgrade 2 74 openlitespeed

1. Why can’t apt install lsphp74 find anything?

  • LiteSpeed’s official repo starts at PHP 8.1 for Ubuntu 24.04.
    The older lsphp74 series is built only for 18.04, 20.04 and 22.04. docs.vultr.com
  • Ubuntu’s own archives removed PHP 7.x in favour of 8.3.
  • PHP 7.4 reached end-of-life on 28 Nov 2022 (no security patches).

So if your application truly requires 7.4 you need an alternate package source or you need to build it yourself.


2. Three downgrade paths at a glance

PathHow long?Maintained byProsCons
A. Use php-fpm 7.4 from Ondřej Surý’s PPA5 minCommunity PPAPackage-managed, easy to swap to PHP 8 laterSlightly slower than LSAPI; PPA is “best-effort”
B. Compile lsphp 7.4 from source15 minYouFull LSAPI speed, no extra repoManual updates; need build tools
C. Re-deploy on 22.04/LS repo10 min + migrateLiteSpeedClean, binary packagesServer rebuild; still EOL PHP

The rest of this article walks through Method A in depth, with call-outs for B & C where they differ.


3. Method A — php-fpm 7.4 + FastCGI handler

Step 1 – Install PHP 7.4-FPM and common extensions

sudo apt update
sudo apt install -y software-properties-common ca-certificates curl
sudo add-apt-repository ppa:ondrej/php # press <Enter>
sudo apt update
sudo apt install -y php7.4-fpm \
php7.4-{mysql,xml,gd,zip,curl,intl,mbstring,imagick,opcache}

The Ondřej Surý PPA still publishes 7.4 packages for noble. launchpad.net

php7.4-fpm starts automatically and listens on
/run/php/php7.4-fpm.sock.


Step 2 – Create a FastCGI External App in OpenLiteSpeed

FieldValue
TypeFastCGI App
Namephp74fpm
Addressuds://run/php/php7.4-fpm.sock
Max Connections100
Start By ServerNo
Command(leave blank)
Ext Path InfoYes
(toggle “Show All” in the form to reveal this field)

Save ➜ Graceful Restart.

Why “Start By Server = No”?
php-fpm is already running as a service; OLS should act only as a client.


Alternate GUI-hidden field method

If Ext Path Info isn’t visible:

  1. SSH in and open /usr/local/lsws/conf/httpd_config.conf.
  2. Find the extprocessor php74fpm block and add: apacheCopyEditextPathInfo 1
  3. sudo /usr/local/lsws/bin/lswsctrl restart.

Step 3 – Switch the global Script Handler

Server Configuration ▸ Script Handler → edit the php row:

FieldNew value
Handler TypeFastCGI
Handler Namephp74fpm

Save ➜ Restart.

(Leave the vHost-level Script Handler blank so it inherits this one.)


Step 4 – Verify

echo '<?php phpinfo(); ?>' | sudo tee /var/www/html/info.php
  • Visit http://your-site/info.php → header shows PHP 7.4.33.
  • WordPress front-end & /wp-admin/ should load without 403s.
  • Tail /usr/local/lsws/logs/error.log to be sure the PATH_INFO errors are gone.

Step 5 – (Optionally) switch CLI to PHP 7.4

sudo apt install -y php7.4-cli
sudo update-alternatives --set php /usr/bin/php7.4

4. Method B — Compile lsphp 7.4 yourself (LSAPI performance)

apt install -y build-essential libxml2-dev libcurl4-openssl-dev \
libjpeg-dev libpng-dev libonig-dev libzip-dev
wget https://www.php.net/distributions/php-7.4.33.tar.gz
tar xzf php-7.4.33.tar.gz && cd php-7.4.33
./configure --with-litespeed --prefix=/usr/local/lsws/lsphp74 \
--with-mysqli --with-openssl --enable-mbstring --enable-gd \
--with-zlib --with-curl --enable-intl --with-zip
make -j"$(nproc)" && make install

Now create an LSAPI External App:

| Address | uds://tmp/lshttpd/lsphp74.sock |
| Command | /usr/local/lsws/lsphp74/bin/lsphp |
| Start By Server | Yes (Through CGI Daemon) |
| Ext Path Info | Yes |

Switch the Script Handler to this app and restart.


web programmer

5. Method C — Spin up a 22.04 VPS

  1. Deploy Ubuntu 22.04 + OpenLiteSpeed image.
  2. sudo wget -O - https://repo.litespeed.sh \| sudo bash
  3. sudo apt install lsphp74 lsphp74-{curl,mysql,xml,...}
  4. Switch Script Handler to lsphp74 (already created by the helper).
  5. rsync your /var/www and database over.

6. FAQ & Troubleshooting Matrix

ErrorCauseFix
E: Unable to locate package lsphp74LiteSpeed repo for 24.04 has no 7.4 buildsUse Method A or C
403 Forbidden + “static file with PATH_INFO”Ext Path Info offEnable it (GUI or config line)
503 Service Unavailable + connect() failed: Permission deniedOLS user cannot write to FPM socketlisten.owner/group = www-data and listen.mode = 0660 (or 0666)
No input file specifiedWrong DocumentRoot or chrootFix path / disable chroot

Final thoughts

OpenLiteSpeed makes it painless to swap interpreters, so you can keep a legacy project alive while planning an upgrade path. Remember that PHP 7.4 receives zero security fixes—lock down /wp-admin/, use strong passwords, and schedule that code refactor sooner rather than later.

Happy hosting!

Nasir Sohail
Nasir Sohail
Nasir is a software engineer with an M.Sc. degree in software engineering and various certifications related to computer hardware and networking, such as MCSE, CCNA, RHCE. He has more than 15 years of mixed industry experience mostly related to IT Support, Web development and Server administration. He also offers his freelancing gig for IT support and consultancy and has more than 400 combined five-star reviews across platforms like Fiverr, Google, TrustPilot, etc.
Watch & Subscribe Our YouTube Channel
YouTube Subscribe Button

Latest From Hawkdive

You May like these Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.