I'm getting this error:
require_once() [function.require]: Failed opening required 'Archive/Tar.php' (include_path='.:/usr/local/php5/lib/php')
I'm on a shared server and 'Archive/Tar.php' is at
What would the correct include_path be? :inspector:
What directory are you including the file from? Also, can you post the require statement so that we can see where you're going wrong?
I'm on shared LAMP server.
PEAR is installed at
The file calling the Archive/Tar.php script is at
The require statement is
My question is how is that "include_path" set in the ".:/usr/etc./etc./etc." format?
In other words, what do I use for an "include_path" instead of
Woops, I misread your post.
I think in this case, a relative path such as Archive/Tar.php will be assumed that Archive is in the PEAR installation directory. Anytime I run PHP from a command line I always use absolute pathing.
I guess my question comes down to "What does the /usr/ in the include path mean? How does it relate to the file path (/home/user/the/rest/of/the/path) ?
Using a relative path, can you tell me if the following works?
It looks like we need to go up two directories (from classes to user), and then traverse along the php and Archive directories.
I would suggest, however, that you use an absolute path because no resolving has to be done (making them quicker). For this, we can use the $SERVER['DOCUMENTROOT'] variable, and then add on the relative path to the file from there. I'm not sure what you have your DOCUMENT_ROOT directive defined as, but if you echo it out, then your can just add on the necessary directories to it:
This works (3 back, not 2)
This does not work
The script happens to be in a subdomain and $SERVER['DOCUMENTROOT'] returns
which is in the public directory, not the root. In the main domain it would return
not too reliable.
Much neglected FILE, on the other hand, returns
which is better but still no help.
I'm sticking with absolute path
EDIT - This also works:
$path = $_SERVER['DOCUMENT_ROOT'];
$pos = strpos($path, 'public_html');
$path = substr($path, 0, $pos).'php';
This topic is now closed. New replies are no longer allowed.