Php 8.1 error in INSTALL PHP EXTENSIONS

I’m already using PHP 8.1 on my website but I can’t edit the extension because it’s broken like I said the gzip, Imagick extension for PHP 8.1, and my website needs that extension

Make sure gzip and imagick extensions are installed on your server. PHP8.1 was not meant to be officially available for cyberpanel as its very new. Its only upon request, the developers added the support but it may have such minor issues. You better shift to PHP8.0 until PHP8.1 is perfectly fine. And php8 to php8.1 doesnt have any difference in performance.

1 Like

You can ensure that you have all the 8.1 modules installed by using this command in cli

sudo apt install lsphp81*

i did… just like mr. usman told me before ( in other post) but when i try to click that option
bang… same like screenshoot

1 Like

Yes, as people have described, 8.1 doesn’t work with Cyberpanel right now but it should work with your websites.

2 Likes

yeap… … … … i just giving info that apt install lsphp81* not solved the problem. that mention before.

actually i’m running at 8.0 … look like good and little faster

Same for me. I can’t modify PHP 8.1

cp -f /usr/local/lsws/lsphp81/bin/php /usr/bin/

this works for me to change to 8.1

Your best option to get php 8.1 working is to compile it. My example uses Centos 7
Cyberpanel has php 8.0 and php 8.1 but some extensions are missing and cannot be installe.

You first have to update this file: /usr/local/lsws/admin/html/lib/util/build_php/BuildConfig.php
You want to do 2 things.
My example is using the latest version of php 8.1 but you can always add more versions as they come out

  1. Add php 8.1.9 to the list of PHP_VERSION
    image

  2. Update LSAPI to the latest version which supports php 8
    case self::LSAPI_VERSION: return ‘8.0.1’;
    image

