Bug #71829 [Nab]: PHP not able to connect to mySQL database

From: Date: Thu, 17 Mar 2016 15:14:04 +0000
Subject: Bug #71829 [Nab]: PHP not able to connect to mySQL database
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-199895@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71829&edit=1 ID: 71829 Updated by: requinix@php.net Reported by: jfha73 at gmail dot com Summary: PHP not able to connect to mySQL database Status: Not a bug Type: Bug Package: MySQLi related Operating System: Linux PHP Version: 7.0.4 Block user comment: N Private report: N New Comment: This isn't really the best place for general help. Try a mailing list or online forum. http://php.net/support.php Previous Comments: ------------------------------------------------------------------------ [2016-03-17 15:11:50] jfha73 at gmail dot com This is weird, if I run: php mysqltest.php it works, but if I do it via web it says it cannot find the file, any ideas? ------------------------------------------------------------------------ [2016-03-16 15:09:12] jfha73 at gmail dot com I just re-configured my mysql to create the mysql.sock at /tmp/mysql.sock and edited php.ini to read mysql.default_socket where the mysql.sock is and it still won't connect using name (localhost), I can see the newly created mysql.sock file in /tmp, but PHP 7.0.4 seems not to be able to locate it, any other ideas? Thanks. ------------------------------------------------------------------------ [2016-03-15 17:15:54] requinix@php.net Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Due to the volume of reports we can not explain in detail here why your report is not a bug. The support channels will be able to provide an explanation for you. Thank you for your interest in PHP. Specifying "localhost" as the hostname will try to use a socket file. Your MySQL server may not have created one. ------------------------------------------------------------------------ [2016-03-15 16:42:41] jfha73 at gmail dot com Update to the ticket, it does work when I connect using IP address (127.0.0.1) but when name (localhost) is used, I checked my /etc/hosts and it has 127.0.0.1 set as localhost, also my firewall is disabled. ------------------------------------------------------------------------ [2016-03-15 16:28:58] jfha73 at gmail dot com Description: ------------ All it gets is this: SQLSTATE[HY000] [2002] No such file or directory MySQL can be accessed via console, just not using PHP with phpMyAdmin or a WebApp that uses MySQL. Any idea what I can do about this? Thanks. Test script: --------------- phpMyAdmin Expected result: ---------------- Connect to mySQL database server Actual result: -------------- Error saying No such file or directory. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=71829&edit=1

« previous php.bugs (#199895) next »