PHP7初体验

WBOY
풀어 주다: 2016-06-20 12:41:57
원래의
1115명이 탐색했습니다.

php7刚出来的时候,由于手头上事情比较多,一直没有时间去弄,只能静静的看着其他人在那吹笔。最近终于闲下来,抽空编译了下php7.


安装PHP

#缺失的部分组件yum install libpng libpng-devel gd gd-devel zlib zlib-devel libmcrypt libmcrypt-devel#downloadwget http://am1.php.net/distributions/php-7.0.0.tar.gztar -zxvf php-7.0.0.tar.gzcd 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-opcachemakemake installln -s /usr/local/php7/bin/php /usr/bin/php7ln -s /usr/local/php7/bin/phpize /usr/bin/php7izephp -vphp7 -vcp /src/php-7.0.0/php.ini-development /usr/local/php7/etc/php.inivim 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扩展

#需要安装libmemcached最新版本(所需组件)wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gztar -zxvf libmemcached-1.0.18.tar.gzcd libmencached./configure --prefix=/usr/local/libmemcachedmake && make install#安装memcached扩展git clone https://github.com/php-memcached-dev/php-memcached -b php7cd php-memcachedphp7ize#不加--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-configmake && make installvim 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
로그인 후 복사

测试程序:


安装Redis扩展


#git clone地址git clone https://github.com/phpredis/phpredis -b php7cd phpredisphp7ize./configure --with-php-config=/usr/local/php7/bin/php-configmake && make installvim /usr/local/php7/ect/php.ini(添加extension=redis.so)#安装redis 服务yum install redis -yservice redis start
로그인 후 복사


测试程序:


对了,鸟哥微博里说的,建议gcc升级到4.8:

wget ftp://gcc.gnu.org/pub/gcc/releases/gcc-4.8.2/gcc-4.8.2.tar.bz2tar -xvf gcc-4.8.2.tar.bz2cd gcc-4.8.2./contrib/download_prerequistities    //会自动下载三个依赖库,gmp, mpfr, mpccd gmpmkdir buildcd build../configure --prefix=/usr/local/gcc/gmpmake && make installcd ../../mpfrmkdir buildcd build../configure --prefix=/usr/local/gcc/mpfr --with-gmp=/usr/local/gcc/gmpmake && make installcd ../../mpcmkdir buildcd build../configure --prefix=/usr/local/gcc/mpc --with-mpfr=/usr/local/gcc/mpfr --with-gmp=/usr/local/gcc/gmpmake && make installvim /etc/ld.so.conf#添加以下内容到文件中:/usr/local/gcc/gmp/lib/usr/local/gcc/mpfr/lib/usr/local/gcc/mpc/libldconf编译gcccd ../.../configure --prefix=/usr/local/gcc --enable-threads=posix --disable-checking --enable-languages=c,c++ --disable-multilibmake && make install //漫长的编译。。。第一次编译差不多两三个小时。。删除旧版本gccyum remove gccyum remove gcc-c++updatedb链接到新版本cd /usr/binln -s /usr/local/gcc/bin/gcc gccln -s /usr/local/gcc/bin/g++ g++ gcc -v
로그인 후 복사



来自: http://my.oschina.net/u/948242/blog/552887

관련 라벨:
원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