Skip to content
  • About
  • Contact
  • Docs
  • Features
  • Home

Configurations

5
  • Setup RAID Level 6
  • Setup RAID Level 5
  • How To Add Swap on RHEL or Centos based system
  • Website Migration to Non-Panel OpenLiteSpeed Server
  • Linux Server Performance Tuning

CyberPanel

9
  • Mounting /tmp on a Separate File
  • Updating CyberPanel Main VirtualHost Configuration
  • Updating CyberPanel vHosts Configuration
  • How to Change CLI PHP on CyberPanel
  • How to Update PHP Version to 8.1 in CyberPanel (From 7.3, 7.4, or 8.0)
  • CyberPanel Server Cleanup: Logs, Dumps, Backups
  • CyberPanel Full LSPHP Installation PHP 7.4 – 8.3
  • CyberPanel / OpenLiteSpeed: Clean LSPHP Session Files
  • SSL Certificate Management in CyberPanel via SSH

Hestia Control Panel

6
  • Fixing Email Bounce Back Issue in Hestia (Exim4 Blacklist Rejection)
  • Managing Fail2Ban in HestiaCP Server
  • Installing and Configuring PHP Versions in HestiaCP
  • phpMyAdmin Not Found in HestiaCP
  • Setting Up a Reverse Proxy for any Port in HestiaCP
  • How to Install Let’s Encrypt SSL in Hestia CP (Hostname, Admin Panel, and Email Server)

WHM/cPanel

6
  • Setting Up a Reverse Proxy on cPanel/WHM for Port 8081
  • How to increase the size of the cPanel-generated /tmp filesystem
  • Installing Old PHP Versions on a cPanel/WHM Server
  • Fixing “550: Your Country is Not Allowed to Connect to This Server” Error in Exim (cPanel)
  • Enable WP-CLI in CageFS on CloudLinux Servers (WHM/cPanel)
  • Securing /tmp and /var/tmp with a Dedicated Loopback Filesystem

Nagios

5
  • Service Checks
  • Uptime Checks
  • Disk Space Checks
  • Load Checks
  • Email Related Checks

WordPress

3
  • WordPress Core Reinstallation Guide
  • Managing WordPress Users via WP-CLI
  • Website Duplication, Migration, or Domain Change

Operating System

1
  • Server Reboot (RHEL or Centos based system)

AWS

1
  • How to Resize EBS Volumes on AWS

Databases

2
  • MySQL
    • Optimizing MySQL Performance
    • Recovering MySQL in Plesk When InnoDB Crashes

CloudLinux

4
  • Moving cagefs-skeleton directory
  • Enable WP-CLI in CageFS on CloudLinux Servers (WHM/cPanel)
  • Enable bc in CageFS on CloudLinux Servers(WHM/cPanel)
  • How to Upgrade MySQL 5.x to MySQL 8.0 on CloudLinux (WHM server) with MySQL Governor

Cloudflare

1
  • Configuring Security Headers in Cloudflare

ISPmanager

1
  • Install Free SSL (Let’s Encrypt) for domain.tld on ISPmanager with NGINX

Plesk

1
  • Plesk Admin Login Blocked – IP Restriction Recovery Guide

VPN

4
  • Install OpenVPN Open Source in Linux CentOS Ubuntu Debian Servers
  • Protected: OpenVPN Installation & Fix Wiki (CloudLinux / CentOS 7 & 8)
  • Outline VPN Installation & Management Guide
  • Installing AdGuard Home on Debian/Ubuntu (Docker)
View Categories
  • Home
  • Docs
  • CyberPanel
  • How to Update PHP Version to 8.1 in CyberPanel (From 7.3, 7.4, or 8.0)

How to Update PHP Version to 8.1 in CyberPanel (From 7.3, 7.4, or 8.0)

πŸ“– Introduction

CyberPanel is a powerful web hosting control panel powered by OpenLiteSpeed. Each website (virtual host or “vHost”) in CyberPanel has its own configuration file that specifies which version of PHP it uses.

When a new PHP version like 8.1 is installed, CyberPanel does not automatically update vHost configurations. If your sites are still using older versions like PHP 7.3, 7.4, or 8.0, you’ll need to manually update these configurations to point to PHP 8.1.

This guide explains how to update the PHP path for all virtual hosts using command-line tools and includes backup and rollback instructions for safety.


πŸ› οΈ Step-by-Step Guide

πŸ” Identify vHosts Using Old PHP Versions

Before making any changes, identify which vHost config files are using outdated PHP versions:

