php5,7 Installation

Source: Internet
Author: User
Tags soap mcrypt

Installing PHP5
  • PHP official website www.php.net
  • Current mainstream version is 5.6/7.1
  • cd/usr/local/src/
  • wget http://cn2.php.net/distributions/php-5.6.30.tar.gz
  • Tar zxf php-6.6.30.tar.gz
  • CD php-5.6.30
  • ./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

    Apxs2 This tool can automatically load Apache extensions, specify the driver for MySQL, and the following parameters are the modules required to specify PHP

      configure:error: Xml2-config not found. Please check your LIBXML2 installation. [[email protected] php-5.6.30]# yum install-y libxml2-develconfigure:error:cannot find OpenSSL ' s <evp.h& AMP;GT; [[email protected] php-5.6.30]# yum install-y openssl-develconfigure:error:please Reinstall the BZIP2 distributio N[[email protected] php-5.6.30]# yum install-y bzip2-develconfigure:error:jpeglib.h not found. [[email protected] php-5.6.30]# yum install-y libjpeg-develconfigure:error:png.h not found. [[email protected] php-5.6.30]# yum install-y libpng-develconfigure:error:freetype-config not found. [[email protected] php-5.6.30]# yum install-y freetype-develconfigure:error:mcrypt.h not found. Please reinstall Libmcrypt. [[email protected] php-5.6.30]# yum install-y libmcrypt-devel  
  • Make && make install
  • CP php.ini-production/usr/local/php/etc/php.ini//Copy configuration file
    [[email protected] php-5.6.30]# ls /usr/local/php/bin  etc  include  lib  php[[email protected] php-5.6.30]# du -sh /usr/local/php/bin/php36M /usr/local/php/bin/php  //主文件[[email protected] php-5.6.30]# du -sh /usr/local/apache2.4/modules/libphp5.so 37M /usr/local/apache2.4/modules/libphp5.so  //php主模块[[email protected] php-5.6.30]# /usr/local/php/bin/php -m //加载的模块,静态的[PHP Modules]bz2CorectypedatedomeregexiffileinfofiltergdhashiconvjsonlibxmlmbstringmcryptmysqlmysqliopensslpcrePDOpdo_mysqlpdo_sqlitePharposixReflectionsessionSimpleXMLsoapsocketsSPLsqlite3standardtokenizerxmlxmlreaderxmlwriterzlib[Zend Modules]
  • PHP is available as an Apache extension module.
  • View installation information for PHP
    [[email protected] php-5.6.30]# /usr/local/php/bin/php -i |less
    Installing PHP7
  • cd/usr/local/src/
  • wget http://cn2.php.net/distributions/php-7.1.6.tar.bz2
  • Tar jxf php-7.1.6.tar.bz2
  • CD php-7.1.6
  • ./configure--PREFIX=/USR/LOCAL/PHP7--with-apxs2=/usr/local/apache2.4/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
  • Make && make install
  • Ls/usr/local/apache2.4/modules/libphp7.so
  • CP Php.ini-production/usr/local/php7/etc/php.ini//Copy configuration file
  • PHP5 and 7 can be installed at the same time, but the Apache call can only call one, in the/usr/local/apache2.4/conf/httpd.conf inside modify, without the direct comment
    [[email protected] ~]# vim /usr/local/apache2.4/conf/httpd.conf#LoadModule rewrite_module modules/mod_rewrite.soLoadModule php5_module        modules/libphp5.so#LoadModule php7_module        modules/libphp7.so
Extended
    • What exactly is mysql,mysqli,mysqlnd,pdo in PHP?
    • View compilation parameters

php5,7 Installation

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.