How to Install/build PHP 7.3 manually on CWP – Centos Web Panel

by Sandeep B.

In this tutorial we’ll cover php 7.3 installation manually via commands on CWP server, it is pretty easy to build the php from source which will drastically increase the performance and stability. To build from source/manually you need to follow this tutorial step by step to achieve php 7.3 version installation. PHP 7.3 required addition configs like libzip please follow the tutorial step by step (don’t miss any)

PHP 5.6/7.0/7.1/7.2https://www.mysterydata.com/how-to-install-build-php-5-6-7-0-7-1-7-2-manually-on-cwp-centos-web-panel/

Step 1

Install the dependencies :

yum -y install 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 icu libicu 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

Step 2

Install EPEL :

yum install epel-release

Then install some more dependencies and remove the libzip package :

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

Installing 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

Step 3

Installing php 7.3:

rm -rf /usr/local/php-7-3
mkdir -p /usr/local/php-7-3
cd /usr/local/php-7-3
wget http://php.net/distributions/php-7.3.16.tar.gz
tar zxvf php-7.3.16.tar.gz
cd php-7.3.16
./configure --with-config-file-path=/usr/local/php --with-config-file-scan-dir=/usr/local/php/php.d --with-zlib=/usr --enable-mbstring --enable-zip --enable-bcmath --enable-pcntl --enable-ftp --enable-exif --enable-calendar --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --with-tidy --with-curl --with-iconv --with-gmp --with-pspell --with-gd --with-jpeg-dir=/usr --with-freetype-dir=/usr --with-png-dir=/usr --enable-gd-jis-conv --with-zlib-dir=/usr --with-xpm-dir=/usr --with-openssl --with-pdo-mysql=/usr --with-gettext=/usr --with-bz2=/usr --with-mysqli --enable-soap --enable-phar --with-xsl --with-xmlrpc --with-kerberos --enable-posix --enable-sockets --with-pcre-regex --with-libdir=lib64 --with-mysql-sock=/var/lib/mysql/mysql.sock --enable-shmop --enable-intl --with-icu-dir=/usr --with-imap --with-imap-ssl --with-litespeed --with-pgsql=/usr/lib64/pgsql --with-pdo-pgsql 
make && make install

Step 4

Restart apache server and check php version via command :

service httpd restart
php -v

Please note you don’t need to run every time STEP 1 and STEP 2 if you done it previously.

If this post helps you in any way please consider a donation

Donate with PayPal :

md-donate

You may also like

18 comments

Devesh January 9, 2019 - 7:49 am

Thank you so much for the tutorial.
I encountered this
virtual memory exhausted: Cannot allocate memory make: *** [ext/fileinfo/libmagic/apprentice.lo] Error 1
and solved it by adding –disable-fileinfo at the end on the ./configure command
i.e
./configure –with-config-file-path=/usr/local/php –with-config-file-scan-dir=/usr/local/php/php.d –with-zlib=/usr –enable-mbstring –enable-zip –enable-bcmath –enable-pcntl –enable-ftp –enable-exif –enable-calendar –enable-sysvmsg –enable-sysvsem –enable-sysvshm –enable-wddx –with-tidy –with-curl –with-iconv –with-gmp –with-pspell –with-gd –with-jpeg-dir=/usr –with-freetype-dir=/usr –with-png-dir=/usr –enable-gd-jis-conv –with-zlib-dir=/usr –with-xpm-dir=/usr –with-openssl –with-pdo-mysql=/usr –with-gettext=/usr –with-bz2=/usr –with-mysqli –enable-soap –enable-phar –with-xsl –with-xmlrpc –with-kerberos –enable-posix –enable-sockets –with-pcre-regex –with-libdir=lib64 –with-mysql-sock=/var/lib/mysql/mysql.sock –enable-shmop –enable-intl –with-icu-dir=/usr –with-imap –with-imap-ssl –with-litespeed –with-pgsql=/usr/lib64/pgsql –with-pdo-pgsql –disable-fileinfo

Reply
Bloody January 10, 2019 - 12:51 pm

Hey nach langem qualvollem testen u. fehlversuchen, habe ich mal deine Version probiert.
Echt Super u. einfach , vielen Dank für dein Tutorial, einfacher gehts wirklich nicht mehr.. 😉

Reply
Ardhia Mangku April 9, 2019 - 11:59 pm

sudo rpm -e –nodeps libzip
getting result:
error: package libzip is not installed

Reply
Sandy April 10, 2019 - 11:54 am

this is normal, the command will remove if libzip is installed

Reply
Alis Umak May 11, 2019 - 1:11 am

