Bug #71874 [NEW]: PHP cannot find mysql.sock file via web
| From: | jfha73 at gmail dot com | Date: | Mon, 21 Mar 2016 18:15:14 +0000 |
| Subject: | Bug #71874 [NEW]: PHP cannot find mysql.sock file via web | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-200005@lists.php.net to get a copy of this message | ||
From: jfha73 at gmail dot com
Operating system: Fedora 23
PHP version: 7.0.4
Package: MySQLi related
Bug Type: Bug
Bug description:PHP cannot find mysql.sock file via web
Description:
------------
Hey guys,
I have a script trying to connect to a localhost database on
mysql/mariadb but it gives me the error that cannot file mysql.sock
message via web, when I run it via console it runs just fine, when I do
a fsockopen("/tmp/mysql.sock", 3306); it opens it, but for some reason
mysqli_connect cannot open that file to connect to MySQL, please check
why PHP is doing this.
NOTE: it does work when run via console, just not the web, my firewall
and selinux are both disabled.
Test script:
---------------
<?php
$link = mysqli_connect("localhost", "root", "password",
"mysql");
if (!$link) {
echo "Error: Unable to connect to MySQL." . PHP_EOL;
echo "Debugging errno: " . mysqli_connect_errno() . PHP_EOL;
echo "Debugging error: " . mysqli_connect_error() . PHP_EOL;
exit;
}
echo "Success: A proper connection to MySQL was made! The mysql database
is gre$
echo "Host information: " . mysqli_get_host_info($link) . PHP_EOL;
mysqli_close($link);
?>
Expected result:
----------------
Show Success message.
Actual result:
--------------
Warning: mysqli_connect(): (HY000/2002): No such file or directory in
/var/www/html/tests/mysql.php on line 3
Error: Unable to connect to MySQL. Debugging errno: 2002 Debugging
error: No such file or directory
--
Edit bug report at https://bugs.php.net/bug.php?id=71874&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71874&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71874&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71874&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=71874&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=71874&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=71874&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=71874&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=71874&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=71874&r=support
Expected behavior: https://bugs.php.net/fix.php?id=71874&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=71874&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=71874&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=71874&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71874&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=71874&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=71874&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=71874&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=71874&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=71874&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=71874&r=mysqlcfg