在CentOS系统中,PHP的配置文件通常位于/etc/php.ini。这个文件包含了PHP的各种配置选项,用于控制PHP的行为和性能。以下是一些常见的PHP配置项及其简要说明:
error_reporting
error_reporting = E_ALL & ~E_NOTICEdisplay_errors
display_errors = Offlog_errors
log_errors = Onerror_log
error_log = /var/log/php_errors.logdate.timezone
date.timezone = "Asia/Shanghai"memory_limit
memory_limit = 128Mmax_execution_time
max_execution_time = 30upload_max_filesize
upload_max_filesize = 2Mpost_max_size
post_max_size = 8Mmax_input_vars
max_input_vars = 1000mysqli.default_host
mysqli.default_host = localhostmysqli.default_user
mysqli.default_user = rootmysqli.default_pw
mysqli.default_pw = passwordpdo_mysql.default_socket
pdo_mysql.default_socket = /var/lib/mysql/mysql.sockallow_url_fopen
allow_url_fopen = Offopen_basedir
open_basedir = /var/www/html/:/tmp/disable_functions
disable_functions = eval,passthru,exec,system,proc_open,popen,curl_exec,curl_multi_exec,parse_ini_file,show_sourceopcache.enable
opcache.enable = 1opcache.memory_consumption
opcache.memory_consumption = 128opcache.interned_strings_buffer
opcache.interned_strings_buffer = 8opcache.max_accelerated_files
opcache.max_accelerated_files = 4000sendmail_path
sendmail_path = /usr/sbin/sendmail -t -icgi.fix_pathinfo
cgi.fix_pathinfo = 0这些只是PHP配置文件中的一小部分配置项。根据你的具体需求和应用场景,你可能需要调整或添加更多的配置项。修改php.ini文件后,通常需要重启Web服务器(如Apache或Nginx)以使更改生效。
sudo systemctl restart httpd # 对于Apache
sudo systemctl restart nginx # 对于Nginx
希望这些信息对你有所帮助!