在 CentOS 中,PHP 的默认配置通常指的是 php.ini 的默认位置和默认参数值,下面按常见情况说明(以 CentOS 7 / 8 + 官方或 Remi PHP 为例):
/etc/php.ini
如果是 PHP-FPM(最常见):
/etc/php-fpm.conf
/etc/php-fpm.d/www.conf
如果是 多版本 PHP(Remi):
/etc/opt/remi/php74/php.ini
/etc/opt/remi/php80/php.ini
查看当前使用的 php.ini:
php --ini
以下为 CentOS 默认 php.ini(未优化) 的典型值
display_errors = Off
log_errors = On
error_log = /var/log/php_errors.log
memory_limit = 128M
max_execution_time = 30
max_input_time = 60
upload_max_filesize = 2M
post_max_size = 8M
session.save_handler = files
session.save_path = /var/lib/php/session
; date.timezone =
⚠️ 建议手动设置:
date.timezone = Asia/Shanghai
user = apache
group = apache
listen = 127.0.0.1:9000
pm = dynamic
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 35
(CentOS 8 + nginx 时可能是 nginx 用户)
/var/log/php-fpm/error.log
/var/log/httpd/error_log
/var/log/nginx/error.log
CentOS 的 PHP 默认配置:
✅ 偏安全(错误不显示)
❌ 性能一般
❌ 不适合生产高并发
❌ 上传/内存偏小
你可以告诉我:
我可以直接给你 最优 php.ini 配置示例。