CException on webapp creation

This might be useful for other newbies, so I’ll spell it out.

I’m using Windows IIS7. My internet folder is c:/inetpub, and my web root folder is C:/inetpub/wwwroot.

I tried to to create the application with a command line like this:

C:\inetpub\wwwroot>yii\framework\yiic.php webapp c:\inetpub\wwwroot\testdrive

It writes out a bunch of lines in the command prompt, I got 1 error message that said "could not open input file: framework/yiic.php, then a series of errors “wwwroot is not recognized as an internal or external comand, oeable program or batch file.” Then, a get a lot of "There is no disk in the drive dialog boxes. “Please insert a disk into drive \Cevice\Harddisk3\DR3.” I’m working off drive C, so what’s this all about? It does write part of the package,a ending up with a little prompt "Create a Web application under ‘C:\inetpub\wwwroot\testdrive’? [yes\no]

Choose "yes", and the folder is created. But when I try to run it, I get a CException: path "C:\inetpub\wwwroot\testdrive\protected\runtime" is not valid. Please make sure it is a directory writable by the Web server process.

This is probably just an ignorance of command line usage, but I haven’t been able to figure it out…

:<)g

If you run it trough the browser and you see " CException: path "C:\inetpub\wwwroot\testdrive\protected\runtime" is not valid. Please make sure it is a directory writable by the Web server process." just make sure the path protected/runtime exists and it has writing permissions.

There’s something else going on here, Vince. Even when I use the standardized installation of yii framework that is created by our host, phpfog, I still get this CException error on the test app that comes with yii. Here’s the error when I try to run it from phpfog (the runtime directory IS there (and empty), and it IS writeable:


CException


Application runtime path "/var/fog/apps/app35423/austintxous.phpfogapp.com/demos/emp/protected/runtime" is not valid. Please make sure it is a directory writable by the Web server process.


/var/fog/apps/app35423/austintxous.phpfogapp.com/framework/base/CApplication.php(271)


259             return $this->_runtimePath;

260         }

261     }

262 

263     /**

264      * Sets the directory that stores runtime files.

265      * @param string $path the directory that stores runtime files.

266      * @throws CException if the directory does not exist or is not writable

267      */

268     public function setRuntimePath($path)

269     {

270         if(($runtimePath=realpath($path))===false || !is_dir($runtimePath) || !is_writable($runtimePath))

271             throw new CException(Yii::t('yii','Application runtime path "{path}" is not valid. Please make sure it is a directory writable by the Web server process.',

272                 array('{path}'=>$path)));

273         $this->_runtimePath=$runtimePath;

274     }

275 

276     /**

277      * Returns the root directory that holds all third-party extensions.

278      * @return string the directory that contains all extensions. Defaults to the 'extensions' directory under 'protected'.

279      */

280     public function getExtensionPath()

281     {

282         return Yii::getPathOfAlias('ext');

283     }

Stack Trace

#0	

+  /var/fog/apps/app35423/austintxous.phpfogapp.com/framework/base/CApplication.php(258): CApplication->setRuntimePath("/var/fog/apps/app35423/austintxous.phpfogapp.com/demos/emp/prote...")

#1	

+  /var/fog/apps/app35423/austintxous.phpfogapp.com/framework/logging/CFileLogRoute.php(60): CApplication->getRuntimePath()

#2	

+  /var/fog/apps/app35423/austintxous.phpfogapp.com/framework/logging/CLogRouter.php(67): CFileLogRoute->init()

#3	

+  /var/fog/apps/app35423/austintxous.phpfogapp.com/framework/base/CModule.php(388): CLogRouter->init()

#4	

+  /var/fog/apps/app35423/austintxous.phpfogapp.com/framework/base/CModule.php(493): CModule->getComponent("log")

#5	

+  /var/fog/apps/app35423/austintxous.phpfogapp.com/framework/base/CApplication.php(146): CModule->preloadComponents()

#6	

+  /var/fog/apps/app35423/austintxous.phpfogapp.com/framework/YiiBase.php(127): CApplication->__construct("protected/config/main.php")

#7	

+  /var/fog/apps/app35423/austintxous.phpfogapp.com/framework/YiiBase.php(100): YiiBase::createApplication("CWebApplication", "protected/config/main.php")

#8	

–  /var/fog/apps/app35423/austintxous.phpfogapp.com/demos/emp/index.php(13): YiiBase::createWebApplication("protected/config/main.php")

08 defined('YII_DEBUG') or define('YII_DEBUG',true);

09 // specify how many levels of call stack should be shown in each log message

10 defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);

11 

12 require_once($yii);

13 Yii::createWebApplication($config)->run();

I had similar error and initally got panic, then after reading the error carefully and also reading this thread, i gave rights to IUSR (using iis 7 as server) on the directory and refreshed, but still got the error. eventually when i checked back after some time, it was all ok :),

bottom line is, for me, giving WRITE rights to server proces on the directory was the solution, hope that helps