Hello, I am registering for the site. I connect the database and write the error:

PHP Fatal error: require (): Failed opening required '/lib/rb.php' (include_path = '.: / Usr / share / php') in /home/s/sashkai0/site/public_html/db.php on line 3

I already do a site on a hosting (not local). user (this is a login to enter the hosting?). The first screenshot is the code of the db.php file for connecting the database, and the second is the list of databases. How to fix guys? database code Database

    3 answers 3

    I will use this question to draw the attention of all newcomers to two very important points:

    1. It is very important for a novice programmer to carefully read the error message. Even with a Google translator, it will give at least a rough idea of ​​the problem. In particular, that it has nothing to do with the list of databases. As for the file that we are trying to connect through require. That is, after reading the error message, you will no longer rush around the injured saiga in different directions, but will deal with the specific cause of the problem. In particular, it helps a lot to google the error message.
    2. It is very important for a novice programmer to learn at least the basics of computer literacy. In this case, the difference between relative and absolute paths . In this case, it is clear that there is an attempt to connect the /lib/rb.php file from the root of the disk , although, of course, there is no such file and cannot be. And the file is in the root of the site , that is, you need to refer to it as

       require $_SERVER['DOCUMENT_ROOT'].'/lib/rb.php'; 
    • and 'user', 'password' is the data that you need to take? I have on the hosting said that the user name is the same as the database name, and the database password? - Dem

    He says to you in English: I cannot find (open) the file /lib/rb.php called on line 3 in the file /home/s/sashkai0/site/public_html/db.php.

      Create db.php , plug rb.php into it and then connect db.php everywhere, if you don’t, then there may be problems.