Jump to content

Install PHP 8.2 from source Latest version in CWP- control web panel

Featured Replies

Posted
comment_11

In this tutorial we’ll install most awaited php version in CWP control panel as php switcher. This easy guide will guide you upon how to install PHP 8 easily.

PHP 8.2 comes with numerous improvements and new features such as:

  • New readonly Classes
  • Allow true, false, and null as Standalone Types
  • Disjunctive Normal Form (DNF) Types
  • Redact Sensitive Parameters in Back Traces
  • New mysqli_execute_query Function and mysqli::execute_query Method
  • Fetch enum Properties in const Expressions
  • Allow Constants in Traits
  • Deprecate Dynamic Properties (and New #[AllowDynamicProperties] Attribute)
  • Deprecate Partially Supported Callables
  • Deprecate #utf8_encode() and utf8_decode() Functions
  • Deprecate ${} String Interpolation
  • Deprecate mbstring Functions for Base64/QPrint/Uuencode/HTML Entities
  • Remove Support for libmysql from mysqli
  • Locale-Independent Case Conversion
  • Random Extension Improvement

PHP 8.2 will not support your current php scripts/cms/themes. Check before shifting to php 8.2., Latest version of WordPress works great with it also check the theme and plugin support by the devs.

Step 1 :
Building files which are required to compile php 8.2

Centos 7/el7 :

yum install oniguruma oniguruma-devel gcc make gcc-c++ cpp kernel-headers.x86_64 libxml2-devel openssl-devel bzip2-devel libjpeg-devel libpng-devel freetype-devel openldap-devel postgresql-devel aspell-devel net-snmp-devel libxslt-devel libc-client-devel libicu-devel gmp-devel curl-devel libmcrypt-devel pcre-devel sqlite-devel db4-devel enchant-devel libXpm-devel mysql-devel readline-devel libedit-devel recode-devel libtidy-devel libtool-ltdl-devel libwebp libwebp-devel expat expat-devel libargon2 libargon2-devel  

 
Centos 8/stream/el8 :

yum install oniguruma oniguruma-devel gcc make gcc-c++ cpp kernel-headers.x86_64 libxml2-devel openssl-devel bzip2-devel libjpeg-devel libpng-devel freetype-devel openldap-devel postgresql-devel aspell-devel net-snmp-devel libxslt-devel libc-client-devel libicu-devel gmp-devel curl-devel libmcrypt-devel pcre-devel sqlite-devel libdb-devel enchant-devel libXpm-devel mysql-devel readline-devel libedit-devel recode-devel libtidy-devel libtool-ltdl-devel libwebp libwebp-devel expat expat-devel libmemcached libmemcached-devel libargon2 libargon2-devel  


Now we’ll build libzip and pcre2 :
Install EPEL :

yum install epel-release


Then install some more dependencies and remove the libzip package :
Centos 7 :

rpm -e --nodeps libzip libzip-devel
yum -y install cmake3 cmake zlib-devel --enablerepo=epel


Centos 8 :

rpm -e --nodeps libzip libzip-devel
yum install cmake zlib-devel
ln -s /usr/bin/cmake /usr/bin/cmake3


Installing Latest version Libzip from source :

cd /usr/local/src
rm -rf libzip*
wget https://github.com/mysterydata/md-disk/raw/main/libzip-1.10.0.tar.gz
tar zxvf libzip*
## for centos 7 :
cd libzip*
## for centos 8 :
cd libzip*/
mkdir build
cd build
/usr/bin/cmake3 ..
make && make install


Installing Latest version pcre2 from source :

cd /usr/local/src
rm -rf pcre2*
wget https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.42/pcre2-10.42.zip -O pcre2.zip  
unzip pcre2.zip
## for centos 7 :
cd pcre2-*
## for centos 8 :
cd pcre2-*/
./configure
make && make install


Install Latest libavif for new AVIF GD image support:

cd /usr/local/src
rm -rf master* libavif-* build-dir
wget https://github.com/mysterydata/md-disk/raw/main/libavif-0.11.1.zip
unzip libavif-0.11.1
mkdir build-dir
cd build-dir
#Run this if you've centos 7/el7:
cmake3 ../libavif-0.11.1
#Run this if you've centos 8/stream/el8 or up:
cmake ../libavif-0.11.1
make
make install


Step 2 :
Configuring pkg-config path variables

run the below command :

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig


After you installed deps and exporting path variable continue to install php 8 with this steps :

rm -rf /usr/local/php-82
mkdir -p /usr/local/php-82
cd /usr/local/php-82
wget http://php.net/distributions/php-8.2.12.tar.gz
tar zxvf php-8.2.12.tar.gz
cd php-8.2.12
./configure --with-config-file-path=/usr/local/php --enable-cgi --with-config-file-scan-dir=/usr/local/php/php.d --with-zlib=/usr --enable-mbstring --with-zip --enable-bcmath --enable-pcntl --enable-ftp --enable-exif --enable-calendar --enable-sysvmsg --enable-sysvsem --enable-sysvshm --with-tidy --with-curl --with-iconv --with-gmp --with-pspell --enable-gd --with-avif --with-jpeg --with-freetype --enable-gd-jis-conv --with-webp --with-zlib-dir=/usr --with-xpm --with-openssl --with-pdo-mysql=mysqlnd --with-gettext=/usr --with-bz2=/usr --with-mysqli --enable-soap --enable-phar --with-xsl --with-kerberos --enable-posix --enable-sockets --with-external-pcre --with-libdir=lib64 --with-mysql-sock=/var/lib/mysql/mysql.sock --enable-intl --with-password-argon2 --enable-litespeed --with-ldap=/usr --with-ldap-sasl=/usr  
make
make install


it will take some time depends on your server speed when it is finished you can check the php version via command :

php -v


eg :

PHP 8.2.12 (cli) (built: November 10 2023 20:25:33) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.1, Copyright (c) Zend Technologies


if you’ve any question comment below

  • 2 months later...
  • Author
comment_214
13 hours ago, Starburst said:

Do you have a build option so ionCube Loaders can be done at the same time?

Since ionCube Loaders 13.0.x supports PHP 8.1.x and 8.2.x now.

you can do this steps for cwp php switcher 

cd /usr/local
wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.zip
unzip -o ioncube_loaders_lin_x86-64.zip && rm -rf ioncube_loaders_lin_x86-64.zip
touch /usr/local/php/php.d/ioncube.ini
echo 'zend_extension = /usr/local/ioncube/ioncube_loader_lin_8.2.so' >/usr/local/php/php.d/ioncube.ini

for php 8.1 follow all the steps and below command in place of last command line:

echo 'zend_extension = /usr/local/ioncube/ioncube_loader_lin_8.1.so' >/usr/local/php/php.d/ioncube.ini

 

  • Author
comment_215

for cwp php-fpm selector :

cd /usr/local
wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.zip
unzip -o ioncube_loaders_lin_x86-64.zip && rm -rf ioncube_loaders_lin_x86-64.zip
touch /opt/alt/php-fpm82/usr/php/php.d/ioncube.ini
echo 'zend_extension = /usr/local/ioncube/ioncube_loader_lin_8.2.so' >/opt/alt/php-fpm82/usr/php/php.d/ioncube.ini

for php 8.1 follow all the steps and use below commands in place of last 2 commands lines:

touch /opt/alt/php-fpm81/usr/php/php.d/ioncube.ini
echo 'zend_extension = /usr/local/ioncube/ioncube_loader_lin_8.1.so' >/opt/alt/php-fpm81/usr/php/php.d/ioncube.ini

then restart php-fpm services

systemctl restart php-fpm82.service php-fpm81.service

php cgi selector 2 :

cd /usr/local
wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.zip
unzip -o ioncube_loaders_lin_x86-64.zip && rm -rf ioncube_loaders_lin_x86-64.zip
touch /opt/alt/php82/usr/php/php.d/ioncube.ini
echo 'zend_extension = /usr/local/ioncube/ioncube_loader_lin_8.2.so' >/opt/alt/php82/usr/php/php.d/ioncube.ini

for php 8.1 follow all the steps and use below commands in place of last 2 commands lines:

touch /opt/alt/php81/usr/php/php.d/ioncube.ini
echo 'zend_extension = /usr/local/ioncube/ioncube_loader_lin_8.1.so' >/opt/alt/php81/usr/php/php.d/ioncube.ini
  • 3 weeks later...
comment_330

I know it's AL 9.3.

But when I do the PHP /configure line, I keep getting:

checking for iconv support... yes
checking for iconv... yes
checking if iconv is glibc's... yes
checking if iconv supports errno... no
configure: error: iconv does not support errno

At which point, it won't continue. Any ideas?

Getting PHP working is the last step.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now