|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-07-26 18:40 UTC] georg@php.net
[2004-07-26 20:16 UTC] chcaron at nrcan dot gc dot ca
[2004-07-28 22:24 UTC] chcaron at nrcan dot gc dot ca
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 12:00:01 2025 UTC |
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#