G2 + Roxen + PHP as CGI == broken links
WBTMagnum
Joined: 2005-08-30
Posts: 3 |
Posted: Tue, 2005-08-30 13:46 |
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, ---- |
|
Posts: 8601
can you post a link to phpinfo?
we need to know what $_SERVER variables tell us the base url to use for this webserver.. if you just want to fix your site you can edit modules/core/classes/GalleryUrlGenerator.class, function getCurrentRequestUri()
Posts: 3
here's the link to the phpinfo:
http://gallery.wienfluss.net/phpinfo.php
if you need more information, just ask.
thanks for the tipp with GalleryUrlGenerator.class. i added the following line marked with (+)
now G2 works like a charm.
thanks a lot,
sascha
Posts: 8601
Can you try this patch instead and let us know if it also works?
(in this diff format lines with - are removed and lines with + are added)
Posts: 3
hi,
i applied your patch - works great.
thanks a lot for the fast support.
regards,
sascha
Posts: 11
mindless, is the gole of your script to detect the ".php" in gallery2/main.php or the "/php" in "/cgi-bin/php/"?
All my tests show that substr($path, -4) finds ".php" at the end of main.php. Your compare statement is looking for "/php".
The reason I ask is that I have a similar problem to WBTMagnum, I'm using redirects from roxen's redirect module.
However instead of using "/cgi-bin/php/" as my redirect binary I'm using "/cgi-bin/php-orcas" so I need to modify your script accordingly.
I've been able to get WBTMagnum script to work with $path = str_replace("/cgi-bin/php-orcas/","/",$path); but I haven't been able to modify your patch so that it works. Unfortunately I'm not an expert at php, only a beginner.
Posts: 8601
the latter, it is checking for a path to the php binary.
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.
Thanks for the clarification mindless.