项目运行过程中,可能需要额外的扩展支持,这时我们不可避免要去安装动态扩展
bash
tar -xzf apcu-5.1.28.tgz
tar -xzf xdebug-3.5.0.tgz
tar -xzf redis-6.3.0.tgzini
; path /server/php/85/lib/php.ini
extension=apcu
;zend_extension=opcache
;部署环境请关闭 xdebug
zend_extension=xdebug
[xdebug]
;部署环境请关闭 xdebug
; xdebug.mode=off
;xdebug.mode=develop,coverage,debug,gcstats,profile,trace
xdebug.mode=develop,debug,trace
xdebug.client_host=127.0.0.1
; xdebug.client_host=192.168.66.254
xdebug.client_port=9085
[apcu]
; 手册里写的默认开启,实测情况如下:
; apcu-5.1.27 版本默认禁用
; apcu-5.1.28 版本默认启用
apcu.enabled=1
; 为 CLI 版本的PHP启用APC,主要用于测试和调试
apc.enable_cli=1
; 开发环境配置
apcu.shm_size=64M
apcu.stat=1 ; 开发时开启文件检查
apcu.ttl=300 ; 短时间缓存,便于调试
; 生产环境配置
; apcu.shm_size=256M
; apcu.stat=0 ; 关闭状态检查提升性能
; apcu.ttl=7200 ; 长时间缓存
; apcu.slam_defense=1 ; 防止缓存击穿bash
# 测试加入环境变量的 PHP 版本的扩展
php --ri xdebug
php --ri apcu
# 测试指定PHP版本的扩展
/server/php/85/bin/php --ri xdebug
/server/php/85/bin/php --ri apcu1. xdebug 扩展
bash
cd /home/php-fpm/php_ext/xdebug-3.5.0
/server/php/85/bin/phpize
./configure --with-php-config=/server/php/85/bin/php-config
make -j4 > make.log
make install2. apcu 扩展
bash
cd /home/php-fpm/php_ext/apcu-5.1.28
/server/php/85/bin/phpize
./configure --with-php-config=/server/php/85/bin/php-config
make -j4 > make.log
make test
make installini
[apcu]
; 手册里写的默认开启,实测情况如下:
; apcu-5.1.27 版本默认禁用
; apcu-5.1.28 版本默认启用
apcu.enabled=1
; 为 CLI 版本的PHP启用APC,主要用于测试和调试
apc.enable_cli=1
; 开发环境配置
apcu.shm_size=64M
apcu.stat=1 ; 开发时开启文件检查
apcu.ttl=300 ; 短时间缓存,便于调试
; 生产环境配置
; apcu.shm_size=256M
; apcu.stat=0 ; 关闭状态检查提升性能
; apcu.ttl=7200 ; 长时间缓存
; apcu.slam_defense=1 ; 防止缓存击穿3. redis 扩展
bash
cd /home/php-fpm/php_ext/redis-6.3.0
/server/php/85/bin/phpize
./configure --with-php-config=/server/php/85/bin/php-config
make -j4 > make.log
make test
make install说明
yaml 格式的配置文件性能并没有 php 格式的配置文件好,所以这里就不考虑安装 yaml 库了
