1
我在Linux-的Fedora 18和功能move_uploaded_file顯示警告工作:Linux的許可move_uploaded_file
錯誤:
[Wed Jun 05 18:41:21.731524 2013] [:error] [pid 11502] [client 127.0.0.1:40340] PHP Warning: move_uploaded_file(/var/www/html/estampa/management/include/1.jpg): failed to open stream: Permission denied in /var/www/html/estampa/management/include/sys_content.php on line 31, referer: estampa/management/sistema/?secc=noticias&oper=mod&id=22
[Wed Jun 05 18:41:21.731547 2013] [:error] [pid 11502] [client 127.0.0.1:40340] PHP Warning: move_uploaded_file(): Unable to move '/tmp/phpH5BLGD' to '/var/www/html/estampa/management/include/1.jpg' in /var/www/html/estampa/management/include/sys_content.php on line 31, referer: estampa/management/sistema/?secc=noticias&oper=mod&id=22
php腳本:
$archivo = $_FILES['imagen']['name'];
if($archivo != ""){
$target_path = "../../../web/images/pub/";
$target_path = dirname(__FILE__)."/";
$target_path = $target_path . basename($_FILES['imagen']['name']);
if($error_up = move_uploaded_file($_FILES['imagen']['tmp_name'], $target_path)) {
$var = "El archivo ". basename($_FILES['imagen']['name']). " ha sido subido";
}
else{
$var = "Ha ocurrido un error, trate de nuevo!";
}
}
#ls -lrt |grep include
drwxr-xr-x. 2 apache apache 4096 May 26 15:58 include
# chmod 0777 -R include
# chown apache:apache include
httpd.conf
<Directory "/var/www/html">
httpd.conf
Options -Indexes
AllowOverride None
Order allow,deny
Allow from all
</Directory>
和功能複製()同樣的錯誤
你能幫助我,請!
終於起作用了!感謝asmecher,設置權限chcon -R -t httpd_sys_rw_content_t文件夾,並查看ls -halZ – user1710788