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: User Language Switching Error  (Read 3249 times)

0 Members and 1 Guest are viewing this topic.

visualingo

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
User Language Switching Error
« on: April 11, 2005, 10:08:44 pm »

The default language for my gallery is Spanish, but for my own login I wanted it changed to English. When I use the dropdown to switch to any language (not just English), I am given this error:

Quote
Warning: Unexpected character in input: ' ' (ASCII=12) state=1 in /usr/local/dh/cgi-system/php.cgi on line 2966

Parse error: parse error, unexpected T_STRING in /usr/local/dh/cgi-system/php.cgi on line 2966

Any ideas?

Thanks in advance.

http://www.eltepehuaje.com/galeria/
Logged

haggis

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
    • Cairn Gallery
Re: User Language Switching Error
« Reply #1 on: April 29, 2005, 03:30:01 am »

Oh dear. I get the exact same errors trying to delete an ecard.  I also got errors trying to use language files but since I was just playing around with those I didn't bother to save them. Almost certainly the same, too. I see we're both on dreamhost.

(PHP Version 4.3.10, running PHP as CGI.)
Logged

haggis

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
    • Cairn Gallery
Re: User Language Switching Error
« Reply #2 on: May 01, 2005, 07:01:39 pm »

Pardon the bump. Googling around I find a lot of folks having this error with various scripts. It appears to come from how Dreamhost configure php as cgi. Here's a snippet from user comments in DH knowledgbase:

Quote
The variables $_SERVER['SCRIPT_FILENAME'] and $_SERVER['SCRIPT_NAME'] no longer refer to your PHP script, but to Dreamhost's php.cgi script. You can fix this by explicitly assigning new values to them. There are quite a few variables that tend to have the same value but can vary according to circumstance, and Dreamhost's setup is a prime example. So the following may work for you or not.

$_SERVER['SCRIPT_FILENAME'] = $_SERVER['DOCUMENT_ROOT'].$_SERVER['SCRIPT_URL'];
$_SERVER['SCRIPT_NAME'] = $_SERVER['SCRIPT_URL'];

Also if your script uses $HTTP_SERVER_VARS instead of the newer $_SERVER then you need to set those values also as they DO NOT refer to the same value if you change one.
full article: here.

I really don't know enough to understand the fix. I'm reluctant to simply start overwriting bits of code that will be overwritten on the next updgrade anyway. Maybe if someone reviewed the KBase discussion they would be able to accommodate the situation in a future Coppermine release, or inventory which core files need to be edited, and how -- or suggest another way to get CPG fully operational under PHP-as-CGI?
Logged

Nibbler

  • Guest
Re: User Language Switching Error
« Reply #3 on: May 01, 2005, 07:09:29 pm »

It's already a known issue for strange server setups. What you need to do is ensure that $PHP_SELF ands $_SERVER['PHP_SELF'] have the correct value for the name of the current page in init.inc.php. It's not very helpful advice for newbies however, but that is the only solution for unusual server setups.
Logged

haggis

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
    • Cairn Gallery
Re: User Language Switching Error
« Reply #4 on: May 01, 2005, 10:14:40 pm »

Ah well. I tried hardcoding the url to the gallery in line 171

Code: [Select]
$PHP_SELF = isset($HTTP_SERVER_VARS['REDIRECT_URL']) ? $HTTP_SERVER_VARS['REDIRECT_URL'] : $HTTP_SERVER_VARS['SCRIPT_NAME'];as
Code: [Select]
$PHP_SELF = isset($HTTP_SERVER_VARS['http://www.example.com/gallery']) ? $HTTP_SERVER_VARS['http://www.example.com/gallery'] : $HTTP_SERVER_VARS['SCRIPT_NAME'];
but I guess it's not as simple as that.
Logged

Nibbler

  • Guest
Re: User Language Switching Error
« Reply #5 on: May 01, 2005, 10:16:00 pm »

You do need some php knowledge to be able to fix this, making things up won't work I'm afraid.
Logged

haggis

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
    • Cairn Gallery
Re: User Language Switching Error
« Reply #6 on: May 02, 2005, 05:30:45 am »

So true. Thanks for that - inspiring, really.
Logged

Nibbler

  • Guest
Re: User Language Switching Error
« Reply #7 on: May 02, 2005, 07:05:43 pm »

Try setting $PHP_SELF = $_SERVER['SCRIPT_URL']; as in your quote.
Logged

haggis

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
    • Cairn Gallery
Re: User Language Switching Error
« Reply #8 on: May 03, 2005, 05:54:53 am »

Thanks. No joy. I'm sure it has to do with my host's server setup. If I turn off language and theme switching, the public parts of the gallery seem to work fine, so I'll leave it at that for now.  I found some other threads and tried rewriting URLs, but no joy there either. I may try compiling PHP locally, turning off PHP-as-CGI etc. as it may help, but that's no concern of CPG.
Logged

haggis

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
    • Cairn Gallery
Re: User Language Switching Error
« Reply #9 on: May 12, 2005, 07:03:40 am »

Compiling PHP locally on my web host (and running it as an apache module) fixed everything for me. Cheers.
Logged
Pages: [1]   Go Up
 

Page created in 0.017 seconds with 20 queries.