CentosControl PanelCWPLinux

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

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.uxlinux.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.25.tar.gz
tar zxvf php-7.3.25.tar.gz
cd php-7.3.25
./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.

Sandeep B.

I'm a system admin and php developer and currently working as System Admin In CWP Control panel, expertise in Linux and Windows administration RHEL certified admin.

Related Articles

25 Comments

  1. Hello,

    I am facing the following error “virtual memory exhausted: Cannot allocate memory
    make: *** [ext/fileinfo/libmagic/apprentice.lo] Error 1”. When i am trying to execute the command “make && make install”.
    Any suggestions?

  2. I got some error “configure: error: PDO_MYSQL configure failed, MySQL 4.1 needed. Please check config.log for more information.
    ” can you help me?

    1. Hello Fauzan,

      I was facing the same error, the below mentioned point worked for me:
      find the line –with-pdo-mysql=/usr and replace /usr with mysqlnd
      result: –with-pdo-mysql=mysqlnd

  3. Is it possible to install PHP 7.3 for a directory with PHP 7.2 already installed for the rest?

    This function was taken, a shame.

  4. É possível instalar o PHP 7.3 para um diretório com o PHP 7.2 já instalado para o restante?

    Essa função foi tirada, uma pena.

  5. 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

  6. 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)

  7. 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.

  8. 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

  9. 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!

  10. 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

  11. 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

  12. 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.. 😉

  13. 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

Leave a Reply

Your email address will not be published.

Back to top button