Please help : PHP 7.4 is missing how can I install

Hi everyone I installed cyberpanel by choosing limited installer and skip mail server because of bug always hacked and ftp server. After successfully installed I see php 7.4 is missing. How can I install it correctly

1 Like

Hello @Anwarul.
What OS version do you have?

usmannasir/cyberpanel: Cyber Panel - The hosting control panel for OpenLiteSpeed

ubuntu 22.04

7.3 is only supported up until the last version before 22.04 i think.
Since it says 22.04 does not support below 7.4

I had a similar issue with PHP 7.4. I asked Claude. It fixed everything for me. Here are all the replies and commands. Use it at your own risk. In my case it worked perfectly. I’m using Ubuntu 22.04. It’s somehow a complete guide about installing the PHP versions in Ubuntu 22.04 with Cyberpanel.

Guide from Claude Nov 2024:

I’ll help you reinstall PHP 7.4 on your Ubuntu 22.04 server while maintaining compatibility with CyberPanel and OpenLiteSpeed. Here’s a comprehensive step-by-step guide:

  1. First, add the required PHP repository:

sudo apt-get update

sudo apt-get install software-properties-common

sudo add-apt-repository ppa:ondrej/php

sudo apt-get update

  1. Install PHP 7.4 with essential extensions:

sudo apt-get install php7.4 php7.4-cli php7.4-common php7.4-curl php7.4-mbstring php7.4-mysql php7.4-xml php7.4-zip php7.4-gd php7.4-intl php7.4-bcmath php7.4-imap php7.4-soap php7.4-sqlite3

  1. Verify the PHP installation:

php7.4 -v

  1. For CyberPanel compatibility, you’ll want to ensure OpenLiteSpeed PHP integration:

sudo apt-get install lsphp74 lsphp74-common lsphp74-mysql lsphp74-curl lsphp74-mbstring

  1. Configure OpenLiteSpeed to use the new PHP version:

sudo systemctl restart lsws

Additional recommendations:

  • Always backup your server before making significant changes

  • Verify all your web applications are compatible with PHP 7.4

  • Check CyberPanel’s documentation for any specific PHP integration steps

Potential troubleshooting:

  • If you encounter any extension conflicts, you may need to install additional dependencies

  • Use sudo apt-get -f install if you see any package dependency issues

=====================

I’ll help you resolve this issue step by step:

  1. First, the correct package names are slightly different. Try this command:

sudo apt install php7.4-imap php7.4-mysql php7.4-mysqli

  1. If that doesn’t work, first ensure you have the PHP repository added:

sudo add-apt-repository ppa:ondrej/php

sudo apt update

  1. Then try a more comprehensive PHP 7.4 extension installation:

sudo apt install php7.4-cli php7.4-common php7.4-imap php7.4-mysql php7.4-mysqli php7.4-pdo

  1. For OpenLiteSpeed specific PHP extensions, you might need to install LSPHP extensions:

sudo apt install lsphp74-imap lsphp74-mysql lsphp74-mysqli

  1. If you’re still encountering issues, check your PHP installation path:

which php

php -i | grep "extension directory"

  1. Verify the PHP version and installed extensions:

php -v

php -m

  1. For CyberPanel specific configuration, you might want to use:

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

sudo systemctl restart lsws

Potential solutions for the dynamic library load issue:

  • Ensure you’re using the correct PHP version

  • Check if the extensions are properly symlinked

  • Verify the PHP installation path matches the warning messages

================

I’ll guide you through installing PHP 8.3 on Ubuntu 22.04, which is compatible with CyberPanel and OpenLiteSpeed:

  1. Add the PHP repository:

sudo apt-get update

sudo apt-get install software-properties-common

sudo add-apt-repository ppa:ondrej/php

sudo apt-get update

  1. Install PHP 8.3 with comprehensive extensions:

sudo apt-get install php8.3 php8.3-cli php8.3-common php8.3-curl php8.3-mbstring php8.3-mysql php8.3-xml php8.3-zip php8.3-gd php8.3-intl php8.3-bcmath php8.3-imap php8.3-soap php8.3-sqlite3 php8.3-mysqli php8.3-pdo

  1. For OpenLiteSpeed integration:

sudo apt-get install lsphp83 lsphp83-common lsphp83-mysql lsphp83-curl lsphp83-mbstring

  1. Set PHP 8.3 as the default (optional):

