Bug #11882 Codepage error displayed with PHP 4.33
Submitted: 12 Jul 2005 12:23 Modified: 25 Jul 2005 3:45
Reporter: Zoltan Juhasz Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:4.1.x OS:Windows (Windows 2003 Server)
Assigned to: CPU Architecture:Any

[12 Jul 2005 12:23] Zoltan Juhasz
Description:
I installed the mySql 4.1.12a version. When I run a select query the following error message appear on the webpage: 

File 'c:\mysql\share\charsets\?.conf' not found (Errcode: 22) Character set '#26' is not a compiled character set and is not specified in the 'c:\mysql\share\charsets\Index' file 

I configure the server codepage to Latin1, but the hungarian characters doesn't work unfortunetly. I tried the UTF8, but the result is same. 

How to repeat:
Install the mySql 4.1 Server on the computer:

- Custom Install
- Install all Developer components
- Install dir changed to D:\MySQL\ (or C:\MySQL\ there is no difference)
- Skip Sign-Up
- Configure MySQL Server now
- Select "Detailed Configuration"
- Server Machine
- Multifunctional Database
- InnoDB TableSpace Settings: D: Installation Path
- Online Transaction Processing (OLTP)
- Enable TCP/IP (TRUE), Port default
- Select "Best Support For Multilingualism" or Manual Selected Def. Charset = cp1250
- Install As Windows Service, all options default
- Set the root password
- ...and execute the configuration
- Finish

Create an account example: "jzo" and a database. Set password to "jzo" acc. -> "test"

Convert the password to the old password format, use this SQL command and type it into the MySQL Query Browser 1.1 program:

SET PASSWORD FOR 'jzo'@'localhost' = OLD_PASSWORD('test');

...and execute.

Now, save this 2 demonstration PHP code into file:

File name: connect.php

<?php
// Connect and select database
$database["host"] = "localhost";
$database["user"] = "jzo";
$database["password"] = "test";
if(!$connect = @mysql_connect($database["host"],$database["user"],$database["password"]))
	{
	print( "MySQL error: " . mysql_error() );
	die();
	}
$database["database"] = "jzo";
@mysql_select_db($database["database"], $connect);
?>

----------------------------------

File name: create_banner_reklam.php

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
</head>
<body>

<?php

// Call database connector file

include("connect.php");

// Delete table if it exist
$database["table"] = "banners";
$database["sql"] = "drop table banners;";
if(@mysql_query($database["sql"]))
   {
   print("<p>Table deleted: " . $database["table"] . "</p>");
   }
else
   {
   print("<p>Cannot delete table: " . $database["table"]
      . ", error: " . mysql_error() . "</p>");
   }

// Create table (banners)
$database["sql"] = "create table " . $database["table"]
   . " (CustomerID int(10) auto_increment not null,"
   . " Customerbanner tinytext not null,"
   . " Customerlink tinytext not null,"
   . " Customeralt tinytext not null,"
   . " primary key (CustomerID));";
if(@mysql_query($database["sql"]))
   {
   print("<p>Table created: " . $database["table"] . "</p>");
   }
else
   {
   print("<p>Cannot create table: " . $database["table"]
      . ", hiba: " . mysql_error() . "</p>");
   }

// insert a row
$database["sql"] = "insert into " . $database["table"] . " set Customerbanner='http://www.terrachat.hu/resources/terrachatbanner.gif', Customerlink='http://www.terrachat.hu/', Customeralt='TerraChat: azonnali üzenetküldés, file csere, chat, ICQ, MSN tudás'";
$result = @mysql_query($database["sql"]);

// Listing tables
print("Tables in database:");

$database["sql"] = "show tables from " . $database["database"];
if($result = @mysql_query($database["sql"]))
   {
   while($row = mysql_fetch_row($result))
      {
      print("<br>" . $row[0]);
      }
   }
else
   {
   print("Query error: " . mysql_errno() . ", " . mysql_error()
      . " sql command " . $database["sql"]);
   }
?>

</body>
</html>

I use Windows IIS on default port. Configure your account information in connect.php if it is different.

Type the following command into your browser:

http://localhost/create_banner_reklam.php

The result is in the browser screen:

File 'c:\mysql\share\charsets\?.conf' not found (Errcode: 2) Character set '#26' is not a compiled character set and is not specified in the 'c:\mysql\share\charsets\Index' file 
Table deleted: banners

Table created: banners

Tables in database:
banners 

I can not resolve the error and don't know what is the problem.

Suggested fix:
-
[12 Jul 2005 12:25] Zoltan Juhasz
Database connector PHP script

Attachment: connect.php (text/plain), 398 bytes.

[12 Jul 2005 12:25] Zoltan Juhasz
Example of table creation and insert

Attachment: create_banner_reklam.php (text/html), 1.73 KiB.

[12 Jul 2005 12:57] MySQL Verification Team
Are you upgraded installing the 4.1.12a over an older installation?
[12 Jul 2005 13:52] Zoltan Juhasz
No it was a clean install. There was an old mysql on the computer, but I fully uninstalled it (service, mysql directory and all files deleted) before I install the new version.

The problem is present on my web server and on my home computer.
[12 Jul 2005 14:08] Andrey Hristov
Hello,
could you please simplify the test script, omit the unnecessary parts, provide a full connecting (you haven't supplied connect.php) and if possible please use the CLI version of PHP which comes with you PHP installation because in this case one layer less is require - the Web Server. The CLI is called php.exe.

Thank you in advance!
[12 Jul 2005 14:16] Zoltan Juhasz
There is the connect.php in "Files" menu, you can download it. I supplied this code above too. Just copy-paste into a file called connect.php
[15 Jul 2005 6:51] Aleksey Kishkin
Zoltan, what php do you use (i mean what distribution? is it compiled by you etc etc)? Some versions of php contains mysql client library. So I expect it contains mysql 4.0 client libraries with 'compiled in' charset location in c:\mysql\share\charsets. 

(BTW 4.1 uses index.xml and *.xml files ,not index.conf and *.conf - that's why I also think that php on your computer uses old client library)

So when you try to use it with mysql 4.1, php obviously cannot find charsets.
[15 Jul 2005 7:19] Zoltan Juhasz
I'm using PHP 4.4.0 (Windows Binary Zip Package). I downloaded it from this site. Previously I used the 4.3.3 version, so the newer version of PHP cannot solved the problem.
I installed the MySQL Server 4.1.12a version into "C:\MySQL\" folder. I copied old MySQL charsets file into C:\MySQL\share\charsets but this has not solved my problem.

I have no idea what can I do more.
[25 Jul 2005 3:45] Jorge del Conde
I was unable to reproduce this bug under Linux, WinXP & Win2003 using mysql 4.1.13 and php: 4.4.0 and 5.1b3.