Fixed: Can't initialize character set #

admin

Administrator
Staff member
Mysql: Unable to establish connection: Can't initialize character set xx

you can fixed at <!-- m --><a class="postlink" href="http://bugs.php.net/bugs.php?id=7678">http://bugs.php.net/bugs.php?id=7678</a><!-- m -->

or.......i copy to this........................

2000-11-07 14:15:10] <!-- e --><a href="mailto:[email protected]">[email protected]</a><!-- e -->

CGI version of PHP4. (Apache module fails too)

./configure \
--with-jpeg-dir=/usr/local \
--with-gd --with-oracle \
--with-mysql \
--disable-debug \
--enable-magic-quotes=yes \
--enable-memory-limit=yes \
--enable-url-fopen-wrapper=no \
--enable-sysvsem=yes \
--enable-sysvshm=yes \
--enable-track-vars=yes \
--with-system-regex \
--enable-safe-mode \
--with-gdbm \
--with-java=/usr/local/j2sdk1_3_0 \
--with-zlib

magnat!kir$ mysql --version
mysql Ver 10.12 Distrib 3.23.25-beta, for pc-solaris2.7 (i386)

Mysql configure line:
./configure --without-debug --with-charset=koi8_ru --prefix=/usr/local --with
out-docs --disable-shared

Locale setting:
magnat!kir$ echo $LC_ALL
ru.koi8-r

Script:

magnat!kir$ cat ~/public_html/a.php
<?
$a = mysql_connect("localhost","kir","kir");
$res = mysql("kir_db", "select count(*) from test");
echo mysql_result($res,0);
echo $a;
?>

Run and ERROR:
magnat!kir$ ~/SOFT/bin/php -f ~/public_html/a.php
File 'NONEXISTENT/charsets/?.conf' not found (Errcode: 2)
Character set '#7' is not a compiled character set and is not specified in the '
NONEXISTENT/charsets/Index' file
<br>
<b>Warning</b>: MySQL Connection Failed: Can't initialize character set 7
(path
: default)
in <b>/h/home/kir/public_html/a.php</b> on line
<b>2</b><br>
File 'NONEXISTENT/charsets/?.conf' not found (Errcode: 2)
Character set '#7' is not a compiled character set and is not specified in the '
NONEXISTENT/charsets/Index' file
<br>
<b>Warning</b>: MySQL Connection Failed: Can't initialize character set 7
(path
: default)
in <b>/h/home/kir/public_html/a.php</b> on line
<b>3</b><br>
<br>
<b>Warning</b>: MySQL: A link to the server could not be established in
<b>/h/
home/kir/public_html/a.php</b> on line <b>3</b><br>
<br>
<b>Warning</b>: Supplied argument is not a valid MySQL result resource in
<b>/h
/home/kir/public_html/a.php</b> on line <b>4</b><br>




[2000-11-07 15:24:06] <!-- e --><a href="mailto:[email protected]">[email protected]</a><!-- e -->

For the record: I had this problem too, it was cured with using installed MySQL library
and not that supplied with PHP (i. e., --with-mysql=/path/to/mysql/dir). Please try it, it
might help.
[2000-11-07 16:14:01] <!-- e --><a href="mailto:[email protected]">[email protected]</a><!-- e -->

I tried to use original mysql library and rebuild.
IMHO, something wrong with configure process.
I get:

make[1]: Entering directory `/h/home/kir/SRC/php4'
/bin/sh /h/home/kir/SRC/php4/libtool --silent --mode=link gcc -I. -I/h/home/kir
/SRC/php4/ -I/h/home/kir/SRC/php4 -I/h/home/kir/SRC/php4/main -I/h/home/kir/SRC/
php4/Zend -I/h/home/kir/SRC/php4 -I/usr/local/include -I/usr/local/include/freet
ype -I/usr/local/include/mysql -I/u/oracle7/rdbms/public -I/u/oracle7/rdbms/demo
-I/u/oracle7/network/public -I/h/home/kir/SRC/php4/ext/xml/expat/xmltok -I/h/ho
me/kir/SRC/php4/ext/xml/expat/xmlparse -I/h/home/kir/SRC/php4/TSRM -D_POSIX_PTH
READ_SEMANTICS -DXML_BYTE_ORDER=12 -g -O2 -o php -export-dynamic stub.lo
libphp4.la
Undefined first referenced
symbol in file
mysql_num_fields .libs/libphp4.a(php_mysql.o)
mysql_num_rows .libs/libphp4.a(php_mysql.o)
mysql_insert_id .libs/libphp4.a(php_mysql.o)
mysql_field_count .libs/libphp4.a(php_mysql.o)
mysql_errno .libs/libphp4.a(php_mysql.o)
mysql_error .libs/libphp4.a(php_mysql.o)
mysql_affected_rows .libs/libphp4.a(php_mysql.o)
ld: fatal: Symbol referencing errors. No output written to php
collect2: ld returned 1 exit status
make[1]: ***
PHP:
 Error 1
[2000-11-07 18:26:26] <!-- e --><a href="mailto:[email protected]">[email protected]</a><!-- e -->

Try a 'make clean' and recompile with your new --with-mysql=/usr/local switch.
[2000-11-07 18:38:59] <!-- e --><a href="mailto:[email protected]">[email protected]</a><!-- e -->

After upgrade to Mysql 3.23.25-beta and full recompile works fine. Thank you!
[2000-11-07 18:53:19] <!-- e --><a href="mailto:[email protected]">[email protected]</a><!-- e -->

Resolved

..................................8-)
 
Back
Top