Skip to main content

Updating lsphp

Learning Focus

By the end of this lesson you will know how to update lsphp packages safely, manage multiple PHP versions, and verify that PHP is working correctly after an update.

Why lsphp Updates Matter

PHP security releases patch vulnerabilities that can expose your applications to remote attacks. Compatibility updates ensure modern frameworks and CMS versions work correctly.

Check Current lsphp Version

# Check installed lsphp packages
dpkg -l | grep lsphp # Debian/Ubuntu
rpm -qa | grep lsphp # RHEL family

# Check running PHP version
/usr/local/lsws/lsphp84/bin/lsphp -v

Update lsphp

On Debian / Ubuntu

# Update package lists
sudo apt update

# Upgrade all lsphp packages
sudo apt upgrade lsphp84 lsphp84-common lsphp84-mysql lsphp84-curl

# Or upgrade a specific version
sudo apt install lsphp84=DESIRED_VERSION

On RHEL / AlmaLinux / Rocky

sudo dnf upgrade lsphp84 lsphp84-common lsphp84-mysqlnd

Post-Update Verification

# 1) Check the new PHP version
/usr/local/lsws/lsphp84/bin/lsphp -v

# 2) Restart OpenLiteSpeed to pick up the new binary
sudo /usr/local/lsws/bin/lswsctrl restart

# 3) Test PHP execution
echo '<?php echo "PHP " . phpversion() . "\n"; ?>' > /tmp/test.php
/usr/local/lsws/lsphp84/bin/lsphp /tmp/test.php
rm /tmp/test.php

# 4) Test via web request
curl http://localhost/info.php # if you have a phpinfo test page

# 5) Check for PHP errors
tail -20 /usr/local/lsws/logs/stderr.log

Managing Multiple PHP Versions

If you run multiple applications needing different PHP versions:

ApplicationPHP Versionlsphp Binary
WordPress sitePHP 8.4/usr/local/lsws/lsphp84/bin/lsphp
Legacy appPHP 8.1/usr/local/lsws/lsphp81/bin/lsphp
# Install an additional PHP version
sudo apt install lsphp81 lsphp81-common lsphp81-mysql

# Configure separate external apps in WebAdmin for each version
info

Each PHP version has its own php.ini file. After updating lsphp, check that your custom INI settings were not overwritten by the package update.

Common Post-Update Issues

ProblemCauseFix
Extension missing after updateNew package replaced extension listReinstall missing extension package
php.ini changes lostPackage overwrote custom configRestore from backup or re-apply
503 errors on PHP pagesPHP workers not restartedReload OpenLiteSpeed
OPcache not warmingCache invalidated by updateExpected; first requests will be slower

Key Takeaways

  • Keep lsphp current — especially for security patches.
  • Always restart OpenLiteSpeed after updating lsphp to pick up the new binary.
  • Check that custom php.ini settings survived the package update.
  • Verify PHP works with a test script and error log review.

What's Next