![另一个用于域的 php.ini,其中 nginx php-fpm 在 fastcgi 中运行](https://linux22.com/image/635627/%E5%8F%A6%E4%B8%80%E4%B8%AA%E7%94%A8%E4%BA%8E%E5%9F%9F%E7%9A%84%20php.ini%EF%BC%8C%E5%85%B6%E4%B8%AD%20nginx%20php-fpm%20%E5%9C%A8%20fastcgi%20%E4%B8%AD%E8%BF%90%E8%A1%8C.png)
我使用 nginx 和 php-fpm 并使用 unix:/cls/php-fpm.socket;
我已经在 php.ini 中为整个服务器启用了 xcache
并希望为 1 个域禁用 xcache
我在 nginx 的服务器配置中这样做了
location ~ ^/.+\.php {
fastcgi_pass backend;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/user/public_html/$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param PHP_ADMIN_VALUE "open_basedir=\"/home/user/public_html/:/tmp:/usr/local/lib/php:\"
xcache.cacher=\"Off\"
xcache.size=\"0\"
xcache.stat=\"Off\"
xcache.var_size=\"0\"
include_path=\"/usr/lib/php:/usr/local/lib/php:/tmp:/home/user/public_html/\"";
include /etc/nginx/fastcgi_params;
}
这应该禁用 xcache,并且当尝试在该域上使用 phpinfo 时,它会给我 xcache 安装但 xcache.size=0 // 这意味着它已被禁用
但浏览时缓存仍然启用。不知道为什么?
我尝试为该域使用自定义 php.ini,但不知道如何在搜索后找到此 user_ini.filename=\"/etc/php/php3.ini\"(php3.ini 没有 xcache 扩展)
如何使用 nginx、php-fpm 和 fastcgi 对 1 个域使用自定义 php.ini
尝试使用它,但不起作用
答案1
有一个特殊的部分php-fpm.conf / www.conf文件,覆盖每个池的 php.ini :
; Additional php.ini defines, specific to this pool of workers. These settings
; overwrite the values previously defined in the php.ini. The directives are the
; same as the PHP SAPI:
; php_value/php_flag - you can set classic ini defines which can
; be overwritten from PHP call 'ini_set'.
; php_admin_value/php_admin_flag - these directives won't be overwritten by
; PHP call 'ini_set'
; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no.
; Defining 'extension' will load the corresponding shared extension from
; extension_dir. Defining 'disable_functions' or 'disable_classes' will not
; overwrite previously defined php.ini values, but will append the new value
; instead.
; Note: path INI options can be relative and will be expanded with the prefix
; (pool, global or /usr)
; Default Value: nothing is defined by default except the values in php.ini and
; specified at startup with the -d argument
;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f [email protected]
;php_flag[display_errors] = off
;php_admin_value[error_log] = /var/log/fpm-php.www.log
;php_admin_flag[log_errors] = on
;php_admin_value[memory_limit] = 32M