How to Install PHP 7.4 on CWP Control Panel Manually
How to Install PHP 7.4 on CWP Control Panel Manually
CentOS Web Panel (CWP) is a Free Web Hosting Panel which provides quick and easy management of (Dedicated & VPS) servers. It Provides a huge number of features similar to other paid hosting panels. You can use Apache/NGiNX or both as t the same time. It has also a pro version which enables few more options but as long as you are using for your own projects, you are not required to use the pro version.
CWP initially comes with PHP 5.6 and you can switch your PHP version using PHP Version Switcher. But PHP Version Switcher allows you to switch PHP version up to PHP 7.3 . So if your need to upgrade your PHP version to latest PHP 7.4, you have to do it manually.
I recommend you to check your script compatibility before upgrading to PHP 7.4 .
Reference Links:
This guide will shows you the process to install php 7.4 on CWP Web Panel Manually.
Build Required Files to Compile php 7.4
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
Build libzip and pcre2
Install EPEL :
yum install epel-release
Install some more dependencies and remove the libzip package :
rpm -e --nodeps libzip libzip-devel yum -y install cmake3 cmake zlib-devel --enablerepo=epel
Install Latest version Libzip from source :
cd /usr/local/src rm -rf libzip* wget https://libzip.org/download/libzip-1.5.1.tar.gz tar zxvf libzip* cd libzip* mkdir build cd build /usr/bin/cmake3 .. make && make install
Installing Latest version pcre2 from source :
wget https://ftp.pcre.org/pub/pcre/pcre2-10.34.zip -O pcre2.zip unzip pcre2.zip cd pcre2-* ./configure make && make install
To configure pkg-config path variables run the below command :
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig
Donwload PHP 7.4 and install it:
mkdir -p /usr/local/php-7-4 cd /usr/local/php-7-4 wget https://www.php.net/distributions/php-7.4.5.tar.gz tar zxvf php-7.4.5.tar.gz cd php-7.4.5
Run the configure command one by one to installing php 7.4 :
./configure --with-config-file-path=/usr/local/php --with-config-file-scan-dir=/usr/local/php/php.d --enable-fpm --enable-mbstring --with-zip --enable-bcmath --enable-pcntl --enable-ftp --enable-exif --enable-calendar --enable-sysvmsg --enable-sysvsem --enable-sysvshm --with-curl --with-iconv --with-gmp --with-pspell --enable-gd --with-freetype --with-jpeg --with-webp --with-zlib-dir --with-xpm --with-freetype --enable-gd-jis-conv --with-openssl --with-pdo-mysql=shared --with-gettext=/usr --with-zlib=/usr --with-bz2=/usr --with-mysqli --enable-soap --enable-intl --enable-phar --with-xsl --with-xmlrpc --with-kerberos --enable-posix --enable-sockets --with-external-pcre --enable-calendar --with-libdir=lib64 --with-libxml --with-expat --with-mysql-sock=/var/lib/mysql/mysql.sock --with-imap --with-imap-ssl make && make install
Now delete old ini php config :
rm -rf /usr/local/php/php.d/*
Your php 7.4 installation is complete now. You can check your php version by running this command.
php- v