Next you want to go to (https://example.com:7080/index.php#view/compilePHP.php)
From here select php 8.1.9 and click next
Set install path to: /usr/local/lsws/lsphp81 so it will replace the current php 8.1
Set Configure Parameters *. I used the following:

–with-mysqli --with-zlib --enable-gd --enable-shmop --enable-sockets --enable-sysvsem --enable-sysvshm --enable-mbstring --with-iconv --with-pdo-mysql --enable-ftp --with-zip --with-curl --enable-soap --enable-xml --with-openssl --enable-bcmath --with-kerberos --with-system-ciphers --with-bz2 --enable-calendar --enable-dba --with-enchant --enable-exif --with-gettext --with-gmp --with-mhash --with-kerberos --enable-intl --with-ldap --with-libdir=lib64 --with-ldap-sasl --with-mysql-sock --enable-pcntl --with-pdo-mysql --with-pdo-pgsql --enable-sysvmsg --enable-sysvsem --enable-sysvshm --with-xsl --enable-mysqlnd --with-pear

Click next, let the script run till you see “Done” then click next again

You will run into a number of errors because of dependencies but they are simple to solve as there are most likely missing devels in your system. To solve this, install those missing devels before going on to the next step.

yum install -y postgresql-devel openldap-devel gmp-devel enchant-devel bzip2-devel oniguruma-devel libxml2-devel sqlite3-devel icu libicu-devel libxslt-devel libsodium libsodium-devel

Follow the instructions by running /usr/local/lsws/phpbuild/buildphp_manual_run.sh

If you get any error you can do a search and install the devel and rerun the last script.
e.g. yum search oniguruma
The above will give a list of packages, from there select the devel and install
e.g. yum install -y oniguruma-devel

I now have php 8.1 running with all extensions that I require.

1 Like

You may also need to make a few adjustments after:

  1. This is to ensure that lsphp and php use the same settings, which can be modified from cyberpanel’s user interface

mv /usr/local/lsws/lsphp81/lib/php.ini /usr/local/lsws/lsphp81/lib/php.ini.bak
ln -s /usr/local/lsws/lsphp81/etc/php.ini /usr/local/lsws/lsphp81/lib/php.ini

mv /usr/local/lsws/lsphp81/lib/php/extensions/no-debug-non-zts-20210902 /usr/local/lsws/lsphp81/lib/php/extensions/no-debug-non-zts-20210902.bak
ln -s /usr/local/lsws/lsphp81/lib64/php/modules /usr/local/lsws/lsphp81/lib/php/extensions/no-debug-non-zts-20210902

just ensure the symlinks are created

Removed the broken SQLite and fixed the install code :slight_smile:

By the way 8.1.10 released :slight_smile:

sudo yum install -y postgresql-devel openldap-devel gmp-devel enchant-devel bzip2-devel oniguruma-devel libxml2-devel sqlite-devel icu libicu-devel libxslt-devel libsodium libsodium-devel libzip-devel

How do you do these without getting " is not in the sudoers file." error.

Hello someone can help me I followed your pasts and there everything is fine I have installed zip.so, but now the script that I am installing requires this module sodium extension I have tried everything but I can not solve the problem …

here are the logs of what script installed


[root@vmi310028 public_html]# /usr/local/lsws/lsphp81/bin/pecl install  libsodium libsodium-devel
pecl/libsodium requires PHP (version >= 7.0.0, version <= 8.0.99), installed version is 8.1.4
No valid packages found
install failed


[root@server public_html]# php -v
PHP 8.1.4 (cli) (built: Oct 25 2022 18:05:55) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.4, Copyright (c) Zend Technologies


[root@server public_html]# composer install
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Continue as root/super user [yes]? yes
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Your lock file does not contain a compatible set of packages. Please run composer update.

  Problem 1
    - lcobucci/jwt is locked to version 4.2.1 and an update of this package was not requested.
    - lcobucci/jwt 4.2.1 requires ext-sodium * -> it is missing from your system. Install or enable PHP's sodium extension.
  Problem 2
    - lcobucci/jwt 4.2.1 requires ext-sodium * -> it is missing from your system. Install or enable PHP's sodium extension.
    - league/oauth2-server 8.3.5 requires lcobucci/jwt ^3.4.6 || ^4.0.4 -> satisfiable by lcobucci/jwt[4.2.1].
    - league/oauth2-server is locked to version 8.3.5 and an update of this package was not requested.

Setup sodium command SSH:  
 /usr/local/lsws/lsphp81/bin/pecl install  libsodium libsodium-devel

/usr/local/lsws/lsphp81/bin/pecl install  libsodium libsodium-devel
pecl/libsodium requires PHP (version >= 7.0.0, version <= 8.0.99), installed version is 8.1.4
No valid packages found
install failed


Thanks Advance!

Welcome @freddyfoxx Happy you are here

I see you are running PHP 8.1.4.

latest version of libsodium wrapper only supports PHP Version: 8.0.99 or older

I always recommend my users not to use PHP > 8 because it is not tried and tested.

What is my next step??

root@vps:~/php-8.1.18# make install
Installing shared extensions:     /usr/local/lsws/lsphp81/lib/php/extensions/no-debug-non-zts-20210902/
Installing PHP CLI binary:        /usr/local/lsws/lsphp81/bin/
Installing PHP CLI man page:      /usr/local/lsws/lsphp81/php/man/man1/
Installing phpdbg binary:         /usr/local/lsws/lsphp81/bin/
Installing phpdbg man page:       /usr/local/lsws/lsphp81/php/man/man1/
Installing PHP CGI binary:        /usr/local/lsws/lsphp81/bin/
Installing PHP CGI man page:      /usr/local/lsws/lsphp81/php/man/man1/
Installing build environment:     /usr/local/lsws/lsphp81/lib/php/build/
Installing header files:          /usr/local/lsws/lsphp81/include/php/
Installing helper programs:       /usr/local/lsws/lsphp81/bin/
  program: phpize
  program: php-config
Installing man pages:             /usr/local/lsws/lsphp81/php/man/man1/
  page: phpize.1
  page: php-config.1
Installing PEAR environment:      /usr/local/lsws/lsphp81/lib/php/
[PEAR] Archive_Tar    - installed: 1.4.14
[PEAR] Console_Getopt - installed: 1.4.3
[PEAR] Structures_Graph- installed: 1.1.1
[PEAR] XML_Util       - installed: 1.4.5
warning: pear/PEAR dependency package "pear/Archive_Tar" installed version 1.4.14 is not the recommended version 1.4.4
[PEAR] PEAR           - installed: 1.10.13
Wrote PEAR system config file at: /usr/local/lsws/lsphp81/etc/pear.conf
You may want to add: /usr/local/lsws/lsphp81/lib/php to your php.ini include_path
/root/php-8.1.18/build/shtool install -c ext/phar/phar.phar /usr/local/lsws/lsphp81/bin/phar.phar
ln -s -f phar.phar /usr/local/lsws/lsphp81/bin/phar
Installing PDO headers:           /usr/local/lsws/lsphp81/include/php/ext/pdo/

If you get a Loading screen or blank screen when compiling, Check this bug. I’m not sure if it is fixed as yet but it may still be there and will be there for 2.3.3:

Make the change and restart the installation and you will be fine.

I aksed another question, what to do next after compilation ?

Follow the steps in this post: Php 8.1 error in INSTALL PHP EXTENSIONS - #24 by quoviz_dev

Then follow this: Php 8.1 error in INSTALL PHP EXTENSIONS - #17 by quoviz_dev

If you’re using CentOS 8 or later, consider using DNF (Dandified YUM) instead of YUM. The commands are similar, but DNF might provide better package management capabilities.

sudo dnf update
sudo dnf install lsphp81 lsphp81-mysqlnd lsphp81-gd lsphp81-process lsphp81-mbstring lsphp81-xml lsphp81-zip lsphp81-pdo lsphp81-imap lsphp81-soap lsphp81-bcmath

If the issue persists within CyberPanel, check the CyberPanel settings and ensure that it recognizes PHP 8.1 correctly. Sometimes, a panel or control panel might require additional configuration to recognize newly installed PHP versions.

CyberPanel requires manual configuration to show the PHP change in the panel it self.
That is why it’s best to only use what comes with CyberPanel, but I do wish that CyberPanel adds the new PHP versions, to be shown if you upgrade.
Not sure it does today.
Only on “new” installs.