Aarg! New install troubles--possibly php cgi-force-redirect? Aarg! New install troubles--possibly php cgi-force-redirect?
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Aarg! New install troubles--possibly php cgi-force-redirect?

Started by joea, March 24, 2004, 05:32:39 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

joea

Hi,

I'm running Linux, php PHP 4.3.3RC2, Roxen web server, and mySQL.  I have a working Menalto Gallery right now on one of my sites and wanted to try out Coppermine on a friend's site, but am running into some problems.  

install.php seems to work just fine.  It creates the database, user account and all, congratulates me, and I see the link to configure the site to my liking.  When I submit config.php however, the server redirects me to http://www.mydomain.com/cgi-bin/php with an error that page cannot be displayed.

Strangely, the first time I did it I got an error saying something about cgi-force-redirect prohibiting the action but haven't gotten that error since!  :(  Anyway, at least it gave me some clue as to what is happening (just not how to work around it!).

Does anyone have suggestions for a workaround?

Thanks,
Joe

p.s. let me know what other info i should provide to help you help me.  :)

Joachim Müller

when in coppermine config, view the html source code and look for the <form...>-tag. Paste it into your posting (so we can see the url it is going to send the form data to). Another good idea is to turn debug mode on. This is usually done in coppermine config as well, but since you can't save the changes in coppermine config, edit the database directly (with a tool like phpMyAdmin), in the table cpg11d_config, look for "debug_mode" and set it from "0" to "1". Then go to coppermine again and check the debug output (put the relevant info into your posting as well).

GauGau

joea

Hi GauGau,

Thanks for your quick response.  I've enabled debug temporarily as you suggested though nothing really jumps out at me.  It is doing the sql query, cookie identifies me and my visit history data etc...


Here is the form tag from config.php:
<pre>
<form action="/cgi-bin/php" method="post">
</pre>

Should this be calling a script instead of the php binary itself?  i.e.:  <form action="http://mysite.com/modify.php">


Thanks,
Joe

Joachim Müller

yes, this should actually look like this:<form action="/your_coppermine_dir/config.php" method="post">There seems to be something fishy with your server vars, since the code looks like this in config.php:<form action="$PHP_SELF" method="post">
The var $PHP_SELF is actually set in include/init.inc.php:$PHP_SELF = isset($HTTP_SERVER_VARS['REDIRECT_URL']) ? $HTTP_SERVER_VARS['REDIRECT_URL'] : $HTTP_SERVER_VARS['SCRIPT_NAME'];To fix the issue with the coppermine config, you can simply change<form action="$PHP_SELF" method="post">to<form action="config.php" method="post">, but I'm sure you'll run into problems elsewhere as well, since $PHP_SELF is being used quite often. I suggest you take a deeper look into your server config (php.ini is the place to go) to fix this permanently.

GauGau

joea

Thanks for the lead.  I'll search around and see how to fix that.  Will post my findings for the next newbie.  :)

Joe

joea

Weird....

I created a file called test.php:

<?php print "Hello world!  My variable is $PHP_SELF"; ?>

I see:

Hello world!  My variable is /test.php

If I put a similar string into config.php (for example), it returns:

hello my name is /cgi-bin/php.

I have a redirect module set up in Roxen to change certain regular expressions.  This one runs .php files through /cgi-bin/php:

/(.*)\.php(.*)$    /cgi-bin/php/$1.php$2

   From the Redirect Module guidelines:

"You can use '(' and ')' in the regular expression to separate parts of the from-pattern when using regular expressions. The parts can then be insterted into the 'to' string with $1, $2 etc.

    More examples:

   .*/SE/liu/lysator/(.*)\.class   /java/classes/SE/liu/lysator/$1.class
   /(.*)\.en\.html                 /(en)/$1.html
   (.*)/index\.html                %u/$1/

If the to file isn't an URL, the redirect will always be handled internally, so add %u to generate an actual redirect.

Not sure if this is messing up the functionality inside config.php?

Joe

Joachim Müller

do you absolutely need the redirect module? Try to switch it off (comment it out) temporarily and test if this fixes the config issue...

GauGau

joea

I'm not an expert, but from what i understand Roxen isn't built with native PHP support.  I had to compile php, drop the binary into /cgi-bin, and add that redirect per http://docs.roxen.com/roxen/3.3/system_developer_manual/languages/php.xml

Turning it off, unfortunately, stops the .php files from executing properly (they open as a text file). Don't know if PHP is fixed yet in the latest version of the server, but i may have to find a more creative way to write the redirect line in that module.

:-/

Joe

hyperion

Try renaming config.php to something without any trace of 'config' in it, i.e. test.php.
&quot;Then, Fletch,&quot; that bright creature said to him, and the voice was very kind, &quot;let&#039;s begin with level flight . . . .&quot;

-Richard Bach, Jonathan Livingston Seagull

(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.mozilla.org%2Fproducts%2Ffirefox%2Fbuttons%2Fgetfirefox_small.png&hash=9f6d645801cbc882a52f0ee76cfeda02625fc537)

joea

This is clearly related to Roxen's ineffective handling of PHP in the build I have, and my lack of a clue on how to jury-rig it.

The only thing I can think of that might work is what GauGau recommended and hard-code the names/paths into each file as needed.  :-/

If anyone in this forum has it working on Roxen please drop me a note!

Thanks all for your help!
Joe

RS X rS

Quote from: "gaugau"but I'm sure you'll run into problems elsewhere as well, since $PHP_SELF is being used quite often. I suggest you take a deeper look into your server config (php.ini is the place to go) to fix this permanently.

GauGau

I'm a beginner in php, and i've got the same problem. How can I chance this error, on the most easy way? (a turtioral of somethingh like that)

Thanks Rs

joea

Sorry I can't be the one to give you the answer you seek -- I posed the question for my particular webserver to the Roxen community but there have been no responses.  :(

Joe

Joachim Müller

Coppermine has been tested extensively with Apache and IIS. If Roxen doesn't work as expected, I guess you'll have to manually edit some files that come with coppermine. Look for $PHP_SELF in the code of pages that cause errors and replace it with the filename of the file you are having trouble with. It's hard for us to create a tutorial, since nobody from the dev team runs Roxen. I think it's likely that you'll run into problems with other scripts as well using Roxen, so in the long run I'd go for Apache - it's free and everybody's using it flawlessly. There are packages available for all operating systems (LAMP, WAMP, XAMP), should not be too complicated to get it running.

GauGau

ucbu

I run into the same problem with /cgi-bin/php.
When I rename config.php to test.php and add display $PHP_SELF it still shows /cgi-bin/php.
When I try the "hello world" someone post earlier, it works.
I guess it's the trouble with the $PHP_SELF in include/init.inc.php hence I comment out the line

$PHP_SELF = isset($HTTP_SERVER_VARS['REDIRECT_URL']) ? $HTTP_SERVER_VARS['REDIRECT_URL'] : $HTTP_SERVER_VARS['SCRIPT_NAME'];

and everything works perfectly. So anyone wants a quick fix may try that.
Good luck :)

wired

Ok I have had the same problem with godaddy....i think they changed the vars on me cause this used to work...any way I tried the workaround you suggested above and it works