FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » General » PHP discussions » pathinfo problem
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
pathinfo problem [message #18120] Mon, 10 May 2004 06:42 Go to next message
esm2002 is currently offline  esm2002   United States
Messages: 339
Registered: May 2002
Location: Atlanta Georgia
Karma: 0
Senior Member
i have a php page that uses pathinfo() so I can use urls like http://www.my_site.com/lc/browse.php/cat_id/1.html.

I do a str_replace to remove the ".html" and I end up with cat_id=1. My header page has <BASE HREF="http://www.my_site.com/lc/">

The pathinfo works fine on one host using php 4.3.4 but not on one using 4.2.3. Both run on unix. When I mouseover the link, it shows http://www.my_site.com/lc/browse.php/cat_id/1.html but I still get an 404 error .

pathinfo() came in with php 4.0.

Any ideas?


Gene
"The older I get, the more I admire competence, just simple competence in any field from adultery to zoology."
Re: pathinfo problem [message #18124 is a reply to message #18120] Mon, 10 May 2004 12:53 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
It could very well be a bug in the old PHP version or misconfiguration in apache or PHP.



FUDforum Core Developer
Re: pathinfo problem [message #18131 is a reply to message #18124] Mon, 10 May 2004 21:02 Go to previous messageGo to next message
esm2002 is currently offline  esm2002   United States
Messages: 339
Registered: May 2002
Location: Atlanta Georgia
Karma: 0
Senior Member
thanks for the info... Razz

any particular misconfiguration Sad to look for?


Gene
"The older I get, the more I admire competence, just simple competence in any field from adultery to zoology."
Re: pathinfo problem [message #31412 is a reply to message #18131] Fri, 21 April 2006 09:36 Go to previous message
richardlynch is currently offline  richardlynch   United States
Messages: 8
Registered: April 2006
Karma: 0
Junior Member
Personally, I've always found the HTML BASE thing to be kinda flaky...

pathinfo() as a function may be "new" in PHP, but I'm pretty sure the data has always been there in $_SERVER.

You may want to compare the two, but that probably won't help -- But would if you needed it in older versions.

What the browser shows in the status bar on mouse-over, and what the browser decides to send you to not matching up sounds like a browser bug to me...

And it's probably caused by the BASE, not by PHP.

The first thing I would test would be to use full, complete, absolute URLs with everything from http:// all the way to .html in them.

That gives the browser no leeway to mess up.

PS I use pathinfo a TON as well, and would suggest you consider using:
/cat_id=1/category_name.html

This makes it MUCH easier to tear apart pathinfo() as you can explode on / and then on = to get your key/value pair -- plus you can add as many key/value pairs as you want and not worry about the position of them getting confusing.

You could even end up with something like:
/cat_id=1/product_id=5/subdir/category_name.html

And it's quite easy to detect the parts with no '=' and use those as a path to your internal data directory structure, while keeping the key=value parts easily.

I do this a lot.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: running both versions - php 4.3.0 and php 5 on one Apache-Server on Windows
Next Topic: Shopping Carts
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 21 10:30:38 GMT 2024

Total time taken to generate the page: 0.03809 seconds