Re: Autotests: Access denied for user 'root'@'localhost' (using password: NO)

From: Date: Thu, 18 Aug 2011 17:22:59 +0000
Subject: Re: Autotests: Access denied for user 'root'@'localhost' (using password: NO)
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-54695@lists.php.net to get a copy of this message
Am 18.08.2011 00:46, schrieb Reindl Harald:
Wouldn't it be a good idea to specify here a user/pwd/database for build-systems without force them open root without password? SKIP mysql_get_host_info() [ext/mysql/tests/mysql_get_host_info.phpt] reason: Can't connect to MySQL Server - [1045] Access denied for user 'root'@'localhost' (using password: NO)
Please, configure the tests to use whatever database user you want them to use prior to running. If nothing else is configured, the tests need to make a guess on the on the DB credentials. The guess is user="root", password="" as such a DB account is available when doing, for example, a source installation of MySQL. Have a look at http://svn.php.net/viewvc/php/php-src/branches/PHP_5_3/ext/mysql/tests/connect.inc?revision=296885&view=markup . It tries to check the environment for variable to allow for easy configuration but ultimately has some defaults in it. This is a common pattern, for example, check http://svn.php.net/viewvc/php/php-src/branches/PHP_5_3/ext/oci8/tests/details.inc?revision=312024&view=markup . If no configuration done through environment settings, OCI8 tests default to DB user "system", password "oracle" - whatever user that is. grep -R getenv ext/*/tests/*.inc -> ext/ldap -> ext/mysqli -> ext/mysql -> ext/oci8 -> ext/pdo_mysql -> ext/pdo_pgsql -> ext/pdo -> ext/sybase grep -R getenv ext/*/tests/*.phpt -> ext/curl -> ext/pdo_<pretty_much_all_of_them> A potential pitfall that affects all test writers trying to allow configuration via environment settings is the - certainly sensible - variables_order setting found in php.ini-development and php.ini-production. php.ini-development:variables_order = "GPCS" php.ini-production:variables_order = "GPCS" If any of the two is used as a configuration file for running tests through run-tests.php, run-tests.phpt will not be able provide tests with all environment variables, http://lxr.php.net/xref/PHP_5_3/run-tests.php#140 . run-tests.php relies on $_ENV and $_ENV is empty. To make a long story short: tests may require manual configuration prior to running. Ulf

« previous php.internals (#54695) next »