代码改变世界

centos 7 lNMP 安装之php 篇

2016-09-25 10:35  sogouo  阅读(255)  评论(0编辑  收藏  举报

 

1.准备工作

  安装依赖包

1 yum install -y gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libpng libpng-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses curl openssl-devel gdbm-devel db4-devel libXpm-devel libX11-devel gd-devel gmp-devel readline-devel libxslt-devel expat-devel xmlrpc-c xmlrpc-c-devel

  官方下载php源码包

  点击php官网下载http://php.net/downloads.php

  选择任何一个版本(最新、current stable),建议下载 "current stable",为了体验或者学习新技能,可以下载最新版本

  wget http://cn2.php.net/distributions/php-5.6.26.tar.gz

  建议阅读相关资料

  http://php.net/manual/zh/install.general.php

  http://php.net/manual/zh/features.commandline.php

 

2.php 相关包安装

  1)libmcrypt 包下载地址

    包名:libmcrypt-2.5.8.tar.gz

    http://mcrypt.sourceforge.net/ -- 貌似官方

    https://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/

  2)mhash

    https://sourceforge.net/projects/mhash/?source=typ_redirect

  3)mcrypt

    在安装之前首先,

export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

3.

./configure \
--prefix=/usr/local/php/5.6.26 \
--with-config-file-path=/usr/local/php/5.6.26/etc \
--with-config-file-scan-dir=/usr/local/5.6.26/etc/conf.d \
--enable-fpm \
--with-fpm-user=web \
--with-fpm-group=www \
--enable-soap \
--with-openssl \
--with-openssl-dir \
--with-mcrypt \
--with-pcre-regex \
--with-zlib \
--with-iconv \
--with-bz2 \
--enable-calendar \
--with-curl \
--with-cdb \
--enable-dom \
--enable-exif \
--with-pcre-dir \
--enable-ftp \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-freetype-dir \
--with-gettext \
--with-gmp \
--with-mhash \
--enable-mbstring \
--with-libmbfl \
--with-onig \
--enable-pdo \
--with-pdo-mysql \
--with-zlib-dir \
--with-readline \
--enable-session \
--enable-shmop \
--enable-simplexml \
--enable-sockets \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-wddx \
--with-libxml-dir \
--with-xsl \
--enable-zip \
--enable-mysqlnd \
--with-mysqli \
--without-pear

  安装结果:

[root@bogon php-5.6.26]# cd /usr/local/php/5.6.26/bin/
[root@bogon bin]# ./php -version
PHP 5.6.26 (cli) (built: Sep 25 2016 04:09:38) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

  灵感来源:

  https://www.insp.top/article/make-install-php-7 (不错的blog)