0

每个人。

我正在使用调整 JPG 图像大小的图像调整器脚本。它在我的远程服务器上运行良好,但不幸的是它在客户端的服务器上不起作用。:-|

目录是可写的(权限设置为 777)。我得到的是:

Error: image does not exist: /home/content/u/s/e/username/correct/path/to/existing/file.jpg

以下是可能有助于调试的代码:

// 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();
}

请注意,作为开发人员,我已获得访问根目录子目录的权限。

我希望我能清楚地说明问题。我不知道幕后发生了什么。非常感谢帮助

4

1 回答 1

1

PHP 必须有权访问指向文件的所有目录,而不仅仅是访问文件本身。如果它对所有目录都没有权限,则相当于放置“免费!拿一个!” 诺克斯堡内保险库内的小册子分发器 - 没用。

于 2011-08-29T03:09:52.380 回答