本文采用php7.0.1做爲樣例,進行安裝。php
系統環境:mysql
CentOS6.7.git
gcc 4.8.2github
libzip 1.0.1redis
在安裝以前,能夠先更新CentOS系統。sql
yum -y update
wget "http://cn2.php.net/distributions/php-7.0.1.tar.gz" wget "http://www.nih.at/libzip/libzip-1.0.1.tar.gz"
tar xvf php-7.0.1.tar.gz tar xvf libzip-1.0.1.tar.gz
cd libzip-1.0.1 ./configure make & make install
此處可能會碰到so文件找不到的狀況。因爲爲搜索/usr/lib64目錄的緣由,通常的解決方法就是直接軟鏈接過去。bash
yum -y install gmp-devel libc-client-devel ln -s /usr/lib64/libc-client.so /usr/lib/libc-client.so ln -s /usr/lib64/libldap* /usr/lib/
./configure --prefix=/usr/local/php701 --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-kerberos --with-openssl --with-pcre-regex --with-zlib --enable-bcmath --with-bz2 --enable-calendar --with-curl --enable-exif --enable-ftp --with-gd --with-gettext --with-gmp --enable-gd-jis-conv --enable-gd-native-ttf --with-imap --with-imap-ssl --enable-intl --with-ldap --enable-mbstring --with-libmbfl --with-mcrypt --with-mysqli --with-mysql-sock --enable-pcntl --with-pdo-mysql --enable-soap --enable-sockets --with-xmlrpc --with-xsl --enable-zip --enable-mysqlnd --enable-maintainer-zts --enable-zend-signals make & make install ln -s /usr/local/php701/bin/php /usr/local/bin/ ln -s /usr/local/php701/bin/phpize /usr/local/bin/ ln -s /usr/local/php701/bin/php-config /usr/local/bin/
因爲redis master 分支暫時不支持 php7.0.1,因此,使用phpredis支持php7的分支進行安裝php7
wget 'https://github.com/phpredis/phpredis/archive/php7.zip' unzip php7.zip cd phpredis-php7 phpize ./configure make & make install
memcached 依賴 libmemcached 和 libevent 兩個包curl
wget 'https://github.com/nmathewson/Libevent/archive/release-2.0.22-stable.tar.gz' tar xvf release-2.0.22-stable.tar.gz cd Libevent-release-2.0.22-stable/ ./configure && make && make install
wget 'https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz' tar xvf libmemcached-1.0.18.tar.gz cd libmemcached-1.0.18 ./configure make && make install
因爲memcached目前版本不支持php7.1,在php-memcached討論中找到了這個解決方法。socket
git clone 'https://github.com/rlerdorf/php-memcached.git' cd php-memcached/ phpize ./configure make && make install
至此,php 7.0.1 已安裝完畢。
安裝擴展以下:
'./configure' '--prefix=/usr/local/php701' '--enable-fpm' '--with-fpm-user=www' '--with-fpm-group=www' '--enable-debug' '--with-kerberos' '--with-openssl' '--with-pcre-regex' '--with-zlib' '--enable-bcmath' '--with-bz2' '--enable-calendar' '--with-curl' '--enable-exif' '--enable-ftp' '--with-gd' '--with-gettext' '--with-gmp' '--enable-gd-jis-conv' '--enable-gd-native-ttf' '--with-imap' '--with-imap-ssl' '--enable-intl' '--with-ldap' '--enable-mbstring' '--with-libmbfl' '--with-mcrypt' '--with-mysqli' '--with-mysql-sock' '--enable-pcntl' '--with-pdo-mysql' '--enable-soap' '--enable-sockets' '--with-xmlrpc' '--with-xsl' '--enable-zip' '--enable-mysqlnd' '--enable-maintainer-zts' '--enable-zend-signals'