[peruser] Tip for using MySQL with PHP

Blaubaer blaubaer at dyntux.net
Sat Jul 16 04:13:36 MDT 2005


i have a little hack for using MySQL with PHP.

standart when the host "localhost" by mysql_connect is defined. the mysqllib 
want to use the mysql.sock file.
But when we use chroot with peruser, we have no access on this file. We can 
type or the original server ip, but its not a nice work.

So when u edit the <php_source>/ext/mysql/php_mysql.c near

line 643 (in PHP-4.4.0)
#if MYSQL_VERSION_ID < 32200
        mysql_port = port;

        if (!MySG(allow_persistent)) {

and add
        if (strcmp(host,"localhost")==0)

This will fix this small disturbing thing. mysql_connect no more mysql.sock 
will use.

/ Blaubaer

More information about the Peruser mailing list