php7安装(centos7)
时间:2016-10-13 13:50:04
阅读:449次
php7安装(centos7)
1. yum -y install epel-release //扩展包更新包 yum -y update yum -y install gcc bzip2 bzip2-devel gcc-c++ autoconf yum -y install mcrypt mhash php-mcrypt openssl-devel yum -y install libpng libpng-devel gd gd-devel zlib zlib-devel libmcrypt libmcrypt-devel libxml2-devel yum -y install curl curl-devel yum install -y libxml2-devel openssl-devel bzip2-devel libjpeg-devel libpng-devel freetype-devel libmcrypt-devel 2.下载php7安装包,解压后进入目录 ./configure --prefix=/usr/local/php7 --exec-prefix=/usr/local/php7 --bindir=/usr/local/php7/bin --sbindir=/usr/local/php7/sbin --includedir=/usr/local/php7/include --libdir=/usr/local/php7/lib/php --mandir=/usr/local/php7/php/man --with-config-file-path=/usr/local/php7/etc --with-mysql-sock=/var/run/mysql/mysql.sock --with-mcrypt=/usr/include --with-mhash --with-openssl --with-mysqli=shared,mysqlnd --with-pdo-mysql=shared,mysqlnd --with-gd --with-iconv --with-zlib --enable-zip --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-mbregex --enable-mbstring --enable-ftp --enable-gd-native-ttf --enable-pcntl --enable-sockets --with-xmlrpc --enable-soap --without-pear --with-gettext --enable-session --with-curl --with-jpeg-dir --with-freetype-dir --enable-opcache --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx --without-gdbm --disable-fileinfo --with-libxml-dir --enable-sysvmsg --enable-sysvshm 3.make clean && make && make install 4.配置 cp php.ini-production /usr/local/php7/etc/php.ini cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm7 cp sapi/fpm/php-fpm.conf /usr/local/php7/etc/php-fpm.conf cp sapi/fpm/www.conf /usr/local/php7/etc/php-fpm.d/www.conf sed -i 's#short_open_tag = Off#short_open_tag = On#g' /usr/local/php7/etc/php.ini chmod +x /etc/init.d/php-fpm7 5.加php-fpm管理器到systemctl中 vi /usr/lib/systemd/system/php-fpm7.service [Unit] Description=The PHP FastCGI Process Manager After=syslog.target network.target [Service] Type=simple PIDFile=/run/php-fpm.pid ExecStart=/usr/local/php7/sbin/php-fpm --nodaemonize --fpm-config /usr/local/php7/etc/php-fpm.conf ExecReload=/bin/kill -USR2 $MAINPID ExecStop=/bin/kill -SIGINT $MAINPID [Install] WantedBy=multi-user.target //把php7加入到环境变量,可选 echo -e '\nexport PATH=/usr/local/php7/bin:/usr/local/php7/sbin:$PATH\n' >> /etc/profile && source /etc/profile mv /etc/php.ini /etc/php.ini.bak //下载mysql.so 到 /usr/lib64/php/modules/ systemctl start php-fpm7 systemctl enable php-fpm7 wget http://pear.php.net/go-pear.phar php go-pear.phar
开启opcache提示php性能
php.ini
zend_extension=opcache.so
; 开关打开 opcache.enable=1 ; 可用内存, 酌情而定, 单位 megabytes opcache.memory_consumption=256 ; 对多缓存文件限制, 命中率不到 100% 的话, 可以试着提高这个值 opcache.max_accelerated_files=5000 ; Opcache 会在一定时间内去检查文件的修改时间, 这里设置检查的时间周期, 默认为 2, 定位为秒 opcache.revalidate_freq=240
; 打开快速关闭, 打开这个在PHP Request Shutdown的时候回收内存的速度会提高
opcache.fast_shutdown=1
开启 Hugepage提升性能
sudo sysctl vm.nr_hugepages=128
cat /proc/meminfo | grep Huge
暂无测试
扫描二维码关注程序员爱笔记,接收更多资讯

上一篇: andrid studio 常用快捷键
下一篇: activemq安装(linux)
随机推荐
评论
快速评论