Required_once file not routing correctly

78 views Asked by At

I am attempting to include a file, which I have done so successfully on the exact page which I am having issues now. For some reason the following calls are not working. I have tried all three methods.

require_once ("required_files/page-count.php");
require_once 'required_files/page-count.php';
include_once("required_files/page-count.php");

Initially I named the folder php instead of required_files and I received error messages, so I changed it thinking that php may have been a restricted folder name. Now since I have changed it, it appears it is still searching for the previous name I had, but it is no where within my code.

The errors:

Warning: require_once(php/page-count): failed to open stream: No such file or directory in /home4/public_html/account/required_files/page-count.php on line 40

Fatal error: require_once(): Failed opening required 'php/page-count' (include_path='.:/opt/php55/lib/php') in /home4/public_html/account/required_files/page-count.php on line 40

The home files is the file I am trying to include the file page-count.php file within.

Does anyone have any idea what is going on and why this won't work?

enter image description here

In required_files folder:

enter image description here

1

There are 1 answers

1
Jason L On

The /opt/php55/lib/php is the default path. It will try there if it can't find it anywhere else.

I would echo a test.php like this:

This will tell you if it's /home4/publc_html/ or /home4/public_html/account as your root directory.

It is good form to use $_SERVER['DOCUMENT_ROOT'] because your host may move you to a new server with a different home folder. This way it will always resolve to the correct place.