Questions tagged [pathinfo]
85 questions
40
votes
2 answers
What exactly is PATH_INFO in PHP?
all external URLs look like 'module/action?key1=param1'. No customization possible--but it's fast.
The difference is that the first uses PHP's GET, and the second uses PATH_INFO.
I've seen PATH_INFO several times, but still don't know what…

user198729
- 61,774
- 108
- 250
- 348
38
votes
7 answers
Make PHP pathinfo() return the correct filename if the filename is UTF-8
When using PHP's pathinfo() function on a filename known to be UTF-8, it does not return the correct value, unless there are 'normal' characters in front of the special character.
Examples:
pathinfo('aä.pdf')returns:
Array
(
[dirname] => [the…

Zsub
- 1,799
- 2
- 15
- 28
8
votes
6 answers
Portable and safe way to get PATH_INFO
I'm seeking a portable way to receive the (handy) $_SERVER['PATH_INFO'] variable.
After reading a while, it turns out PATH_INFO is originated from CGI/1.1, and my not always be present in all configuration.
What is the best (mostly security-wise)…

LiraNuna
- 64,916
- 15
- 117
- 140
7
votes
1 answer
PHP basename() and pathinfo() with Multibytes UTF-8 file names
I've found that PHP function basename(), as well as pathinfo() have a strange behaviour with multibyte utf-8 names.
They remove all non-Latin characters until the first Latin character or punctuation sign. However, after that, subsequent non-Latin…

Demis Palma ツ
- 7,669
- 1
- 23
- 28
7
votes
5 answers
pathinfo vs fnmatch
There was a small debate regarding the speed of fnmatch over pathinfo here : how to check if file is php?
I wasn't totally convinced so decided to benchmark the two functions.
Using dynamic and static paths showed that pathinfo was faster.
Is my…

zaf
- 22,776
- 12
- 65
- 95
6
votes
7 answers
What's the difference between /123 and /?123?
I've noticed that some sites (including the old http://careers.stackoverflow.com 1.0) have query strings that look like this:
http://somewebapp.example/?123
as compared to:
http://somewebapp.example/123 or http://somewebapp.example/id/123
What are…

BoltClock
- 700,868
- 160
- 1,392
- 1,356
6
votes
4 answers
How reliable are URIs like /index.php/seo_path
I noticed, that sometimes (especially where mod_rewrite is not available) this path scheme is used:
http://host/path/index.php/clean_url_here
--------------------------^
This seems to work, at least in Apache, where index.php is called, and one can…

Boldewyn
- 81,211
- 44
- 156
- 212
5
votes
3 answers
How to get IIS6 to recognize pathinfo routes instead of returning "404 Undescribed" error?
I am developing a RESTful web application in PHP. What I have got is:
on the test server, Windows 7 / Apache 2.2 / PHP 5.2.9 (mod_php)
on the production server, Windows Server 2003 / IIS6 / PHP 5.2.4 (php5isapi.dll)
While the test environment has…

Paolo Stefan
- 10,112
- 5
- 45
- 64
4
votes
3 answers
php $SERVER['PATH_INFO'] and apache mod_rewrite
Here I have .htaccess file with:
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [QSA,L]
And rewriting works but there is no path_info in my…

John Smith
- 51
- 1
- 4
4
votes
1 answer
PHP get image extension from url?
Image url like below.
$url = https://lh3.googleusercontent.com/-4T303dPCnp0ZnkzQjSIjeB7k8L_DiQglhUgNqXM-OkeLQXoNwwFnzM1MoFjJGw7DGI=w300
How to get extension from this url.
I m using pathinfo to get extension but it's not work
$ext =…

Mokariya Sanjay
- 194
- 3
- 13
4
votes
1 answer
Traefik(+Docker) path settings for root and subfolders dispatch
With making reverse proxy on Docker and Traefik, I want to dispatch several paths on the same host into two different backend servers like these,
1. traefik.test/ -> app1/
2. traefik.test/post/blabla -> app1/post/blabla
3.…

akky
- 2,818
- 21
- 31
4
votes
1 answer
PHP - Using pathinfo variables makes relative paths not to work
I am hoping to achieve some kind of cms on my own. I see i can catch Apache enviromental variables, known as PATH_INFO, so this way i can make dynamic sections on my site (just like joomla does).
for…

Gerardo Peña Pérez
- 63
- 4
4
votes
1 answer
PHP pathinfo gets fooled by url in query string, any workaround?
I am working on a small function to take in a url and return a relative path based on where it resides itself.
If the url contains a path in the query string, pathinfo returns incorrect results. This is demonstrated by the code below:
$p =…

Majid Fouladpour
- 29,356
- 21
- 76
- 127
4
votes
3 answers
Problem using unicode in URLs with cgi.PATH_INFO in ColdFusion
My ColdFusion (MX7 on IIS 6) site has search functionality which appends the search term to the URL e.g. http://www.example.com/search.cfm/searchterm.
The problem I'm running into is this is a multilingual site, so the search term may be in another…

Loftx
- 1,760
- 4
- 29
- 50
3
votes
6 answers
How can a URL like http://localhost/index.php/articles/edit/1/my-first-article work without an .htaccess?
I don't get this:
http://localhost/index.php/articles/edit/1/my-first-article
This URL is mentioned as an example in the Kohana framework documentation. I poked around in the files of my installation, and there is no .htaccess besides my own one…

Thanks
- 40,109
- 71
- 208
- 322