|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2001-04-11 14:01 UTC] mfischer at josefine dot ben dot tuwien dot ac dot at
[2001-04-11 16:39 UTC] mfischer at josefine dot ben dot tuwien dot ac dot at
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 19:00:01 2025 UTC |
When connecting to a mysql database with the following code : $link = @mysql_connect( 'localhost:/wrong/socket/path', 'user', 'pass'); if( $link == false) { echo "\nerror # ".mysql_errno()." ".mysql_error()."\n"; exit; } PHP of course is unable to successfully connect. PHP fires a warning message that the socket path couldn't be found: MySQL Connection Failed: Can't connect to local MySQL server through socket When using @mysql_connect the warning is does not appear, but its impossible to retrieve the exact error within PHP. mysql_errno() and mysql_error() do not return any information (empty ). Normally on websites, a user doesn't care about the exact error message. But when writing client side Applications (e.g. php-gtk), a call to PHP's mysql_error() or mysql_errno() after mysql_connect() should really return the right message from libmysql. Looking at the current CVS, line 579 in ext/mysql/php_mysql.c retrieves the mysql_error() and fires it as a warning to the user. Since in line 581 the *mysql structure gets freed, Its clear for me that a call in PHP after mysql_connect cannot retrieve this error. Are there any workarounds possible ? Its not a high priority problem of course but seriously to take I guess ? thanks, Markus