Previous Thread
Next Thread
Print Thread
Hop To
Joined: Jul 2007
Posts: 103
nims2 Offline OP
member
OP Offline
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: 15,975
Likes: 40
UBB.threads Developer
Online Tapedshut
UBB.threads Developer
Joined: Jun 2006
Posts: 15,975
Likes: 40
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
nims2 Offline OP
member
OP Offline
member
Joined: Jul 2007
Posts: 103
I guess your right. BTW Is this fixed in the newest ubb release?

Joined: Jun 2006
Posts: 15,975
Likes: 40
UBB.threads Developer
Online Tapedshut
UBB.threads Developer
Joined: Jun 2006
Posts: 15,975
Likes: 40
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
Former Developer
Offline
Former Developer
Joined: Jun 2006
Posts: 9,242
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
Offline
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
Former Developer
Offline
Former Developer
Joined: Jun 2006
Posts: 9,242
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
Offline
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: 15,975
Likes: 40
UBB.threads Developer
Online Tapedshut
UBB.threads Developer
Joined: Jun 2006
Posts: 15,975
Likes: 40
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
nims2 Offline OP
member
OP Offline
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 Box
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Recent Topics
Individual Post Count Adjustments?
by FREAK - 09/25/2020 11:17 PM
Like unlike bug?
by Morgan - 09/24/2020 5:03 PM
looking to renew :)
by Mors - 09/23/2020 7:52 PM
test
by Mors - 09/23/2020 7:51 PM
What triggers page view numbers
by Morgan - 09/21/2020 10:31 AM
Who's Online Now
4 members (Gizmo, Mors, Ruben, 1 invisible), 74 guests, and 57 robots.
Key: Admin, Global Mod, Mod
Random Gallery Image
Latest Gallery Images
gallery test
gallery test
by Mors, September 23
Los Angeles
Los Angeles
by isaac, August 6
3D Creations
3D Creations
by JAISP, December 30
Artistic structures
Artistic structures
by isaac, August 29
Powered by UBB.threads™ PHP Forum Software 7.7.5
(Snapshot build 20200925)