G2 + Roxen + PHP as CGI == broken links
WBTMagnum
Joined: 2005-08-30
Posts: 3 |
![]() |
hi there, i am using roxen webserver while running PHP as CGI. the installation for G2 worked like a charm. i can also access the installation, but when i try to access any of the links provided on this page i end up with broken links. E.g. the links are rewritten to: http://tools.wienfluss.net/cgi-bin/php/gallery2/... the part "/cgi-bin/php/" stems from the fact that i have to redirect the http request to the PHP binary - that's how roxen runs PHP scripts. from my point of view, the simpliest solution would be to use relative paths for the links. is there any way to force G2 to use relative paths? the "trick" mentioned in this forum post (FAQ Gallery:c.22) didn't work for me. G2 was still using absolute links. is there any other way or do i have to stick with G1? thanks in advance for your help/comments, ---- |
|
mindless
![]()
Joined: 2004-01-04
Posts: 8601 |
![]() |
can you post a link to phpinfo? |
|
WBTMagnum
Joined: 2005-08-30
Posts: 3 |
![]() |
here's the link to the phpinfo: if you need more information, just ask. thanks for the tipp with GalleryUrlGenerator.class. i added the following line marked with (+) } (+)$path = str_replace("/cgi-bin/php/","/",$path); return GalleryUtilities::htmlEntityDecode($path); now G2 works like a charm. thanks a lot, |
|
mindless
![]()
Joined: 2004-01-04
Posts: 8601 |
![]() |
Can you try this patch instead and let us know if it also works? Index: modules/core/classes/GalleryUrlGenerator.class =================================================================== RCS file: /cvsroot/gallery/gallery2/modules/core/classes/GalleryUrlGenerator.class,v retrieving revision 1.88 diff -u -r1.88 GalleryUrlGenerator.class --- modules/core/classes/GalleryUrlGenerator.class 23 Aug 2005 03:49:03 -0000 1.88 +++ modules/core/classes/GalleryUrlGenerator.class 30 Aug 2005 21:50:06 -0000 @@ -138,7 +138,12 @@ if (!($path = GalleryUtilities::getServerVar('REQUEST_URI')) && ($path = GalleryUtilities::getServerVar('SCRIPT_NAME'))) { if (($tmp = GalleryUtilities::getServerVar('PATH_INFO')) && $tmp != $path) { - $path .= $tmp; + if (substr($path, -4) == '/php') { + /* Roxen php-cgi has php itself in SCRIPT_NAME and uri in PATH_INFO */ + $path = $tmp; + } else { + $path .= $tmp; + } } if ($tmp = GalleryUtilities::getServerVar('QUERY_STRING')) { $path .= '?' . $tmp; (in this diff format lines with - are removed and lines with + are added) |
|
WBTMagnum
Joined: 2005-08-30
Posts: 3 |
![]() |
mindless wrote:
Can you try this patch instead and let us know if it also works? hi, i applied your patch - works great. thanks a lot for the fast support. regards, |
|
ephantom
Joined: 2004-06-29
Posts: 11 |
![]() |
mindless, is the gole of your script to detect the ".php" in gallery2/main.php or the "/php" in "/cgi-bin/php/"? |
|
mindless
![]()
Joined: 2004-01-04
Posts: 8601 |
![]() |
the latter, it is checking for a path to the php binary. |
|
ephantom
Joined: 2004-06-29
Posts: 11 |
![]() |
The below modification works for my scripts. Assuming the redirect always starts with "/cgi-bin/php" the following fix should work for WBTMagnum redirects too. /* Fix for Roxen php redirects. Assumes roxen redirect path starts with /cgi-bin/php */ /* finds a group of 4 characters 9 characters into the $path string */ if (substr($path, 8, 4) == '/php') { Thanks for the clarification mindless. |
|