captainccs — 2013-02-21T17:52:07-05:00 — #1
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:
tpunt — 2013-02-21T18:41:09-05:00 — #2
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?
captainccs — 2013-02-21T19:05:58-05:00 — #3
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
wh33t — 2013-02-21T19:49:31-05:00 — #4
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.
captainccs — 2013-02-21T21:11:37-05:00 — #5
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) ?
tpunt — 2013-02-22T06:02:23-05:00 — #6
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:
captainccs — 2013-02-22T11:06:58-05:00 — #7
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';