From:             chcaron at nrcan dot gc dot ca
Operating system: Soalris 2.8
PHP version:      4.3.8
PHP Bug Type:     iPlanet related
Bug description:  cannot connect to MySQL from the web server

Description:
------------
PHP has been installed with "with-mysql=/usr/local/mysql".

PHP 4.3.8
Mysql 4.0.15
iPlanet 6.1

It was working well with PHP 4.3.4 before we upgrade.

Once we upgraded PHP to 4.3.8, we got "mysql_connect(): Can't connect to
MySQL server..." when trying to open a page from the webserver. The
command-line PHP was still working correctly.

We recompiled PHP with "with-mysql" only (built-in MySQL) and it all
started working ok.

Reproduce code:
---------------
<html>
<body>
<?php

$hostname = 'hostname';
$user = 'root';
$passwd = 'password';
$database_name = 'mysql';
$error_connection = 'Cannot connect to MySQL';
$error_db = "Invalid database name ($database_name)";

if (!($connection = @ mysql_connect($hostname, $user, $passwd)))
        die("$error_connection");
if (!(mysql_select_db($database_name, $connection)))
        die("$error_db");

$query = "show tables;";
if (!($result = mysql_query ($query, $connection)))
        die("error");
while ($row = @ mysql_fetch_array($result)) {
 echo "$row[0]<br>";
}
?>
</body>
</html>

Expected result:
----------------
The list of tables should print on the screen if ran from the webserver:

columns_priv
db
func
host
tables_priv
user

If ran from the command line:

nrn1# /usr/local/php/bin/php test_PHP_mysql.php
<html>
<body>
columns_priv<br>db<br>func<br>host<br>tables_priv<br>user<br></body>
</html>
nrn1#

Actual result:
--------------
>From the webserver:

Cannot connect to MySQL

>From the command line:

nrn1# /usr/local/php/bin/php test_PHP_mysql.php
<html>
<body>
columns_priv<br>db<br>func<br>host<br>tables_priv<br>user<br></body>
</html>
nrn1#

-- 
Edit bug report at http://bugs.php.net/?id=29391&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=29391&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=29391&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=29391&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=29391&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=29391&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=29391&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=29391&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=29391&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=29391&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=29391&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=29391&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=29391&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29391&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=29391&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=29391&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=29391&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29391&r=float

Reply via email to