sudo update-alternatives --config php

  1. Verify the installation:

php8.3 -v

php8.3 -m

  1. For CyberPanel compatibility:

sudo systemctl restart lsws

Additional notes:

  • This method uses the Ondřej Surý PPA, which is widely trusted for PHP installations

  • Make sure to test your websites and applications for PHP 8.3 compatibility

  • Some extensions might need to be reinstalled or updated

Potential next steps:

  • Update your web server configuration to use PHP 8.3

  • Check and update any application-specific PHP requirements

  • Review and update PHP configuration files

Would you like me to elaborate on any of these steps or help you with specific configuration details?

==================

I’ll provide a comprehensive guide to managing multiple PHP versions in your Ubuntu 22.04 server with CyberPanel and OpenLiteSpeed:

  1. Check Currently Installed PHP Versions:

# List PHP packages

dpkg -l | grep php

# Check PHP versions installed

ls /etc/php

# View available PHP modules for each version

ls /etc/php/*/mods-available

# Check PHP CLI versions

update-alternatives --list php

  1. Add PHP Repository (if not already added):

sudo apt-get update

sudo apt-get install software-properties-common

sudo add-apt-repository ppa:ondrej/php

sudo apt-get update

  1. Comprehensive PHP Versions Installation Guide:

# PHP 7.4 Full Installation

sudo apt-get install php7.4 php7.4-cli php7.4-common php7.4-{curl,mbstring,mysql,xml,zip,gd,intl,bcmath,imap,soap,sqlite3,mysqli,pdo}

sudo apt-get install lsphp74 lsphp74-common lsphp74-mysql

# PHP 8.1 Full Installation

sudo apt-get install php8.1 php8.1-cli php8.1-common php8.1-{curl,mbstring,mysql,xml,zip,gd,intl,bcmath,imap,soap,sqlite3,mysqli,pdo}

sudo apt-get install lsphp81 lsphp81-common lsphp81-mysql

# PHP 8.2 Full Installation

sudo apt-get install php8.2 php8.2-cli php8.2-common php8.2-{curl,mbstring,mysql,xml,zip,gd,intl,bcmath,imap,soap,sqlite3,mysqli,pdo}

sudo apt-get install lsphp82 lsphp82-common lsphp82-mysql

# PHP 8.3 Full Installation

sudo apt-get install php8.3 php8.3-cli php8.3-common php8.3-{curl,mbstring,mysql,xml,zip,gd,intl,bcmath,imap,soap,sqlite3,mysqli,pdo}

sudo apt-get install lsphp83 lsphp83-common lsphp83-mysql

  1. Prevent Automatic Removal of PHP Packages:

# Hold specific packages to prevent removal

sudo apt-mark hold php7.4-mysql

sudo apt-mark hold php8.1-mysql

sudo apt-mark hold php8.2-mysql

sudo apt-mark hold php8.3-mysql

# To unhold if needed in future

# sudo apt-mark unhold package-name

  1. Verify PHP Installations:

# Check PHP versions

php7.4 -v

php8.1 -v

php8.2 -v

php8.3 -v

# List installed extensions for each version

php7.4 -m

php8.1 -m

php8.2 -m

php8.3 -m

  1. Configure Multiple PHP Versions in OpenLiteSpeed:

# Restart OpenLiteSpeed to recognize new PHP versions

sudo systemctl restart lsws

# Check OpenLiteSpeed PHP configuration

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

  1. Clean Up and Maintenance:

# Remove any unnecessary packages

sudo apt autoremove --purge

# Clean package cache

sudo apt clean

  1. CyberPanel PHP Version Management:
  • Open CyberPanel Web Interface

  • Navigate to Server Settings

  • Check PHP Selector or MultiPHP Manager

  • Ensure all installed versions are recognized

Troubleshooting Tips:

  • If you encounter any package conflicts, use:

sudo apt-get -f install

  • To switch default PHP CLI version:

sudo update-alternatives --config php

Important Recommendations:

  • Always keep your PHP versions and extensions updated

  • Test websites thoroughly after any PHP version changes

  • Maintain consistent extensions across versions

  • Regularly update the PHP repository

1 Like

Thanks I will try

sudo apt-get install lsphp74*

it will install php 7.4 to your cyberpanel, after run it, you can see php 7.4 cyberpanel > php > install Extensions