yum install gcc gcc-c++ libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel curl curl-devel openssl openssl-devel libzip libzip-devel libwebp libwebp-devel
[root@wadeyu php-7.3.4]# ./configure --prefix=/usr/local/php7.3 --with-config-file-path=/usr/local/php7.3/etc --with-mysqli=mysqlnd --with-iconv-dir=/usr --with-gd --with-freetype-dir=/usr --with-jpeg-dir=/usr --with-png-dir=/usr --with-webp-dir=/usr --with-zlib --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-mbregex --enable-fpm --enable-mbstring --with-openssl --with-mhash --enable-pcntl --enable-sockets --enable-soap --without-pear --with-libzip=/usr/local --with-bz2 --enable-calendar --enable-ftp --enable-ctype --enable-exif --disable-ipv6 --with-sqlite3 --enable-pdo --with-pdo-mysql=mysqlnd --enable-phar --with-curl --with-tsrm-pthreads
[root@wadeyu php-7.3.4]# make && make install
;设置php允许操作的目录,多用户共享环境需要设置
open_basedir=
;禁用不安全的函数,多个使用,分隔
disable_functions=
;禁用不安全的类,多个使用,分隔
disable_classes=
;web header是否添加php版本信息,默认是开启
expose_php = On
;脚本执行超时时间,单位秒
max_execution_time = 30
;脚本解析请求数据的超时时间,单位秒
max_input_time = 60
;脚本可使用的最大的内存资源
memory_limit = 128M
;;
;;
;设置错误报告的级别,生产环境默认除了E_DEPRECATED,E_STRICT,其它都包含
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
;php是否可以输出错误,生产环境要关闭
display_errors = Off
;是否输出php启动时的错误,生产环境要关闭
display_startup_errors = Off
;是否开启记录错误日志
log_errors = On
;错误信息是否添加html标签,默认是开启
html_errors = On
;指定报错日志存放的地方,默认未设置
error_log =
;;
;;
;post方式php可接收的最大数据量
post_max_size = 8M
;;
;;
;允许上传的单个文件大小
upload_max_filesize = 2M
;;
;;
;是否允许远程打开文件
allow_url_fopen = On
;是否允许包含远程文件,线上要关闭,有安全风险
allow_url_include = Off
;socket流默认超时时间,单位秒
default_socket_timeout = 60
;;
;;
;session相关配置,存储支持files, redis, 还可以自定义存储引擎
;session cookie相关配置
;;
;;
;opcache字节码缓存相关的设置
原文:https://www.cnblogs.com/wadeyu/p/10707169.html