php7剛出來的時候,因爲手頭上事情比較多,一直沒有時間去弄,只能靜靜的看着其餘人在那吹筆。最近終於閒下來,抽空編譯了下php7.php
安裝PHPmysql
#缺失的部分組件 yum install libpng libpng-devel gd gd-devel zlib zlib-devel libmcrypt libmcrypt-devel #download wget http://am1.php.net/distributions/php-7.0.0.tar.gz tar -zxvf php-7.0.0.tar.gz cd php-7.0.0 #網上找的一段配置項 ./configure --prefix=/usr/local/php7 --with-config-file-path=/usr/local/php7/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysqli --with-pdo-mysql --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --with-mcrypt --enable-ftp --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --disable-fileinfo --enable-maintainer-zts --enable-opcache make make install ln -s /usr/local/php7/bin/php /usr/bin/php7 ln -s /usr/local/php7/bin/phpize /usr/bin/php7ize php -v php7 -v cp /src/php-7.0.0/php.ini-development /usr/local/php7/etc/php.ini vim php.ini (修改timezone爲Aisa/Shanghai, 打開opcache及hugepage, opcache.huge_code_pages=1) #查看ini文件修改是否生效 php7 -r "phpinfo();"|grep timezone #查看opcache配置 cat /usr/local/php7/ #查看模塊 php7 -m
安裝Memcached擴展c++
#須要安裝libmemcached最新版本(所需組件) wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz tar -zxvf libmemcached-1.0.18.tar.gz cd libmencached ./configure --prefix=/usr/local/libmemcached make && make install #安裝memcached擴展 git clone https://github.com/php-memcached-dev/php-memcached -b php7 cd php-memcached php7ize #不加--with-php-config參數,會默認使用到原來的php-config,而不是php7-config,致使make的時候報fatal error: Zend/zend_smart_str.h: No such file or directory ./configure --with-libmemcached-dir=/usr/local/libmemcached --with-php-config=/usr/local/php7/bin/php-config make && make install vim php.ini (修改extension=memcached.so) php7 -m #安裝memcached服務 yum install memcached -y #開啓memcached服務 memcached -d -m 100 -u root -p 11211 -P /tmp/memcached.pid
測試程序:git
安裝Redis擴展github
#git clone地址 git clone https://github.com/phpredis/phpredis -b php7 cd phpredis php7ize ./configure --with-php-config=/usr/local/php7/bin/php-config make && make install vim /usr/local/php7/ect/php.ini (添加extension=redis.so) #安裝redis 服務 yum install redis -y service redis start
測試程序:redis
對了,鳥哥微博裏說的,建議gcc升級到4.8:sql
wget ftp://gcc.gnu.org/pub/gcc/releases/gcc-4.8.2/gcc-4.8.2.tar.bz2 tar -xvf gcc-4.8.2.tar.bz2 cd gcc-4.8.2 ./contrib/download_prerequistities //會自動下載三個依賴庫,gmp, mpfr, mpc cd gmp mkdir build cd build ../configure --prefix=/usr/local/gcc/gmp make && make install cd ../../mpfr mkdir build cd build ../configure --prefix=/usr/local/gcc/mpfr --with-gmp=/usr/local/gcc/gmp make && make install cd ../../mpc mkdir build cd build ../configure --prefix=/usr/local/gcc/mpc --with-mpfr=/usr/local/gcc/mpfr --with-gmp=/usr/local/gcc/gmp make && make install vim /etc/ld.so.conf #添加如下內容到文件中: /usr/local/gcc/gmp/lib /usr/local/gcc/mpfr/lib /usr/local/gcc/mpc/lib ldconf 編譯gcc cd ../.. ./configure --prefix=/usr/local/gcc --enable-threads=posix --disable-checking --enable-languages=c,c++ --disable-multilib make && make install //漫長的編譯。。。第一次編譯差很少兩三個小時。。 刪除舊版本gcc yum remove gcc yum remove gcc-c++ updatedb 連接到新版本 cd /usr/bin ln -s /usr/local/gcc/bin/gcc gcc ln -s /usr/local/gcc/bin/g++ g++ gcc -v