nginx / fpm e PHP_VALUE não estão funcionando

2

Estou tentando alterar alguns valores de php.ini para um único site do meu servidor da Web:

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

mas o valor é totalmente ignorado pelo FPM.

Eu tentei adicionar a linha no topo da configuração do vhost ou sob a diretiva location ~ * .php $ { mas nenhum funciona

Aqui está minha configuração de vhost em nginx:

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";
  }
}
    
por kitensei 16.05.2013 / 09:52

2 respostas

1

Não funciona em todas as distribuições do Linux. Para detalhes veja os comentários em PHP bug # 51595

    
por 16.05.2013 / 10:03
0

Funciona para mim, mas apenas no contexto de localização. No contexto do servidor, funciona de forma diferente, como se poderia esperar. Discutido no fórum do nginx: fastcgi_param no contexto do servidor não funciona .

    
por 17.09.2014 / 08:17