Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

$_SERVER['PATH_INFO'] on localhost

Tags:

php

I'm getting the following error when I use $_SERVER['PATH_INFO'] on my localhost:

Notice: Undefined index: PATH_INFO

I'm using WAMP. Can someone tell me why this is happening?

like image 832
Paul Dessert Avatar asked Nov 28 '22 22:11

Paul Dessert


1 Answers

PATH_INFO isn't always set. It is only set if there was trailing path info after the script.

For example if you have a file located here: localhost/index.php And you access it via this url: localhost/index.php/foo/bar

then $_SERVER['PATH_INFO'] will be set to a value of "/foo/bar"

but if you access the script via the url: localhost/index.php then PATH_INFO will not be set and you will see a notice like that for attempting to access an undefined index of an array

like image 139
Brian Avatar answered Dec 07 '22 02:12

Brian