Tuesday, October 23, 2018

How to install PHP 7

Download and extract php source to /opt/software folder

cd /opt/software/php-7.2.7

yum install libjpeg-devel libpng-devel


./configure --prefix=/usr/local/apache/php --with-config-file-path=/usr/local/apache/php --with-apxs2=/usr/local/apache/bin/apxs --disable-cgi --with-zlib --with-gettext --with-sqlite3 --enable-mbstring --enable-calendar --with-curl=/usr/lib64 --with-gd --with-jpeg-dir=/usr/lib64/libjpeg.so --with-png-dir=/usr/lib64/libpng.so --enable-soap --with-libdir=/lib64 --enable-zip --with-mysqli --with-pdo-mysql --with-openssl-dir

make

make install

Add following lines in httpd.conf to enable php

LoadModule php7_module        modules/libphp7.so
AddType application/x-httpd-php .php
<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>

Restart httpd

/etc/init.d/web.system restart

No comments:

Post a Comment