Database Error: SQLSTATE[HY000] [2002] No such a file or directory
Notice: Undefinied Variable: mysql in
/home/voll4_6/epizy.com/epiz_26526750/htdocs/assets/php/footer.php
on line 64
Fatal error: Call a member function prepare() on null in /home/voll4_6/epizy.com/epiz_26526750/htdocs/assets/php/footer.php
on line 64
Other Information
I tried to add the mysql.php file to the footer.php file, which also works completely on the localhost web server, but as soon as I loaded it onto infinityfree, nothing works anymore. I tried everything like that in a file to change the PHP version, etc. and thatâs why Iâm convinced that itâs up to the hoster because everything works on my root web server.
If you get the error âNo such file or directoryâ error, it means the database connection is using localhost as the database hostname. Period. There is no other way why you could get this error.
If you did configure something else, that means your software isnât using the configuration you specified. That could be a problem with the way you set the configuration or just a bug in your software.
And does your root server happen to have the database server on the same machine as the web server?
Just because something works at server A and not server B, that doesnât mean that server B is broken. It could also be (and Iâm very sure it is) that the bug in your code is present on both servers, but just doesnât happen to be visible on your root server.
I use Apache and not nginx but thats should be the same becouse it is only a get & write command for the databse and one require() tag for the mysql.php file. But I can try to fix it. And I have one Question can I Use an Google Domain for an Domain for Infinityfree?
Warning : require_once(): http:// wrapper is disabled in the server configuration by allow_url_include=0 in /home/vol14_6/epizy.com/epiz_26526750/htdocs/server/news-system/news-vorschau.php on line 2
For security, you cannot put a full URL, you must put it as a local path in the PHP require() and include(). Like the Admin said, the only reason this can be happening is because your SQL server in your mysql.php file is set to localhost.
and when I put the mysql script in the index.php file is there an new error with
Fatal error : Call to a member function prepare() on null in /home/vol14_6/epizy.com/epiz_26526750/htdocs/server/news-system/news-vorschau.php on line 6
So say your footer.php file is located in /htdocs, in index.php, you would have require ("footer.php");. If itâs in a sub-folder, the code would be more like require("folder/footer.php");
Donât worry about this error, itâs occurring because your code cannot connect to the database, which was the original error in this topic.
Database Error: SQLSTATE[HY000] [2002] No such file or directory Notice : Undefined variable: mysql in /home/vol14_6/epizy.com/epiz_26526750/htdocs/server/news-system/index.php on line 22
Fatal error : Call to a member function prepare() on null in /home/vol14_6/epizy.com/epiz_26526750/htdocs/server/news-system/index.php on line 22
Could you try removing the spaces from the DSN (the string in the new PDO line)? Itâs possible that adding the spaces for âreadabilityâ makes the PDO library unable to read the setting and fall back to defaults which donât work.