$_SERVER['PATH_INFO'] + Nginx - Debian 10

Par Niko32, il y a 5 ans


Bonjour,

Malgrè plusieur lecture sur diffèrent forum a ce sujet j'ai toujours un $path_info always empty .....?

Voici mon post sur plus detailler sur stackoverflow sur mes références:
https://stackoverflow.com/questions/65330133/nginx-phpfpm-debian-10-path-info-is-always-empty

Comment faire pour activer le PATH_INFO sur Nginx ?

Je ne sais plus ou chercher, et je tape dans le mur pour une première fois......

Voici ma configuration
https://www.grafikart.fr/forum/topics/2428

# php/7.3/fpm/php.ini cgi.fix_pathinfo=1 # virtualhost location / {try_files $uri $uri/ /$uri.php$is_args$args;} location ~ \.php { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php7.3-fpm.sock } # fichier du projet php - |-index.php |-text.php #index.php var_dump($_SERVER['PATH_INFO']); echo "index.php"; #test.php var_dump($_SERVER['PATH_INFO']); echo "test.php"; #localhost/index string(0) "" index.php #localhost/test string(0) "" test.php

Fichier: snippets fastcgi-php.conf

# regex to split $uri to $fastcgi_script_name and $fastcgi_path fastcgi_split_path_info ^(.+?\.php)(/.*)$; # Check that the PHP script exists before passing it try_files $fastcgi_script_name =404; # Bypass the fact that try_files resets $fastcgi_path_info # see: http://trac.nginx.org/nginx/ticket/321 set $path_info $fastcgi_path_info; fastcgi_param PATH_INFO $path_info; # J'ai essayé fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; fastcgi_param DOCUMENT_ROOT $realpath_root; fastcgi_param HTTPS on; fastcgi_index index.php; include fastcgi.conf;

Je travaille en localhost avec du https.

2 réponses

Grafikart, il y a 5 ans

Il faudrait voir ton fichier snippets/fastcgi-php.conf car normalement cela devrait marcher.

Niko32, il y a 5 ans

Merci Grafikart,
J'ai rajouté le fichier snippets/fastcgi-php.conf dans le post....
J'ai essayé tout un tas de configuration, a part créer mon propre PATH_INFO avec du php j'ai toujours pas trouvé de solution pour Nginx.....