Hi, Thanks for great tutorials. I’ve created a list of your tutorials for CWP Manuals. I’m a newbee for control panels and server planet.
There are some points which I couldn’t understand those ;
1-Why do I need CWP if I can do it manually some important part of it.
2-Can I still control them with CWP Panel If I folllow your php, redis or memcahed tuorials which are explained cleanly on your website.
3-On the other hand, cwp is out of date. For example , Redis comes V:3.x(Latest version:5.x) postgresql comes with V:9x (Latest version:11.x). phpPGadmin is not stable and has problems.
Do you advice to install redis and postgresql manually…
Thanks

Reply
pajafumo July 19, 2019 - 4:22 am

I get this errors after run #php -v

PHP Warning: PHP Startup: Unable to load dynamic library ‘intl.so’ (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20180731/intl.so (/usr/local/lib/php/extensions/no-debug-non-zts-20180731/intl.so: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20180731/intl.so.so (/usr/local/lib/php/extensions/no-debug-non-zts-20180731/intl.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library ‘intl.so’ (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20180731/intl.so (/usr/local/lib/php/extensions/no-debug-non-zts-20180731/intl.so: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20180731/intl.so.so (/usr/local/lib/php/extensions/no-debug-non-zts-20180731/intl.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 ‘memcache.so’ (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20180731/memcache.so (/usr/local/lib/php/extensions/no-debug-non-zts-20180731/memcache.so: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20180731/memcache.so.so (/usr/local/lib/php/extensions/no-debug-non-zts-20180731/memcache.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library ‘memcache.so’ (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20180731/memcache.so (/usr/local/lib/php/extensions/no-debug-non-zts-20180731/memcache.so: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20180731/memcache.so.so (/usr/local/lib/php/extensions/no-debug-non-zts-20180731/memcache.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP 7.3.6 (cli) (built: Jul 18 2019 22:16:10) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.6, Copyright (c) 1998-2018 Zend Technologies

Reply
Sandy July 20, 2019 - 9:46 am

check the php.ini (main php) if there are any extensions defined which are not loaded/installed.

Reply
Toan December 29, 2019 - 10:02 am

Hello,
When i follow this tutorial and when i check php info i saw: CGI/FastCGI at Server API. So can you help me why php-fpm not work here?
Thanks!

Reply
Sandy January 1, 2020 - 11:01 am

hi, nope its cgi

Reply
Hass Chapman March 3, 2020 - 11:37 am

I followed this tutorial but now I get an error 500 when accessing my wordpress site.

The web error log is:

[Tue Mar 03 11:16:53.055631 2020] [:error] [pid 10392:tid 140492691740416] [client 193.57.40.38:41874] Caused by SystemException in API_Linux.cpp:444: execve() for program "/opt/alt/php56/usr/bin/php-cgi" failed: No such file or directory
[Tue Mar 03 11:16:53.055655 2020] [core:error] [pid 10392:tid 140492691740416] [client 193.57.40.38:41874] End of script output before headers: index.php

Reply
Sandeep B. March 4, 2020 - 9:45 am

it seems you’re low on ram and php build are failing, check the php build log

Reply
antonio March 20, 2020 - 4:51 am

how to add also php-fpm ?

Reply
kadir April 1, 2020 - 1:39 pm

Configuring extensions
checking for strings.h… (cached) yes
checking io.h usability… no
checking io.h presence… no
checking for io.h… no
checking for strtoll… yes
checking for atoll… yes
checking whether to enable LIBXML support… yes
checking libxml2 install dir… no
checking for xml2-config path…
checking for pkg-config… /usr/bin/pkg-config
configure: error: libxml2 not found. Please check your libxml2 installation.

Reply
Sandeep B. April 1, 2020 - 8:29 am

Install this pacakges and try again

yum install libxml2-devel libxml2

Reply
Rajsekar April 10, 2020 - 7:22 am

Hi,
I ran every command without any issue and at last the command “php -v” still shows php 5.6

[root@servconfig php-7.3.16]# php -v
PHP 5.6.37 (cli) (built: Jul 20 2018 06:10:33)

Reply
Sandeep B. April 10, 2020 - 7:30 am

Check the build output for the php where it is failing. Ensure you’ve atleast 1.5-2 gb of ram available.

Reply
Ivan August 19, 2020 - 5:36 pm

Hi sandeep, thx for the tutorial.
A question, do you know how can I install pdo-dblib? since in the same cwp forums a lot of ppl asked but noone could get it done.

Thx

Reply
Sandeep B. August 20, 2020 - 4:13 pm

hi you can post the request in the forum : https://forum.mysterydata.com/

Reply

Leave a Comment