Installation of PHP5 and PHP7

Source: Internet
Author: User
Tags soap mcrypt

First, install the PHP5
1, official website: www.php.net Current mainstream version 5.6/7.1
2?cd/usr/local/src
3?wget http://cn2.php.net/distributions/php-5.6.32.tar.bz2
4. Decompression: TAR-JXVF php-5.6.32.tar.bz2
5. CD php-5.6.32/
6? Compile
./configure--prefix=/usr/local/php--with-apxs2=/usr/local/apache/bin/apxs--with-config-file-path=/usr/local/ php/etc/--with-mysql=/usr/local/mysql--with-pdo-mysql=/usr/local/mysql--with-mysqli=/usr/local/mysql/bin/mysql _config--with-libxml-dir--with-gd--with-gd--with-jpeg-dir--with-png-dir--with-freetype-dir--with-iconv-dir-- With-zlib-dir--with-bz2--with-openssl--with-mcrypt--enable-soap--enable-gd-native-ttf--enable-mbstring-- Enable-sockets--enable-exif
Encountered error 1:configure:error:freetype-config not found
Solution:
Centos:yum Install Freetype-devel
Debian:apt-get Install Libfreetype6-dev

Encountered an error 2:configure:error:mcrypt.h not found. Please reinstall Libmcrypt.
Solution:
Cenos:yum Install Libmcrypt Libmcrypt-devel

How come there are so few errors?

7?echo $? Check if compilation is successful
8?make & make Install
/configure, direct make may appear libtool:link: ' Ext/date/php_date.lo ' is not a valid Libtool object error
Make a clean and then make. The cause is unknown, possibly a problem with some script execution order?
9. View/usr/local/php/and/usr/local/php/bin directories: ls/usr/local/php/
Its core location:/bin directory, viewing size du-sh/usr/local/php/bin/bin/
10, PHP and Apache in conjunction with the Extension Module directory, even if you delete the PHP directory, it does not matter, because they want to libphp5.so this module, Apache and PHP is to use this file/usr/local/apache/modules/ Libphp5.so
11?php What modules it loads:/usr/local/php/bin/php-m

12?CP Php.ini-production/usr/local/php/etc/php.ini
This is the path where the configuration file is located
/usr/local/php/bin/php-i |less Some information about PHP, including the compilation parameters, and the path to the configuration file. This directory is empty, so after CP,CP and then use this command to view it.

Second, installation PHP7
1?cd/usr/local/src
2, wget http://cn2.php.net/distributions/php-7.1.6.tar.bz2
3. Unzip
4?CD php-7.1.6
4. Compile:

./configure--PREFIX=/USR/LOCAL/PHP7--with-apxs2=/usr/local/apache/bin/apxs--with-config-file-path=/usr/local/ Php7/etc--with-pdo-mysql=/usr/local/mysql--with-mysqli=/usr/local/mysql/bin/mysql_config--with-libxml-dir-- WITH-GD--with-jpeg-dir--with-png-dir--with-freetype-dir--with-iconv-dir--with-zlib-dir--with-bz2--with-openssl --with-mcrypt--enable-soap--enable-gd-native-ttf--enable-mbstring--enable-sockets--enable-exif

6?make & Makeinstall
7, view Apache loaded several PHP,/usr/local/apache/bin/apachectl-m
8, want to use which will go to change the configuration file: vim/usr/local/apache/conf/httpd.conf
Find out which php5.so or php7.so you don't want to comment on

Installation of PHP5 and PHP7

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.