grep -r path /usr/local/lsws/conf/vhosts/*/vhost.conf | grep lsphp73
grep -r path /usr/local/lsws/conf/vhosts/*/vhost.conf | grep lsphp74
grep -r path /usr/local/lsws/conf/vhosts/*/vhost.conf | grep lsphp80

βœ… What This Does:

  • Scans all virtual host configuration files (vhost.conf) under /usr/local/lsws/conf/vhosts/
  • Looks for entries specifying the path to lsphp73, lsphp74, or lsphp80, which indicate PHP 7.3, 7.4, or 8.0 is being used.

πŸ—ƒοΈ Backup Virtual Host Configurations

Before modifying anything, create a backup of all vHost configuration files:

cp -prf /usr/local/lsws/conf/vhosts/ /usr/local/lsws/conf/vhosts_bk

βœ… What This Does:

  • Creates a full backup of all vHost configuration directories and files.
  • If anything goes wrong during the update, you can easily restore this backup.

 ✏️ Update PHP Paths in vHost Files to PHP 8.1

Now, update the configuration files to use the PHP 8.1 binary instead of the old versions:

Replace PHP 7.3 path with PHP 8.1 path

sed -i 's|/usr/local/lsws/lsphp73/bin/lsphp|/usr/local/lsws/lsphp81/bin/lsphp|g' /usr/local/lsws/conf/vhosts/*/vhost.conf

Replace PHP 7.4 path with PHP 8.1 path

sed -i 's|/usr/local/lsws/lsphp74/bin/lsphp|/usr/local/lsws/lsphp81/bin/lsphp|g' /usr/local/lsws/conf/vhosts/*/vhost.conf

Replace PHP 8.0 path with PHP 8.1 path

sed -i 's|/usr/local/lsws/lsphp80/bin/lsphp|/usr/local/lsws/lsphp81/bin/lsphp|g' /usr/local/lsws/conf/vhosts/*/vhost.conf

βœ… What This Does:

  • Uses sed to search and replace the old PHP binary path with the PHP 8.1 binary path in all vhost.conf files.
  • Ensures all websites that were using PHP 7.3, 7.4, or 8.0 are now using 8.1.

πŸ” Restart OpenLiteSpeed to Apply Changes

Restart the OpenLiteSpeed service to load the updated configuration files:

systemctl restart lsws

βœ… What This Does:

  • Applies the configuration changes.
  • Without restarting, the web server may continue using the old settings.

βœ… Verify the Changes

Run this command to confirm that all virtual hosts are now pointing to PHP 8.1:

grep -r path /usr/local/lsws/conf/vhosts/*/vhost.conf | grep lsphp81

Optional:

Also test your websites or create a phpinfo.php file in your site’s root with the following content:

<?php phpinfo(); ?>

Access the file in your browser to confirm that PHP 8.1 is active.


πŸ”„ Rollback Instructions (If Needed)

If you experience issues after the upgrade, you can easily restore your previous settings:

cp -prf /usr/local/lsws/conf/vhosts_bk/* /usr/local/lsws/conf/vhosts/
systemctl restart lsws

πŸ“ Additional Notes

  • This process only updates the web server PHP version, not the command-line (CLI) PHP version. If you want to change the system-wide PHP CLI version, use update-alternatives or your package manager (apt, yum, etc.).
  • Ensure that your applications are compatible with PHP 8.1 before making the switch.
  • If PHP 8.1 is not installed yet, install it via CyberPanel or the LiteSpeed script repository.

 

Table of Contents
  • πŸ“– Introduction
  • πŸ› οΈ Step-by-Step Guide
    • πŸ” Identify vHosts Using Old PHP Versions
      • βœ… What This Does:
    • πŸ—ƒοΈ Backup Virtual Host Configurations
      • βœ… What This Does:
    •  ✏️ Update PHP Paths in vHost Files to PHP 8.1
      • βœ… What This Does:
    • πŸ” Restart OpenLiteSpeed to Apply Changes
      • βœ… What This Does:
    • βœ… Verify the Changes
      • Optional:
  • πŸ”„ Rollback Instructions (If Needed)
  • πŸ“ Additional Notes

Share This Article :

  • Facebook
  • X
  • LinkedIn
  • Pinterest

Was it helpful ?

  • Happy
  • Normal
  • Sad
  • About
  • Contact
  • Docs
  • Features
  • Home

© 2026 Panel Web Hosting

  • About
  • Contact
  • Docs
  • Features
  • Home