Everyone.
I am using an image resizer script that resizes JPG images. It worked fine on my remote server but unfortunately it doesn't work on the client's server. :-|
The directories are writable (permission is set to 777). All I am getting is:
Error: image does not exist: /home/content/u/s/e/username/correct/path/to/existing/file.jpg
Here's the bit of the code that may be helpful in debugging:
// Images must be local files, so for convenience we strip the domain if it's there
$image = preg_replace('/^(s?f|ht)tps?:\/\/[^\/]+/i', '', (string) $_GET['image']);
// ...
// Strip the possible trailing slash off the document root
$docRoot = preg_replace('/\/$/', '', DOCUMENT_ROOT);
//...
if (!file_exists($docRoot . $image))
{
header('HTTP/1.1 404 Not Found');
echo 'Error: image does not exist: ' . $docRoot . $image;
exit();
}
Please note that as a developer I have been given permission to access a subdirectory of the root directory.
I hope I made the problem case clear. I am at a loss as to what's going on behind the scene. Help is much apreciated
PHP has to have access to all the directories leading up to the file, not just access to the file itself. If it doesn't have permissons on ALL of the directories, it's the equvialent of putting a "Free! take one!" pamphlet dispenser inside a vault inside Fort Knox - useless.