Sql statement error


I have read somewhere here that says that any files in the includes folder will produce a 403 error, is that correct? What can we have in a includes folder? However, because of this error, I have moved some files outside the folder but now I am getting an sql statement error but I think I have set up my dbh.php line correctly. I have included a hostname, username and password, any suggestion?


I am just wondering what is the difference between doing this: include_once ‘/dbh.php’; and include_once ‘dbh.php’;? I can get it to work with the later but not with the former…I also remember that in the actual cpanel, I needed to do this format: include_once DIR.‘/header2.php’; must I do this here?

Also, is the htdocs folder the same as public_html? Also, what can we have in the includes folder? From my understanding, any php files should not be included there or it will generate a 403 error, can we have pictures or videos?

DIR was a variable defined on normal cPanel, but not in this one. You need to include your files by using include_once 'nameofthescript.php', overwriting nameofthescript.php with the script you’re trying to load.
The htdocs folder is the same of a public_html one; the name htdocs is even used while you install XAMPP. But here “includes”, “modules” or any name that includes “chat” may bring you to a 403 Forbidden page, and the same goes for videos contained inside one of those folders or a video that contains “chat” on the name.

So what kind of files are we allowed in the includes folder? I have a file called signup2.php and that was included in the includes folder but got an error. The error message was gone when I moved it outside that folder…

No kind of file is allowed on includes, because it’s included in the list of denied access folders on their hosting server configuration.

Thanks and I seem to be getting another error now but I will create another separate topic for that… cheers!

In the includes folder, you could have any PHP files which are included or required into other PHP scripts, and should not be accessed through the browser directly. This could be shared components (like headers and footers), configuration files or database connection helpers.

This has to do with how relative URL addressing works. Explaining it takes a bit too long to describe here, but I found this article which explains it all quite nicely: Relative and absolute paths, in the file system and on the web server. - Treating PHP Delusions

In short: include 'dbh.php' looks for the file dbh.php in the current directory while include '/dbh.php' looks for the file in the root of the disk of the server.

More or less. cPanel calls is public_html, we call it htdocs. They fulfill the same purpose.

Terrific and thanks for the excellent support here! I am still a bit confused as to what can be inside the includes folder, basically any php files should not be included in this folder? Can I have images in the includes folder ?

So does that mean that pictures and videos can be stored in the includes folder because it is not really accessing it directly?

That depends on how these pictures and videos are going to be accessed. If you are going to use some PHP script to serve this content, then it’s no problem. But note that any file in the includes folder will be inaccessible to web browsers. This is both if you navigate to the URL directly, or when these files are linked to from within another page.

thanks… I think I understand what you are trying to say here…

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.