I am trying to run a PHP code in a PHP file and it has another php script that needs to be executed but PHP cannot find it. The other PHP script is in another path location than the php file that is called from.
I get an error from PHP about the script that is being called from /Users/peter/Documents/firm/worlddiki/na/ejs
The script from which the following is called is located at location
/Users/peter/Documents/firm/worlddiki/na/ejs
ERROR:
Fatal error: require_once(): Failed opening required '/scripts/checkcmtimg.php' (include_path='.:/usr/lib/php6') in /homepages/27/d468941446/htdocs/na/ejs/efranky.php on line 102
Any help would be appreciated in understanding how the php works in terms of paths.
The include path only applies if you give a relative pathname. You gave an absolute pathname (starts with "/"), so PHP was looking for the file in /scripts (that is, at the root directory of your computer).
You have two options:
Use a relative pathname, like "./scripts/checkcmtimg.php" or simply "scripts/checkcmtimg.php".
This will involve the include_path, searching each directory in the include path for that relative path.
Use an absolute pathname, like "/Users/peter/Documents/firm/worlddiki/na/ejs/scripts/checkcmtimg.php".
This will not use the include_path, it will search for the file in just the one location.