centos7-install-php7.3.5

2019-05-13

PHP 7.3声称速度比PHP 5快3倍还多。PHP 7.3比PHP 7.0快25%

1、WordPress has detected that your site is running on an insecure version of PHP.

2、根据最新的W3techs统计,目前PHP 7大概占了超过16.6%的PHP份额。 总体上PHP仍然拥有大约83%的网站服务器端开发语言的绝大多数比例。
根据PHP开发支持周期,到今年12月31日后,PHP 5.6不在有官方支持。

3、php7cc:一个PHP 兼容行检查工具,不过目前已经不再更新了。

4、GCC 4.8编译器下编译时PHP才能开启Global Register for opline and execute_data支持, 这个会带来5%左右的性能提升。

5、开启PGO,PHP是专门为一个项目服务,比如一个 WordPress或者drupal站点,就可以使用PGO提高性能

6、禁止mysqlnd.collect_statistics

mysqlnd.collect_statistics = Off

mysqlnd.collect_memory_statistics = Off

线上服务器选择禁止这两个选项,可以减少不必要的数据库访问。如果需要相关统计,可以使用MySQL工具或者监控。

7、设置合适的realpath_cache_size

通过设置合宜的realpath_cache_size值可以改善你服务器的并发:

realpath_cache_size = 256k

realpath_cache_ttl = 300

8、yum安装依赖包

yum -y install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel \
libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel \
readline readline-devel libxslt libxslt-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel \
ncurses curl gdbm-devel db4-devel libXpm-devel libX11-devel gd-devel gmp-devel expat-devel
xmlrpc-c xmlrpc-c-devel libicu-devel libmcrypt-devel libmemcached-devel libzip

yum -y install curl curl-devel

9、wget http://php.net/distributions/php-7.3.5.tar.gz
tar -zxvf php-7.3.5.tar.gz
cd php-7.3.5

./configure \
--prefix=/usr/local/php \
--with-config-file-path=/usr/local/php/etc \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-iconv-dir \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--with-libxml-dir \
--with-curl \
--with-gd \
--with-xmlrpc \
--with-openssl \
--with-mhash \
--enable-zip \
--enable-fpm \
--enable-xml \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--enable-mbregex \
--enable-fpm \
--enable-mbstring \
--enable-pcntl \
--enable-sockets \
--enable-soap \
--disable-rpath \
--without-pear

10、#make && #make install

11、编译过程中遇到的错误
configure: error: off_t undefined; check your library configuration
vim /etc/ld.so.conf
#添加如下几行
/usr/local/lib64
/usr/local/lib
/usr/lib
/usr/lib64
#保存退出
:wq
ldconfig -v # 使之生效

virtual memory exhausted: Cannot allocate memory
make: *** [ext/fileinfo/libmagic/apprentice.lo] Error 1

dd if=/dev/zero of=/opt/swapfile  bs=1024 count=4777216
mkswap /opt/swapfile
swapon /opt/swapfile
swap -s
swapoff /opt/swapfile

12、/usr/local/include/zip.h:59:10: fatal error: zipconf.h: No such file or directory
#include <zipconf.h>
cp /usr/local/lib/libzip/include/zipconf.h /usr/local/include/zipconf.h
make从zip.o会继续

13、编译安装后,cd php-7.3.5

find . -name "*php-fpm*"

./sapi/fpm/init.d.php-fpm
./sapi/fpm/php-fpm.conf
./sapi/fpm/php-fpm.service
./sapi/fpm/php-fpm

find . -name "php.ini*"
./php.ini-production
./php.ini-development

cp ./sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm

cp ./sapi/fpm/php-fpm.service /usr/lib/systemd/system/php-fpm.service

cp ./php.ini-production /usr/local/php/etc/php.ini

cp ./sapi/fpm/php-fpm.conf /usr/local/php/etc/php-fpm.conf

14、启动php-fpm

/etc/init.d/php-fpm start

netstat -ntlp

 

分类:Linux | 标签: |

相关日志

评论被关闭!