【发布时间】:2012-08-06 16:07:03
【问题描述】:
我有以下在本地运行良好的脚本:
<?php
//Report all errors
error_reporting(E_ALL);
if ($handle = opendir('instance/system/application/images/dir/testimages/')){
while (false !== ($fileName = readdir($handle))){
$newName = str_replace(" ", "_", $fileName);
rename($fileName, $newName);
}
echo "All files have been renamed";
closedir($handle);
}
?>
但是,当在网络服务器上运行时,我收到以下错误:
警告:rename(.,.) [function.rename]: Permission denied in C:\inetpub\vhosts\domain.com\httpdocs\rename.php on line 10
知道如何解决这个问题吗?
干杯
注意:
我正在使用 IIS7 和 Windows 服务器。
【问题讨论】:
-
哪个用户拥有instance/system/application/images/dir/testimages/,访问权限是什么,http服务器在哪个用户下运行?
-
确保文件夹目录也被授予权限。
标签: php permissions