Php 8.1 error in INSTALL PHP EXTENSIONS

I have same problem on all of my servers when try install 8.1 extensions on cyberpanel. One of servers are fresh 7 day old server.


same

fresh install

This section in particular is broken in cyberpanel for php8.1 as it fails to list the php8.1 extensions installed. but you can select php8.1 and it will work. I am using it in my wordpress sites and works perfect.

Haven’t try since 8.1 came but that time redis was not working.
Does redis work now out of box or need manual install extension?

If it’s broken why it’s like that with no update
for myself, i need gzip, Imagick extension for PHP 8.1 but i can’t enable it because as you said ‘’ broken’’
@usmannasir Hopefully you can look into this

No, its not broken that way. Every modules are pre-activated whichever is installed in server. Its just that the controlling part interface (disabling and enabling modules ) is broken

You just need to select the php8.1 inside website manage option in cyberpanel and it will work. Have a try.

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.

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.