SQLSTATE [HY000] [2002]没有这样的文件或目录但文件存在

时间:2022-10-14 13:44:55

i have this files on my web folder. but when i try to login it returns

我在我的网络文件夹上有这些文件。但是当我尝试登录时返回

SQLSTATE[HY000] [2002] No such file or directory

in localhost it works perfectly

在localhost它完美地工作

SQLSTATE [HY000] [2002]没有这样的文件或目录但文件存在

below is my code:

下面是我的代码:

after successful login it redirects to this page.

成功登录后,它会重定向到此页面。

<?php
        if (!empty($errors)) {
          echo $errors;
        } else{
          echo "Please wait while the browser redirects you to our Booking System<br><br><img src=/../images/load.gif>
            ";
            header("location:loading.php");
        }
 ?>

1 个解决方案

#1


The problem here may be that you are running this php code from another directory and the loading.php is not in it (for example if the code above is in the php folder). To fix this i suggest you use the absolute path, something like this :

这里的问题可能是你从另一个目录运行这个PHP代码,而load.php不在其中(例如,如果上面的代码在php文件夹中)。为了解决这个问题,我建议你使用绝对路径,如下所示:

 header("location: http://yoursite.com/loading.php");

PS: SQLSTATE[HY000] [2002] is a problem with the connection to mysql server.

PS:SQLSTATE [HY000] [2002]是与mysql服务器连接的问题。

#1


The problem here may be that you are running this php code from another directory and the loading.php is not in it (for example if the code above is in the php folder). To fix this i suggest you use the absolute path, something like this :

这里的问题可能是你从另一个目录运行这个PHP代码,而load.php不在其中(例如,如果上面的代码在php文件夹中)。为了解决这个问题,我建议你使用绝对路径,如下所示:

 header("location: http://yoursite.com/loading.php");

PS: SQLSTATE[HY000] [2002] is a problem with the connection to mysql server.

PS:SQLSTATE [HY000] [2002]是与mysql服务器连接的问题。