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/www.hawkdive.com/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

blog iphone stuck apple logo boot loop fix 20261120

iPhone Stuck on Apple Logo: Fix Boot Loop After iOS Update

Fix iPhone stuck on Apple logo boot loop after iOS update. Step-by-step recovery methods from force restart to DFU mode restore.
blog genie4 macos installation fix 20261119

Genie 4 macOS Installation Fails: Complete Troubleshooting Guide

Fix Genie 4 install errors on macOS with step-by-step solutions from Apple Support Community reports. Resolve code signing, Gatekeeper, and dependency issues fast.
blog safari search ai summaries fix 20261118

Safari Search Showing AI Summaries Instead of Links? Fix It Now

Safari search returning AI summaries instead of website links? Learn why this happens and how to restore traditional search results on iPhone, iPad, and Mac.
blog windows 11 coding agent data collection fix 20261117

Windows 11 Collecting Coding Agent Data: How to Stop It

Windows 11 telemetry tracks your coding agents and developer tools. Learn proven steps to disable data collection and protect your development privacy.
blog ai nhs patient care before ambulance arrival 20261116

AI Helps NHS Rethink Patient Care Before Ambulance Arrival

How artificial intelligence is transforming NHS patient care pathways before ambulances arrive on scene.
blog lovable app data exposure fix passport leak 20261115

Lovable App Data Exposure: Fix Passport Leaks & Secure Messages

Lovable apps leaking passport data and 200K+ messages. Step-by-step guide to secure your account, revoke access, and prevent future exposure on iOS and Mac.
blog mac not detecting egpu troubleshooting guide 20261114

Mac Not Detecting External GPU: Complete Troubleshooting Guide

Fix Mac eGPU detection issues with step-by-step solutions from Apple Support Community. Covers Thunderbolt, macOS settings, and hardware checks.
blog fix embroidery machine app subscription lockout ios 20261113

Fix Embroidery Machine App Subscription Lockout on iOS

Bypass mandatory subscription fees on Brother and Janome embroidery machine iOS apps. Step-by-step fixes from Apple Support Community users and developer workarounds.
blog apple issue not found perl paint splatters thread 20261112

No Apple Issue Found in Perl Paint Splatters Thread

The referenced Hacker News thread discusses a Perl programming joke, not an Apple Support issue. No troubleshooting guide can be generated.
blog protect ssh keys macos secure enclave 20261111

Protect SSH Keys with macOS Secure Enclave: Complete Setup Guide

Learn to store SSH private keys in macOS Secure Enclave for hardware-level protection. Step-by-step setup with troubleshooting for common failures.

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.