开发者

Open_basedir restriction oddness

I'm having a problem with move_uploaded_file in PHP, with the returned error message telling me that the open_basedir restriction is in place (which I've set) and that on the path I'm attempting to write to is not within the allowed paths, but it is (and is clearly displayed on the error message).

Has anyone come across this before?

Edit:

Sorry, the error message might help!:

Unhandled Error (/var/www/vhosts/(myhost)/libs/imanager.php, 226): 2, 开发者_JAVA技巧 '...move_uploaded_file() [function.move-uploaded-file]: open_basedir restriction in effect. File(/var/www/vhosts/(myhost)/httpdocs/tributes/images/precrop/1317227884228.jpg) is not within the allowed path(s): (/var/www/vhosts/(myhost)/httpdocs/tributes/images/precrop/:/tmp)...'


Not come across this before. You can only use move_uploaded_file if the file you are trying to move was uploaded using PHP. Try removing the trailing '/' from your precrop directory in the configuration.

There's some extra open_basedir information here: http://www.bigsoft.co.uk/blog/index.php/2007/12/30/fixing-php-s-require-open_basedir-restri


There is PHP bug ("Regression (5.3.3-5.3.4) in open_basedir with a trailing forward slash"), that is triggered when open_basedir have trailing slash. As workaround remove trailing slash from path in open_basedir. This bug should be fixed in recent versions of PHP.


Note that open_basedir will also fail if you have symlinks along the path. From http://php.net/open_basedir:

All symbolic links are resolved, so it's not possible to avoid this restriction with a symlink.

Please check if /var/www/vhosts/(yourhost)/httpdocs/tributes/images/precrop/ is a real directory path, not symlinked one.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