User Language Switching Error User Language Switching Error
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

User Language Switching Error

Started by visualingo, April 11, 2005, 10:08:44 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

visualingo

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/

haggis

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

haggis

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:

QuoteThe 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?

Nibbler

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.

haggis

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

$PHP_SELF = isset($HTTP_SERVER_VARS['REDIRECT_URL']) ? $HTTP_SERVER_VARS['REDIRECT_URL'] : $HTTP_SERVER_VARS['SCRIPT_NAME'];
as
$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.

Nibbler

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

haggis

So true. Thanks for that - inspiring, really.

Nibbler

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

haggis

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.

haggis

Compiling PHP locally on my web host (and running it as an apache module) fixed everything for me. Cheers.