Install PHP 7.4 Manual on CWP

Install php 7.4.20 manual on cwp control panel

  • Build Required Files php 7.4
yum install -y 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
  • Install repo epel
yum install epel-release -y
  • Remove libzip package
rpm -e --nodeps libzip libzip-devel
yum -y install cmake3 cmake zlib-devel --enablerepo=epel
  • Install libzip package
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
  • Install pcre2 10.37
wget https://ftp.pcre.org/pub/pcre/pcre2-10.37.zip -O pcre2.zip
unzip pcre2.zip
cd pcre2-*
./configure
make && make install
  • Pkg-config path variable
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig
  • Download PHP 7.4.20
download php 7.4.20
mkdir -p /usr/local/php-7-4
cd /usr/local/php-7-4
wget https://www.php.net/distributions/php-7.4.20.tar.gz
tar zxvf php-7.4.20.tar.gz
cd php-7.4.20
  • Install PHP 7.4.20
./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
  • Delete old php config
rm -rf /usr/local/php/php.d/*
  • Cek versi php
[root@cwp php-7.4.20]# php -v
PHP Warning:  PHP Startup: Unable to load dynamic library 'imagick.so' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20190902/imagick.so (/usr/local/lib/php/extensions/no-debug-non-zts-20190902/imagick.so: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20190902/imagick.so.so (/usr/local/lib/php/extensions/no-debug-non-zts-20190902/imagick.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20190902/sodium.so (/usr/local/lib/php/extensions/no-debug-non-zts-20190902/sodium.so: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20190902/sodium.so.so (/usr/local/lib/php/extensions/no-debug-non-zts-20190902/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP 7.4.20 (cli) (built: Oct 31 2021 11:26:27) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies

herdiana3389

A system administrator with skills in system administration, virtualization, linux, windows, networking, cloud computing, container, etc.