x
 
Create New Page
 View Previous Changes    ( Last updated by Lisa Wess )

Path Info

Question:

How can I test to see if path_info is enabled on my server?

Answer:

1. Create a new file in your main directory. Name it path_test.php

2. In the file, place this code:

<?php

// Show the filename, just so you know stuff is outputting right
echo "Filename -->" . $_SERVER['SCRIPT_NAME'] . "<--<br />";

// Show the "path info" that comes after the filename in the URL
echo "Path Info -->" .$_SERVER['PATH_INFO'] . "<--";

?>

3. In your browser, go visit the new file (e.g. http://www.example.com/path_test.php). You should see output something like this:

Filename -->/path_test.php<--
Path Info --><--

4. Now access the same file with extra “path info” data on the end (e.g. http://www.example.com/path_test.php/myextrapath/). It should output this:

Filename -->/path_test.php<--
Path Info -->/myextrapath/<--

Thread

Category:Troubleshooting

Categories: