Previous Thread
Next Thread
Print Thread
Hop To
Joined: Jul 2007
Posts: 103
member
member
Joined: Jul 2007
Posts: 103
When migrating my box to the newest version of php, I noticed that friendly URL's are no longer working when I enabled them.

Looking through several sites and forum, i've found out that a setting in php.ini can fix this. BUT it appears that it is a bug in PHP that is being used by UBB, which should be.

The quick fix is to edit the php.ini of your site, and set:
cgi.fix_pathinfo=0
(disabling the original fix)

The comment in this settings tells it all:

; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI. PHP's
; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok
; what PATH_INFO is. For more information on PATH_INFO, see the cgi specs. Setting
; this to 1 will cause PHP CGI to fix it's paths to conform to the spec. A setting
; of zero causes PHP to behave as before. Default is zero. You should fix your scripts
; to use SCRIPT_FILENAME rather than PATH_TRANSLATED.
cgi.fix_pathinfo=0


So UBB, please change your code the way it is supposed to be wink.

Joined: Jun 2006
Posts: 16,292
Likes: 116
UBB.threads Developer
UBB.threads Developer
Joined: Jun 2006
Posts: 16,292
Likes: 116
I think Path_info_translated was a fix that rarely occoured that path_info wouldn't populate; seems we need to take that a step further with another if/else clause to work of of script_filename as well...


I am a Web Development Contractor, I do not work for UBBCentral. I have provided free User to User Support since the beginning of these support forums.
Do you need Forum Install or Upgrade Services?
Forums: A Gardeners Forum, Scouters World
UBB.threads: UBBWiki, UBB Styles, UBB.Sitemaps
Longtime Supporter & Resident Post-A-Holic
VNC Web Services: Code Modifications, Upgrades, Styling, Coding Services, Disaster Recovery, and more!
Joined: Jul 2007
Posts: 103
member
member
Joined: Jul 2007
Posts: 103
I guess your right. BTW Is this fixed in the newest ubb release?

Joined: Jun 2006
Posts: 16,292
Likes: 116
UBB.threads Developer
UBB.threads Developer
Joined: Jun 2006
Posts: 16,292
Likes: 116
doubt it, as the translated check was only added in 7.2... You'd have to likely wait for Rick to update the topic when he fixes it


I am a Web Development Contractor, I do not work for UBBCentral. I have provided free User to User Support since the beginning of these support forums.
Do you need Forum Install or Upgrade Services?
Forums: A Gardeners Forum, Scouters World
UBB.threads: UBBWiki, UBB Styles, UBB.Sitemaps
Longtime Supporter & Resident Post-A-Holic
VNC Web Services: Code Modifications, Upgrades, Styling, Coding Services, Disaster Recovery, and more!
Joined: Jun 2006
Posts: 9,242
Likes: 1
R
Former Developer
Former Developer
R Offline
Joined: Jun 2006
Posts: 9,242
Likes: 1
I'm looking on a proper solution for this with the variety of way we parse all of the data. Not sure if this will get into 7.3.2, but we'll see.

Joined: Dec 2003
Posts: 1,796
Pooh-Bah
Pooh-Bah
Joined: Dec 2003
Posts: 1,796
Yay smile I have a client's site that's having a bit of an issue with it (snakebit with about every aspect of his site smile )


- Allen
- ThreadsDev | PraiseCafe
Joined: Jun 2006
Posts: 9,242
Likes: 1
R
Former Developer
Former Developer
R Offline
Joined: Jun 2006
Posts: 9,242
Likes: 1
Well, the problem is that SCRIPT_FILENAME just contains the path to the script, it doesn't contain anything after it.

So, something like this:

https://www.ubbcentral.com/forums/ubbthreads.php/ubb/showflat/Number/216111

SCRIPT_FILENAME only contains:

https://www.ubbcentral.com/forums/ubbthreads.php/ubb/showflat

It chops off the actual data that we need to know what topic to show.

Joined: Dec 2003
Posts: 1,796
Pooh-Bah
Pooh-Bah
Joined: Dec 2003
Posts: 1,796
That's something like what I'm seeing now, it cuts off after ubbthreads.php?


- Allen
- ThreadsDev | PraiseCafe
Joined: Jun 2006
Posts: 16,292
Likes: 116
UBB.threads Developer
UBB.threads Developer
Joined: Jun 2006
Posts: 16,292
Likes: 116
sounds like path_info just isn't being populated


I am a Web Development Contractor, I do not work for UBBCentral. I have provided free User to User Support since the beginning of these support forums.
Do you need Forum Install or Upgrade Services?
Forums: A Gardeners Forum, Scouters World
UBB.threads: UBBWiki, UBB Styles, UBB.Sitemaps
Longtime Supporter & Resident Post-A-Holic
VNC Web Services: Code Modifications, Upgrades, Styling, Coding Services, Disaster Recovery, and more!
Joined: Jul 2007
Posts: 103
member
member
Joined: Jul 2007
Posts: 103
Originally Posted by Rick
Well, the problem is that SCRIPT_FILENAME just contains the path to the script, it doesn't contain anything after it.

So, something like this:

https://www.ubbcentral.com/forums/ubbthreads.php/ubb/showflat/Number/216111

SCRIPT_FILENAME only contains:

https://www.ubbcentral.com/forums/ubbthreads.php/ubb/showflat

It chops off the actual data that we need to know what topic to show.

Did you check the apache settings? Looking at the PHP documentation:
http://www.php.net/manual/en/reserved.variables.server.php
'PATH_TRANSLATED'
Filesystem- (not document root-) based path to the current script, after the server has done any virtual-to-real mapping.

Note: As of PHP 4.3.2, PATH_TRANSLATED is no longer set implicitly under the Apache 2 SAPI in contrast to the situation in Apache 1, where it's set to the same value as the SCRIPT_FILENAME server variable when it's not populated by Apache. This change was made to comply with the CGI specification that PATH_TRANSLATED should only exist if PATH_INFO is defined.
Apache 2 users may use AcceptPathInfo = On inside httpd.conf to define PATH_INFO.

also this is found for php5:
http://www.php.net/manual/en/migration5.incompatible.php
PATH_TRANSLATED server variable is no longer set implicitly under Apache2 SAPI in contrast to the situation in PHP 4, where it is set to the same value as the SCRIPT_FILENAME server variable when it is not populated by Apache. This change was made to comply with the » CGI specification. Please refer to » bug #23610 for further information, and see also the $_SERVER['PATH_TRANSLATED'] description in the manual. This issue also affects PHP versions >= 4.3.2.

Also a non elegant workaround is:
if (!defined(’MAIN_EXEC_DIR’)) define(’MAIN_EXEC_DIR’, dirname(__FILE__));

Then MAIN_EXEC_DIR would always contain the information you are looking for. Certainly, it’s a pain to have to put this in every file, though.


I think the code that finds out the path should become a little smarter to use different ways to find out what the complete URL is.


Link Copied to Clipboard
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Recent Topics
spam issues
by ECNet - 03/19/2024 11:45 PM
Looking for a forum
by azr - 03/15/2024 11:26 PM
Editing Links in Post
by Outdoorking - 03/15/2024 9:31 AM
Question on barkrowler and the like
by Mors - 02/29/2024 6:51 PM
Member Permissions Help
by domspeak - 02/27/2024 6:31 PM
Who's Online Now
1 members (Havenofsobriety), 458 guests, and 91 robots.
Key: Admin, Global Mod, Mod
Random Gallery Image
Latest Gallery Images
Los Angeles
Los Angeles
by isaac, August 6
3D Creations
3D Creations
by JAISP, December 30
Artistic structures
Artistic structures
by isaac, August 29
Stones
Stones
by isaac, August 19
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20230217)