How to use php version 8.2.4 or 8.1.7?

Kindly use the forum to your advantage. Such an issue has been resolved for other users such as yourself How to install Php Curl & Php Sqlite3 - #2 by josephgodwinke

Done, buy have new error

checking for utf8_mime2text signature... new
checking for U8T_DECOMPOSE... yes
checking for pam_start in -lpam... yes
checking for crypt in -lcrypt... yes
configure: error: Cannot find imap library (libc-client.a). Please check your c-client installation.

Is this centos ? cause I bet it was ubuntu from your topic description

I have ubuntu Ubuntu 20.04

is this a new installation ?

What do you have in mind “New”? I installed the cyberpanel a couple of hours ago
Maybe need change it here?

./configure  '--prefix=/usr/local/lsws/lsphp82' '--with-libdir=lib64' '--with-zlib' '--with-gd' '--enable-shmop' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--with-curl' '--with-openssl' '--with-gettext' '--with-mcrypt' '--enable-mbstring=all' '--enable-mbregex' '--with-png-dir=/usr' '--with-jpeg-dir=/usr' '--with-kerberos' '--enable-ftp' '--with-imap=/usr' '--with-imap-ssl' '--with-mysql=/usr' '--with-mysqli=/usr/bin/mysql_config' '--enable-pcntl' '--with-freetype-dir=/usr' '--with-pdo-mysql=/usr' '--with-litespeed'

Or copy the library somewhere? Like that

--with-imap=/usr/lib/libc-client.a

?

