RE: [PHP-DB] mysqli connection problem
Hello, I've made some tests and now I suspect that what I see is a DB package bug. I run the following script and it works fine: ?php $mysqli = new mysqli(localhost, test1, , testdb); /* check connection */ if (mysqli_connect_errno()) { printf(Connect failed: %s\n, mysqli_connect_error()); exit(); } printf(Host information: %s\n, $mysqli-host_info); if ($result = $mysqli-query(SELECT * FROM contents)) { printf(Select returned %d rows, $result-num_rows); } while ($row = mysqli_fetch_assoc($result)) { print_r($row); } /* close connection */ $mysqli-close(); ? While trying to connect to the same db using PEAR::DB_DataObject (connection string: mysqli://[EMAIL PROTECTED]/testdb) Still gives me this error Can't connect to local MySQL server through socket '' (111) -Original Message- From: Martin Norland [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 08, 2005 10:19 PM To: php-db@lists.php.net Cc: 'MySQL General List'; 'PHP General List' Subject: Re: [PHP-DB] mysqli connection problem My intention of setting the reply-to was not to offend, or claim you were wrong - merely to move the discussion to the list I felt (and still feel - as I've done it again) is most appropriate for the question. anyway, back to the task at hand ( first: I'm assuming you restarted apache after changing your php.ini - otherwise, that's your problem. ) Whatever the case, the error message clearly shows that it is not reading the value, however it's set - because the error is still showing a blank string for the socket. If it were a permissions problem with the socket, you wouldn't be getting that exact error - at the very least, it would still show the correct socket path. More likely, it would also error with a cannot open socket or equivalent. You may wish to examine ini_get(), ini_get_all(), phpinfo(), or php_ini_scanned_files(), to verify if it is set, or to see if it's being overwritten somewhere. Cheers, Denis Gerasimov wrote: Didn't help me. MySQL socket does exist - /var/lib/mysql/mysql.sock (default location). mysqli.default_socket is NOT set to null but to this value (manually, as you advised) Again, 1. Connection to localhost still fails with message Can't connect to local MySQL server through socket '' (111) 2. Connection to server's domain name fails too (!) with message Access denied for user 'user'@'example.com' (using password: YES) 3. Connection to localhost through mysql shows the following config mysql status -- mysql Ver 14.7 Distrib 4.1.9, for pc-linux-gnu (i686) Connection id: 42 Current database: Current user: [EMAIL PROTECTED] SSL:Not in use Current pager: stdout Using outfile: '' Using delimiter:; Server version: 4.1.9-standard Protocol version: 10 Connection: Localhost via UNIX socket Server characterset:latin1 Db characterset:latin1 Client characterset:latin1 Conn. characterset:latin1 UNIX socket:/var/lib/mysql/mysql.sock Uptime: 1 day 3 hours 1 min 7 sec Threads: 3 Questions: 272 Slow queries: 0 Opens: 64 Flush tables: 1 Open tables: 26 Queries per second avg: 0.003 -- Seems to be a security issue... Any more ideas about these symptoms? - I can't see any reason why you wouldn't be able to use the same socket - you're connecting to the same exact server, it's just a path. You should be perfectly able to set your mysqli.default_socket to the same as the mysql.default_socket. I can't tell you what the default for your system is, but there are php functions to get configuration options, if you don't have it in any obvious places. Cheers, -- - Martin Norland, Database / Web Developer, International Outreach x3257 The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- - Martin Norland, Database / Web Developer, International Outreach x3257 The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] mysqli connection problem
Hello, This question was asked many times, but I can't find a good answer. I am getting this error message while trying to connect to MySQL server (PHP + PEAR::DB_DataObject): Can't connect to local MySQL server through socket '' (111) (notice '' - is that right?) Does anyone have any ideas about how to get rid of this error? Configuration: * RedHat Enterprise Linux AS3 * Apache 2.0.46 * PHP 5.0.2 * MySQL 4.1.9, mysqli ext. Thanks! [Note: reply-to set to php-db as it's multimailed and I don't see this as a mysql general issue, nor php general, but feh.] Well, I don't know the possible reasons for this, so I mailed it to all suitable lists. Looks to be set blank/null/etc. You may be slightly tricked by the existence of both of these - from your standard php.ini... - ; Default socket name for local MySQL connects. If empty, uses the built- in mysql.default_socket = ; Default socket name for local MySQL connects. If empty, uses the built- in ; MySQL defaults. mysqli.default_socket = Didn't help me. MySQL socket does exist - /var/lib/mysql/mysql.sock (default location). mysqli.default_socket is NOT set to null but to this value (manually, as you advised) Again, 1. Connection to localhost still fails with message Can't connect to local MySQL server through socket '' (111) 2. Connection to server's domain name fails too (!) with message Access denied for user 'user'@'example.com' (using password: YES) 3. Connection to localhost through mysql shows the following config mysql status -- mysql Ver 14.7 Distrib 4.1.9, for pc-linux-gnu (i686) Connection id: 42 Current database: Current user: [EMAIL PROTECTED] SSL:Not in use Current pager: stdout Using outfile: '' Using delimiter:; Server version: 4.1.9-standard Protocol version: 10 Connection: Localhost via UNIX socket Server characterset:latin1 Db characterset:latin1 Client characterset:latin1 Conn. characterset:latin1 UNIX socket:/var/lib/mysql/mysql.sock Uptime: 1 day 3 hours 1 min 7 sec Threads: 3 Questions: 272 Slow queries: 0 Opens: 64 Flush tables: 1 Open tables: 26 Queries per second avg: 0.003 -- Seems to be a security issue... Any more ideas about these symptoms? - I can't see any reason why you wouldn't be able to use the same socket - you're connecting to the same exact server, it's just a path. You should be perfectly able to set your mysqli.default_socket to the same as the mysql.default_socket. I can't tell you what the default for your system is, but there are php functions to get configuration options, if you don't have it in any obvious places. Cheers, -- - Martin Norland, Database / Web Developer, International Outreach x3257 The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] mysqli connection problem
My intention of setting the reply-to was not to offend, or claim you were wrong - merely to move the discussion to the list I felt (and still feel - as I've done it again) is most appropriate for the question. anyway, back to the task at hand ( first: I'm assuming you restarted apache after changing your php.ini - otherwise, that's your problem. ) Whatever the case, the error message clearly shows that it is not reading the value, however it's set - because the error is still showing a blank string for the socket. If it were a permissions problem with the socket, you wouldn't be getting that exact error - at the very least, it would still show the correct socket path. More likely, it would also error with a cannot open socket or equivalent. You may wish to examine ini_get(), ini_get_all(), phpinfo(), or php_ini_scanned_files(), to verify if it is set, or to see if it's being overwritten somewhere. Cheers, Denis Gerasimov wrote: Didn't help me. MySQL socket does exist - /var/lib/mysql/mysql.sock (default location). mysqli.default_socket is NOT set to null but to this value (manually, as you advised) Again, 1. Connection to localhost still fails with message Can't connect to local MySQL server through socket '' (111) 2. Connection to server's domain name fails too (!) with message Access denied for user 'user'@'example.com' (using password: YES) 3. Connection to localhost through mysql shows the following config mysql status -- mysql Ver 14.7 Distrib 4.1.9, for pc-linux-gnu (i686) Connection id: 42 Current database: Current user: [EMAIL PROTECTED] SSL:Not in use Current pager: stdout Using outfile: '' Using delimiter:; Server version: 4.1.9-standard Protocol version: 10 Connection: Localhost via UNIX socket Server characterset:latin1 Db characterset:latin1 Client characterset:latin1 Conn. characterset:latin1 UNIX socket:/var/lib/mysql/mysql.sock Uptime: 1 day 3 hours 1 min 7 sec Threads: 3 Questions: 272 Slow queries: 0 Opens: 64 Flush tables: 1 Open tables: 26 Queries per second avg: 0.003 -- Seems to be a security issue... Any more ideas about these symptoms? - I can't see any reason why you wouldn't be able to use the same socket - you're connecting to the same exact server, it's just a path. You should be perfectly able to set your mysqli.default_socket to the same as the mysql.default_socket. I can't tell you what the default for your system is, but there are php functions to get configuration options, if you don't have it in any obvious places. Cheers, -- - Martin Norland, Database / Web Developer, International Outreach x3257 The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- - Martin Norland, Database / Web Developer, International Outreach x3257 The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] mysqli connection problem
Hello, This question was asked many times, but I can't find a good answer. I am getting this error message while trying to connect to MySQL server (PHP + PEAR::DB_DataObject): Can't connect to local MySQL server through socket '' (111) (notice '' - is that right?) Does anyone have any ideas about how to get rid of this error? Configuration: * RedHat Enterprise Linux AS3 * Apache 2.0.46 * PHP 5.0.2 * MySQL 4.1.9, mysqli ext. Thanks! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] mysqli connection problem
Denis Gerasimov wrote: Hello, This question was asked many times, but I can't find a good answer. I am getting this error message while trying to connect to MySQL server (PHP + PEAR::DB_DataObject): Can't connect to local MySQL server through socket '' (111) (notice '' - is that right?) Does anyone have any ideas about how to get rid of this error? Configuration: * RedHat Enterprise Linux AS3 * Apache 2.0.46 * PHP 5.0.2 * MySQL 4.1.9, mysqli ext. Thanks! [Note: reply-to set to php-db as it's multimailed and I don't see this as a mysql general issue, nor php general, but feh.] Looks to be set blank/null/etc. You may be slightly tricked by the existence of both of these - from your standard php.ini... - ; Default socket name for local MySQL connects. If empty, uses the built-in mysql.default_socket = ; Default socket name for local MySQL connects. If empty, uses the built-in ; MySQL defaults. mysqli.default_socket = - I can't see any reason why you wouldn't be able to use the same socket - you're connecting to the same exact server, it's just a path. You should be perfectly able to set your mysqli.default_socket to the same as the mysql.default_socket. I can't tell you what the default for your system is, but there are php functions to get configuration options, if you don't have it in any obvious places. Cheers, -- - Martin Norland, Database / Web Developer, International Outreach x3257 The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php