首页 文章

Yii框架错误 - “未能打开流:权限被拒绝”

提问于
浏览
1

我刚开始在Windows 7机器上使用Yii框架 . 它给了我这个恼人的错误,当我重新启动计算机时它会消失 .

任何人都可以了解正在发生的事情以及如何解决这个问题吗?感谢一帮

这是我得到的错误:

PHP warning

copy(C:\www\corp\assets\96296f5a\js\ckeditor\plugins\imagepaste2.3.zip): failed to open stream: Permission denied

C:\www\yii-1.1.13\framework\utils\CFileHelper.php(131)

119 
120         $folder=opendir($src);
121         while(($file=readdir($folder))!==false)
122         {
123             if($file==='.' || $file==='..')
124                 continue;
125             $path=$src.DIRECTORY_SEPARATOR.$file;
126             $isFile=is_file($path);
127             if(self::validatePath($base,$file,$isFile,$fileTypes,$exclude))
128             {
129                 if($isFile)
130                 {
131                     copy($path,$dst.DIRECTORY_SEPARATOR.$file);
132                     if(isset($options['newFileMode']))
133                         chmod($dst.DIRECTORY_SEPARATOR.$file,$options['newFileMode']);
134                 }
135                 elseif($level)
136                     self::copyDirectoryRecursive($path,$dst.DIRECTORY_SEPARATOR.$file,$base.'/'.$file,$fileTypes,$exclude,$level-1,$options);
137             }
138         }
139         closedir($folder);
140     }
141 
142     /**
143      * Returns the files found under the specified directory and subdirectories.

Stack Trace
#0  
+
 C:\www\yii-1.1.13\framework\utils\CFileHelper.php(131): copy("C:\www\corp\protected\extensions\bootstrap\assets\js\ckeditor\pl...", "C:\www\corp\assets\96296f5a\js\ckeditor\plugins\imagepaste2.3.zi...")
#1  
+
 C:\www\yii-1.1.13\framework\utils\CFileHelper.php(136): CFileHelper::copyDirectoryRecursive("C:\www\corp\protected\extensions\bootstrap\assets\js\ckeditor\pl...", "C:\www\corp\assets\96296f5a\js\ckeditor\plugins", "/js/ckeditor/plugins", array(), ...)
#2  
+
 C:\www\yii-1.1.13\framework\utils\CFileHelper.php(136): CFileHelper::copyDirectoryRecursive("C:\www\corp\protected\extensions\bootstrap\assets\js\ckeditor", "C:\www\corp\assets\96296f5a\js\ckeditor", "/js/ckeditor", array(), ...)
#3  
+
 C:\www\yii-1.1.13\framework\utils\CFileHelper.php(136): CFileHelper::copyDirectoryRecursive("C:\www\corp\protected\extensions\bootstrap\assets\js", "C:\www\corp\assets\96296f5a\js", "/js", array(), ...)
#4  
+
 C:\www\yii-1.1.13\framework\utils\CFileHelper.php(63): CFileHelper::copyDirectoryRecursive("C:\www\corp\protected\extensions\bootstrap\assets", "C:\www\corp\assets\96296f5a", "", array(), ...)
#5  
+
 C:\www\yii-1.1.13\framework\web\CAssetManager.php(251): CFileHelper::copyDirectory("C:\www\corp\protected\extensions\bootstrap\assets", "C:\www\corp\assets\96296f5a", array("exclude" => array(".svn", ".gitignore"), "level" => -1, "newDirMode" => 511, "newFileMode" => 438))
#6  
–
 C:\www\corp\protected\extensions\bootstrap\components\Bootstrap.php(458): CAssetManager->publish("C:\www\corp\protected\extensions\bootstrap\assets", false, -1, true)

453         if (isset($this->_assetsUrl))
454             return $this->_assetsUrl;
455         else
456         {
457             $assetsPath = Yii::getPathOfAlias('bootstrap.assets');
458             $assetsUrl = Yii::app()->assetManager->publish($assetsPath, false, -1, YII_DEBUG);
459             return $this->_assetsUrl = $assetsUrl;
460         }
461     }
462 
463     /**

#7  
–
 C:\www\corp\protected\extensions\bootstrap\components\Bootstrap.php(163): Bootstrap->getAssetsUrl()

158      * @param string $cssFile the css file name to register
159      * @param string $media the media that the CSS file should be applied to. If empty, it means all media types.
160      */
161     public function registerAssetCss($cssFile, $media = '')
162     {
163         Yii::app()->getClientScript()->registerCssFile($this->getAssetsUrl() . "/css/{$cssFile}", $media);
164     }
165 
166     /**
167      * Registers the core JavaScript.
168      * @since 0.9.8

#8  
–
 C:\www\corp\protected\extensions\bootstrap\components\Bootstrap.php(124): Bootstrap->registerAssetCss("bootstrap.css")

119     /**
120      * Registers the Bootstrap CSS.
121      */
122     public function registerCoreCss()
123     {
124         $this->registerAssetCss('bootstrap' . (!YII_DEBUG ? '.min' : '') . '.css');
125     }
126 
127     /**
128      * Registers the Bootstrap responsive CSS.
129      * @since 0.9.8

#9  
+
 C:\www\corp\protected\extensions\bootstrap\components\Bootstrap.php(102): Bootstrap->registerCoreCss()
#10     
+
 C:\www\yii-1.1.13\framework\base\CModule.php(387): Bootstrap->init()
#11     
+
 C:\www\yii-1.1.13\framework\base\CModule.php(523): CModule->getComponent("bootstrap")
#12     
+
 C:\www\yii-1.1.13\framework\base\CApplication.php(152): CModule->preloadComponents()
#13     
+
 C:\www\yii-1.1.13\framework\YiiBase.php(125): CApplication->__construct("C:\www\corp/protected/config/main.php")
#14     
+
 C:\www\yii-1.1.13\framework\YiiBase.php(98): YiiBase::createApplication("CWebApplication", "C:\www\corp/protected/config/main.php")
#15     
+
 C:\www\corp\index.php(13): YiiBase::createWebApplication("C:\www\corp/protected/config/main.php")
2013-02-25 11:29:18 Apache/2.2.22 (Win32) PHP/5.3.13 Yii Framework/1.1.13

1 回答

  • 1

    该错误基本上表示YII无法在运行时将所需资产从扩展名复制到assets目录 .

    您的YII项目所在的目录 C:\www\corp 应该可由Web服务器进程写入 .

    我会看看是否存在可能阻止Web服务器创建文件的防火墙/防病毒软件 . 尝试阅读Web服务器日志 .

相关问题