2018.5.25 install PHP5, install PHP7

Source: Internet
Author: User
Tags soap mcrypt

Installing PHP5
    介绍:    关于php的版本,目前大多企业都会使用5.4以及更高的版本,甚至越来越多的企业使用PHP7版本。    7和5两个版本还是又很大差异的,7的话有很大的性能提升。    PHP官网:hhtp://www.php.net/downloads.php
First, go to the downloaded directory
    [[email protected] src]# cd /usr/local/src/    [[email protected] src]# pwd    /usr/local/src
Download the source Package
    [[email protected] src]#  wget http://cn2.php.net/distributions/php-5.6.30.tar.gz
Unzip the source package
    [[email protected] src]# tar zxvf php-5.6.30.tar.gz
To compile and install
    ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2.4/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-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
There are errors, the first installation of a lack of many source packages, first installed one by one
  • Error 1
    Configure:error:xml2-config not found. Please check your LIBXML2 installation.
    The solution is as follows:
    Yum Install-y libxml2-devel
  • Error 2
    Configure:error:Cannot find OpenSSL ' s <evp.h>
    The solution is as follows:
    Yum Install-y OpenSSL Openssl-devel
  • Error 3
    Checking for BZIP2 in default path ... not found
    Configure:error:Please Reinstall the BZIP2 distribution
    The solution is as follows:
    [email protected] php-5.6.30]# Yum install-y bzip2 bzip2-devel
  • Error 4
    Configure:error:jpeglib.h not found.
    The solution is as follows:
    Yum install-y libpng Libpng-devel
  • Error 5
    Configure:error:jpeglib.h not found.
    The solution is as follows:
    Yum install-y FreeType Freetype-devel
  • Error 6
    Configure:error:jpeglib.h not found.
    The solution is as follows:
    Yum Install-y epel-release
    Yum Install-y libmcrypt-devel
    The CentOS default yum source does not libmcryot-devel this package, so you can only extend the source with Epel Yum
    Install to Yum package again
    [email protected] php-5.6.30]# Yum install libjpeg.x86_64 libpng.x86_64 freetype.x86_64 libjpeg-devel.x86_64 libpng-devel.x86_64 freetype-devel.x86_64-y compiling the installation again
    [[email protected] php-5.6.30]# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/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-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-exifmakemake install
    Finally, the configuration file is copied, as shown in the following example: Configuration httpd support PHPHTTPD Master profile is/usr/local/apache2/conf/httpd.conf
    修改它目的,允许所有请求,如果不设置该行,则我们访问的时候会报错403错误。[[email protected] php-5.6.30]# vim /usr/local/apache2/conf/httpd.conf
  • Search servername, the #servicename www.example.com:80 in front of the well to delete, find the following content modification.
  • Modified to:

    Then find 378 lines below add below:

    Then find the following paragraph, modified to read as follows:
  • Modified to:
    Test if lamp is successful
    httpd、MySQL、和PHP安装之后,需要先检验httpd的配置文件是否正确;只有正确配置才可以正确解析文件。
    Test configuration file is correct
  • Before starting httpd, you need to verify that the configuration file is correct, as follows:
  • If it is wrong, please continue to modify the configuration file httpd.conf, if configured correctly, will show "Syntax OK"
  • The command to start httpd is as follows:
    [[email protected] php-5.6.30]#/usr/local/apache2/bin/apachectl start
  • The command to see whether to start is as follows:
    [Email protected] php-5.6.30]# NETSTAT-LNP |grep httpd
    If this line is displayed and the httpd is started. Test whether the correct parsing of PHP configuration file in 392 add a line so that you can normally parse PHP

First, write a test script first.
    [[email protected] php-5.6.30]# vim /usr/local/apache2/htdocs/1.php    <?php    echo "php解析正常"    ?>

2018.5.25 install PHP5, install 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.