nginx / fpm和PHP_VALUE不工作

我想改变我的Web服务器的单个网站的一些php.ini值:

fastcgi_param PHP_VALUE "auto_prepend_file=/var/www/profile/external/header.php \n auto_append_file=/var/www/profile/external/footer.php"; 

但FPM完全忽略了这个值。

我试图在vhostconfiguration之上或者位置〜* .php $ {指令下添加这行,但是没有任何作用

这是我在nginx下的虚拟主机configuration:

 server { listen 80; index index.php index.html; server_name myvisit; root /var/www/mv/head/myvisit/; access_log /var/log/nginx/myvisit-access.log; error_log /var/log/nginx/myvisit-error.log; fastcgi_param PHP_VALUE "auto_prepend_file=/var/www/profile/external/header.php \n auto_append_file=/var/www/profile/external/footer.php"; # Use gzip compression # gzip_static on; # Uncomment if you compiled Nginx using --with-http_gzip_static_module gzip on; gzip_disable "msie6"; gzip_vary on; gzip_proxied any; gzip_comp_level 5; gzip_buffers 16 8k; gzip_http_version 1.0; gzip_types text/plain text/css application/json application/x-javascript text/xml application/$ # error pages error_page 500 502 503 504 /50x.html; location = /50x.html { root /var/www; } # Deny access to hidden files location ~* /\.ht { deny all; access_log off; log_not_found off; } location / { try_files $uri $uri/ /index.php?$args; } location ~* /myvisitv3[-_](.*)\.(?:html|php) { try_files $uri $uri/ /myvisitv3.php?libAdresse=$1&$args; } location ~* /favicon.(?:ico|png|bmp|jpg)$ { try_files $uri $uri/ /web/img/favicon.ico; } # Pass PHP scripts on to PHP-FPM include global/php-fpm.conf; location ~* \.php$ { include /etc/nginx/fastcgi_params; try_files $uri /index.php; fastcgi_index index.php; fastcgi_pass php5-fpm-sock; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_param PHP_VALUE "auto_prepend_file=/var/www/profile/external/header.php \n auto_append_file=/var/www/profile/external/footer.php"; } } 

它不适用于所有的Linux发行版。 有关详细信息,请参阅关于PHP错误#51595的评论

它适用于我,但只在位置上下文中。 在服务器上下文中,它的工作原理与预期的不同。 在nginx论坛讨论: 服务器上下文中的fastcgi_param不起作用 。