Not helped (

The fix would be installing a couple of libraries manually and this would be error prone and a waste of valuable time.

Reset your server to have a clean os with no webservers, databases, php.

Install latest cyberpanel on ubuntu 20.04 then use the recommended steps to install the php version of your choice. Please if you can avoid installing from source.

$ apt-cache search lsphp
# install all essentials for cyberpanel
$ apt-get install lsphp81 lsphp81-common lsphp81-mysql lsphp81-sqlite3 lsphp81-mbstring lsphp81-iconv lsphp81-mailparse lsphp81-imap lsphp81-intl lsphp81-zip lsphp81-gd lsphp81-curl lsphp81-xml lsphp81-bcmath

If not follow

then

$ cd /tmp
$ wget https://www.php.net/distributions/php-8.2.4.tar.gz
$ tar -xf php-8.2.4.tar.gz
$ cd php-8.2.4
## It is absolutely required to run ./configure with --with-litespeed since we have to build PHP with LSAPI
$ ./configure  '--prefix=/usr/local/lsws/lsphp82' '--with-libdir=lib64' '--with-zlib' '--with-gd' '--enable-shmop' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--with-curl' '--with-openssl' '--with-gettext' '--with-mcrypt' '--enable-mbstring=all' '--enable-mbregex' '--with-png-dir=/usr' '--with-jpeg-dir=/usr' '--with-kerberos' '--enable-ftp' '--with-imap=/usr' '--with-imap-ssl' '--with-mysql=/usr' '--with-mysqli=/usr/bin/mysql_config' '--enable-pcntl' '--with-freetype-dir=/usr' '--with-pdo-mysql=/usr' '--with-litespeed'
$ make
$ make install

Then configure PHP 8.2 in WebAdmin console to be used as SAPI app

You need to restart lsws service for these changes to be effected.

service lsws reload

Do you check your instructions yourself? After installing a clean system, I also installed this:

apt-get install libc-client2007e-dev
sudo apt install libsqlite3-dev

since I had an error every time
Your instruction just doesn’t work. Now missing libc-client.a

You write instructions that no longer work, or there are not enough points in it.

Those are not my instructions those are the official instructions on litespeed website - the only change I added was the build-essential mistake they did.

I have used the steps so many times. Kindly check with your provider to give you a clean os preferably ubuntu 20.04

You also installed php in two different ways which conflicts. Check you followed instructions by @quoviz_dev which work too and the instructions I gave @fayssal . @quoviz_dev suggests you

If you choose to install from source you are basically on your own meaning errors will follow you depending on what you have installed, network issues etc.

2 Likes

And so by I managed to compile php 8.1.18 changed compilation options to the following:

./configure  '--prefix=/usr/local/lsws/lsphp81' '--with-libdir=lib64' '--with-zlib' '--with-gd' '--enable-shmop' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--with-curl' '--with-openssl' '--with-gettext' '--with-mcrypt' '--enable-mbstring=all' '--enable-mbregex' '--with-png-dir=/usr' '--with-jpeg-dir=/usr' '--with-kerberos' '--enable-ftp' '--with-imap-usr' '--with-imap-ssl' '--with-mysql=/usr' '--with-mysqli=/usr/bin/mysql_config' '--enable-pcntl' '--with-freetype-dir=/usr' '--with-pdo-mysql=/usr' '--with-litespeed'

Changed
'--with-imap=/usr'
to
'--with-imap-usr'

After that I get a warning

end of compilation:


after I did the openlitespeed setting, but the version has not changed

What did I do wrong?

If I try to compile php 8.2, then I also need to modify the line in the same way

Changed
'--with-imap=/usr'
to
'--with-imap-usr'

and remove this one because of the error

'--with-mysqli=/usr/bin/mysql_config'


Again warning

After that, it compiles, but it ends with an error.

I tested on a new system of different OS versions, the errors are the same. Ubuntu 18, Ubuntu 20, Centro 7 and 8
Based on the conclusions, your instruction is not correct. Or am I doing something wrong?

Note if it works for others it means you should not add or remove anything. Follow the steps as they are and it should work.

We do not recommend Centos 7 for new installation so stop trying on that os.

Yet again I discourage building from source.

Build complete.
Don't forget to run 'make test'.

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/
root@vps:~/php-8.1.18#

Does this mean that the compilation completed successfully or not? If yes, which path should be written in Openlitespeed

It doesn’t work for me, I tried to do it many times

What is next step when did I compile?

Sorry for the long wait.

You finally did it. Yes everything compiled successful since there are no errors. Check if you can reach /usr/local/lsws/lsphp81/bin/php -v all executable files like phpize are here /usr/local/lsws/lsphp81/bin/

Next steps

  1. How to use php version 8.2.4 or 8.1.7? - #8 by josephgodwinke

  2. Change default php to v8.0 - #2 by josephgodwinke

  3. [TUTORIAL] How to install any PHP modules using PEAR Package Manager

So i have php -v version 8.1.8, but in my site still 8.1.4

root@vps:~# /usr/local/lsws/lsphp81/bin/php -v
PHP 8.1.18 (cli) (built: Apr 24 2023 17:39:37) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.18, Copyright (c) Zend Technologies
root@vps:~# /usr/local/lsws/lsphp81/bin/ phpize
-bash: /usr/local/lsws/lsphp81/bin/: Is a directory
root@vps:~#

OpenLiteSpeed have next settings:



But web sitll working on 8.1.14, why ?

Make sure to restart litespeed and php

I don’t need version 8.2, I have already installed 8.1.8, how to run it ?

I do every time restart through this button and nothing

In folder /tmp/lshttpd/ I only have these files.

image

I did not compile in the TMP folder, because it does not give me access to it, I just did it in the root folder

image

Just a note regarding your link to another thread above showing how to symbolic_link php at the command line to your desired version of installed phps.

The linked thread post (Change default php to v8.0 - #10 by josephgodwinke) is closed for comments, but it has a mistake that can render php unavailable/unusable. You switched the place of the linked file and the symbolic link
In the linked thread post:

ln -s source_file symbolic_link

ln -sf /usr/bin/php /usr/local/lsws/lsphp80/bin/php

It should be:
ln -sf /usr/local/lsws/lsphp80/bin/php /usr/bin/php

Using the posted command, replace the actual php file in the desired php installation with a symbolic link linking it back to the /usr/bin/php which is also a symbolic link rendering that version of php unusable.

Please change the posting at the closed thread, and if anyone messed up their php, they can quickly go into their desired php version bin directory and remove the symbolic link and replace it with the actual php file in the directory which usually holds the name and version number of the installation. ex. php8.0 here is how:

Delete the symbolic link:

rm -f php
Then copy the file php8.0 to php and it should fix it.
cp php8.0 php

Then they can link it with the correct syntax as follows:

ln -sf /usr/local/lsws/lsphp80/bin/php /usr/bin/php

I thought this would help others if they ran into those instructions in that thread post as I did.