Advanced search  

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]

Pages: [1]   Go Down

Author Topic: Aarg! New install troubles--possibly php cgi-force-redirect?  (Read 6787 times)

0 Members and 1 Guest are viewing this topic.

joea

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Aarg! New install troubles--possibly php cgi-force-redirect?
« on: March 24, 2004, 05:32:39 pm »

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.  :)
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Aarg! New install troubles--possibly php cgi-force-redirect?
« Reply #1 on: March 24, 2004, 05:46:12 pm »

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
Logged

joea

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Aarg! New install troubles--possibly php cgi-force-redirect?
« Reply #2 on: March 24, 2004, 05:55:14 pm »

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
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Aarg! New install troubles--possibly php cgi-force-redirect?
« Reply #3 on: March 24, 2004, 06:52:57 pm »

yes, this should actually look like this:
Code: [Select]
<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:
Code: [Select]
<form action="$PHP_SELF" method="post">
The var $PHP_SELF is actually set in include/init.inc.php:
Code: [Select]
$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
Code: [Select]
<form action="$PHP_SELF" method="post">to
Code: [Select]
<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
Logged

joea

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Aarg! New install troubles--possibly php cgi-force-redirect?
« Reply #4 on: March 24, 2004, 07:10:27 pm »

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

Joe
Logged

joea

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Aarg! New install troubles--possibly php cgi-force-redirect?
« Reply #5 on: March 24, 2004, 08:27:12 pm »

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
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Aarg! New install troubles--possibly php cgi-force-redirect?
« Reply #6 on: March 24, 2004, 09:54:41 pm »

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
Logged

joea

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Aarg! New install troubles--possibly php cgi-force-redirect?
« Reply #7 on: March 24, 2004, 09:59:09 pm »

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
Logged

hyperion

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Posts: 1317
  • - retired -
Aarg! New install troubles--possibly php cgi-force-redirect?
« Reply #8 on: March 25, 2004, 12:53:34 am »

Try renaming config.php to something without any trace of 'config' in it, i.e. test.php.
Logged
&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://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fwww.mozilla.org%2Fproducts%2Ffirefox%2Fbuttons%2Fgetfirefox_small.png&hash=9f6d645801cbc882a52f0ee76cfeda02625fc537)

joea

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Aarg! New install troubles--possibly php cgi-force-redirect?
« Reply #9 on: March 25, 2004, 07:13:52 pm »

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
Logged

RS X rS

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
    • http://www.spelweek.com http://www.freerkjan.nl
Aarg! New install troubles--possibly php cgi-force-redirect?
« Reply #10 on: April 08, 2004, 10:53:18 pm »

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
Logged

joea

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Aarg! New install troubles--possibly php cgi-force-redirect?
« Reply #11 on: April 08, 2004, 11:10:17 pm »

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
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Aarg! New install troubles--possibly php cgi-force-redirect?
« Reply #12 on: April 09, 2004, 08:16:01 am »

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
Logged

ucbu

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: Aarg! New install troubles--possibly php cgi-force-redirect?
« Reply #13 on: July 29, 2004, 06:26:44 pm »

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 :)
Logged

wired

  • Coppermine newbie
  • Offline Offline
  • Posts: 6
Re: Aarg! New install troubles--possibly php cgi-force-redirect?
« Reply #14 on: July 29, 2004, 08:22:56 pm »

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
Logged
Pages: [1]   Go Up
 

Page created in 0.025 seconds with 18 queries.