Skip to content

Instantly share code, notes, and snippets.

@the1sky
Last active April 11, 2016 12:12
Show Gist options
  • Save the1sky/0cf865dc67fe1d4c165b583ae98ca58e to your computer and use it in GitHub Desktop.
Save the1sky/0cf865dc67fe1d4c165b583ae98ca58e to your computer and use it in GitHub Desktop.
centos install php 5.6.7
#使用EPEL源
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
#安装第三方依赖
yum -y install gcc make gcc-c++ cpp kernel-headers.x86_64 \
libxml2-devel openssl-devel bzip2-devel libjpeg-devel \
libpng-devel freetype-devel openldap-devel postgresql-devel \
aspell-devel net-snmp-devel libxslt-devel libc-client-devel \
libicu-devel gmp-devel curl-devel libmcrypt-devel pcre-devel \
sqlite-devel db4-devel enchant-devel libXpm-devel mysql-devel \
readline-devel libedit-devel recode-devel libtidy-devel libtool-ltdl-devel
#下载安装php
mkdir -p /usr/local/php-5-6
cd /usr/local/php-5-6
wget http://php.net/distributions/php-5.6.7.tar.gz
tar zxvf php-5.6.7.tar.gz
cd php-5.6.7
#配置并安装
./configure --with-bz2 \
--prefix=/usr/local/php \
--with-apxs2 \
--with-curl \
--with-libdir=/usr/lib64 \
--with-config-file-path=/usr/local/php \
--with-config-file-scan-dir=/usr/local/php/php.d \
--with-iconv \
--with-gd \
--with-jpeg-dir=/usr/local/php \
--with-png-dir \
--with-freetype-dir=/usr/local/php \
--enable-gd-native-ttf \
--with-kerberos \
--enable-mbstring \
--with-mcrypt \
--with-mhash \
--with-mysql \
--with-sqlite3 \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-mysql-sock=/var/lib/mysql/mysql.sock \
--with-xsl \
--with-pspell \
--with-openssl \
--with-gettext \
--with-pcre-regex \
--with-libxml-dir=/usr/local/php \
--with-pdo-mysql \
--with-regex \
--with-pic \
--with-pear=/usr/local/php/pear \
--with-gmp \
--enable-zip \
--with-zlib \
--enable-inline-optimization \
--enable-mbregex \
--enable-opcache \
--enable-fpm \
--enable-posix \
--enable-calendar \
--enable-bcmath \
--enable-exif \
--enable-phar \
--enable-ftp \
--enable-pdo \
--enable-soap \
--enable-sockets \
--enable-intl \
--with-xmlrpc \
--without-pdo-sqlite
make && make install
#复制php.ini
rm -rf /usr/local/php/php.ini
cp php.ini-production /usr/local/php/php.ini
#配置扩展目录
echo "extension_dir='/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226'" >> /usr/local/php/php.ini
#symlink路径
rm -rf /usr/local/bin/php
ln -s /usr/local/php/bin/php /usr/local/bin/php
#重启nginx或apache
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment