I'm trying to get MediaWiki running and I keep hitting the same problem. I've tried the 1.3.x builds and the latest 1.4 builds and I get the same problem each time. I don't think it's a database problem because the configuration doesn't get that far. I'm able to get other wiki packages running on this site so I don't think there is an admin problem.
The error I get is this:
Fatal error: Cannot redeclare class namespace in /na/h1/t/tk/tkw4u /public_html/spacewiki/includes/Namespace.php on line 52
I've looked at the file and at that section of code. There doesn't seem to be anything I can manually enter there.
Does anyone have any thoughts or ideas of what might be causing this error?
Thanks!
Tim
On Fri, 18 Mar 2005 13:37:29 -0500, Tim Wilkinson webbrass@adelphia.net wrote:
I'm trying to get MediaWiki running and I keep hitting the same problem. I've tried the 1.3.x builds and the latest 1.4 builds and I get the same problem each time. I don't think it's a database problem because the configuration doesn't get that far. I'm able to get other wiki packages running on this site so I don't think there is an admin problem.
The error I get is this:
Fatal error: Cannot redeclare class namespace in /na/h1/t/tk/tkw4u /public_html/spacewiki/includes/Namespace.php on line 52
I've looked at the file and at that section of code. There doesn't seem to be anything I can manually enter there.
Does anyone have any thoughts or ideas of what might be causing this error?
Thanks!
Tim
What is your environment like? What version of PHP?
At the risk of stating the obvious, it appears that you're picking up another class named "Namespace" somewhere, or for some reason attempting to define the same class twice.
Do you have a clean install? Could you have some leftover files from a previous version?
-- Rich Holton
en.wikipedia:User:Rholton
Here is the environment statement from the MediaWiki setup page
PHP 4.3.4: ok PHP server API is apache; ok, using pretty URLs (index.php/Page_Title) Have XML / Latin1-UTF-8 conversion support. PHP is configured with no memory_limit. Have zlib support; enabling output compression. Found GD graphics library built-in, image thumbnailing will be enabled if you enable uploads.
The install is totally clean. The only thing done other then to expand the file was to run the chmod command on the config directory as directed in the installation instructions.
Everything else should be clean and ready to go.
Thanks,
Tim
On Fri, 18 Mar 2005 13:37:29 -0500, Tim Wilkinson webbrass@adelphia.net wrote:
I'm trying to get MediaWiki running and I keep hitting the same problem. I've tried the 1.3.x builds and the latest 1.4 builds and I get the same problem each time. I don't think it's a database problem because the configuration doesn't get that far. I'm able to get other wiki packages running on this site so I don't think there is an admin problem.
The error I get is this:
Fatal error: Cannot redeclare class namespace in /na/h1/t/tk/tkw4u /public_html/spacewiki/includes/Namespace.php on line 52
I've looked at the file and at that section of code. There doesn't seem to be anything I can manually enter there.
Does anyone have any thoughts or ideas of what might be causing this error?
Thanks!
Tim
What is your environment like? What version of PHP?
At the risk of stating the obvious, it appears that you're picking up another class named "Namespace" somewhere, or for some reason attempting to define the same class twice.
Do you have a clean install? Could you have some leftover files from a previous version?
-- Rich Holton
en.wikipedia:User:Rholton
In addition to the php and mySQL documentation, is there any place else to learn more about dealing with encoding?
Here's what I think I know, tell me if I'm wrong: * I have to deal with encoding (when the defaults don't work) for php, mySQL and MW (when it passes parameters through extensions, and subsequently final HTML display. * mySQL can have its encoding changed at the levels of database, table and column, all of which have defaults * on a hosted situation where I don't control the mySQL as a root admin, I need to use the ALTER sql commands to change the encoding * you can tell mySQL what encodings the php will send and receive.
I'm still wrestling with using values passed from MW extensions in php controlled mySQL queries. These values have diacritcals, and the data in the mySQL tables have the same characters, but the MW encoding appears to be UTF-8. I've tried changing the encoding of the value in php using mb_convert_encoding(), but it stays UTF-8. I use phpMyAdmin and if I set it to use Latin-1/ISO-8859-1, it runs the queries correctly, but if I set it to Unicode/UTF-8 then it doesn't.
My host has me on: PHP 4.3.10 / mySQL 4.0.22
Does my version of mySQL just not support Unicode/UTF-8? Even so, I would think that I should be able to re-encode the variable values to Latin1. Am I using the wrong function or syntax?
mb_convert_encoding($theTown, "ISO-8859-1"); echo mb_detect_encoding($theTown); (outputs "UTF-8")
I tried this:
iconv_set_encoding("internal_encoding", "UTF-8"); iconv_set_encoding("output_encoding", "ISO-8859-1"); var_dump(iconv_get_encoding('all'));
and get Fatal error: Call to undefined function: iconv_set_encoding() in .... on line ....
here are some phpInfo values from my installation:
Directive Local Value Master Value mbstring.detect_order no value no value mbstring.encoding_translation Off Off mbstring.func_overload 0 0 mbstring.http_input pass pass mbstring.http_output pass pass mbstring.internal_encoding ISO-8859-1 no value mbstring.language neutral neutral mbstring.substitute_character no value no value
and I've tried this with no desired effect:
$dbh=mysql_connect ($host, $username, $password) or die ('Connect error: ' . mysql_error()); mysql_select_db ($database) or die ('Cannot select database'); mysql_query("SET NAMES 'utf8'", $dbh);
but this is probably because my mySQL version doesn't support utf-8?
In summary, I think my php version should support converting encodings, but so far the only way the I've been able to do it is to manually detect a specific word and re-assing the same value in code like this:
if (ereg("Gr.+tz", $theKreis)) { $theKreis = 'Grätz'; }
Unfortunately, I'm at the point where I have hundreds of values that use special characters, instead of just a few.
=James Birkholz= wrote:
- mySQL can have its encoding changed at the levels of database, table
and column, all of which have defaults
[snip]
PHP 4.3.10 / mySQL 4.0.22
MySQL prior to 4.1 has only a single server-wide encoding setting which is used for collation and (non-binary) text comparison. Leave the default at 'latin1'; applications will deal with the UTF-8 data on their own.
mb_convert_encoding($theTown, "ISO-8859-1"); echo mb_detect_encoding($theTown); (outputs "UTF-8")
mb_convert_encoding takes three parameters; try specifying the 'from' encoding. Otherwise it'll default to whatever the default is set to (which is probably ISO-8859-1)...
If you're only going to use ISO-8859-1, consider also using the simpler utf8_encode() and utf8_decode() functions.
Note however that if your text includes Windows "extended" characters (curly quotes, long dashes, euro symbol, s-caron, c-caron, etc) all of these will be corrupted by a conversion from ISO-8859-1 to Unicode or vice-versa. You'll need to specify "Windows-1252" instead of "ISO-8859-1" to get the correct conversion to/from Unicode.
[snip]
mbstring.internal_encoding ISO-8859-1 no value
Yep. That conversion call has no effect because your source and destination encodings are the same.
iconv_set_encoding("internal_encoding", "UTF-8"); iconv_set_encoding("output_encoding", "ISO-8859-1"); var_dump(iconv_get_encoding('all'));
and get Fatal error: Call to undefined function: iconv_set_encoding() in .... on line ....
iconv is a separate module entirely, unrelated to the mbstring module, and it looks like you don't have it compiled in or loaded. Did you mean to use mb_internal_encoding() to set mbstring's default encoding?
mysql_query("SET NAMES 'utf8'", $dbh);
but this is probably because my mySQL version doesn't support utf-8?
Right, this wouldn't do anything useful for you because your MySQL version predates support for character sets.
-- brion vibber (brion @ pobox.com)
Well, I just tried:
mb_convert_encoding($theTown, "ISO-8859-1", "UTF-8"); echo mb_detect_encoding($theTown);
and
$newStr = utf8_decode($theTown) ; echo mb_detect_encoding($newStr);
but I still get "UTF-8" echo'ed... did I do it wrong?
Alternatatively, anyone got a clever regex syntax to make this approach more general?
if (ereg("Schneidem.+hl", $theTown)) { $theTown = 'Schneidemühl'; }
I may be chasing the wrong squirrel, because the above routine works and makes the mySQL query work, but when I place the same echo debug, I still get "UTF-8" echoed....
????
=James Birkholz= wrote:
Well, I just tried:
mb_convert_encoding($theTown, "ISO-8859-1", "UTF-8"); echo mb_detect_encoding($theTown);
You need to be looking at the return value from the function; it doesn't change the parameters.
$newStr = utf8_decode($theTown) ; echo mb_detect_encoding($newStr);
but I still get "UTF-8" echo'ed... did I do it wrong?
If you don't give it a sensible list of encodings to try, mb_detect_encoding() seems to give totally incorrect results. Try:
echo mb_detect_encoding($newStr, "UTF-8,ISO-8859-1,ASCII");
-- brion vibber (brion @ pobox.com)
At 03:45 PM 3/20/05, you wrote:
=James Birkholz= wrote:
Well, I just tried:
mb_convert_encoding($theTown, "ISO-8859-1", "UTF-8"); echo mb_detect_encoding($theTown);
You need to be looking at the return value from the function; it doesn't change the parameters.
I tried it this way: $newStr = mb_convert_encoding($theTown, "ISO-8859-1", "UTF-8"); echo mb_detect_encoding($newStr);
Stills echoes ast UTF-8.
$newStr = utf8_decode($theTown) ; echo mb_detect_encoding($newStr);
but I still get "UTF-8" echo'ed... did I do it wrong?
If you don't give it a sensible list of encodings to try, mb_detect_encoding() seems to give totally incorrect results. Try:
echo mb_detect_encoding($newStr, "UTF-8,ISO-8859-1,ASCII");
The manual only shows one parameter, but I tried it anyway and got a "too many parmeters" error.
(sigh)
Really think I'm barking up the wrong overgrown bush...
I misread Brion's previous reply and had applied the last suggest to the wrong function. It looks like things will work correctly, but I have to run to work and compress an Access97 database that's threatening to fill a hard drive. I'll verify the solution when I get back.
James
mediawiki-l@lists.wikimedia.org