Failed to open stream: Permission denied. First time user, can't get first project working.

I’m running Fedora 14, Apache 2.2.17, PHP5. Here’s the exact output:

Warning: require_once(/var/www/html/Yii/framework/yii.php): failed to open stream: Permission denied in /var/www/html/Yii/testdrive/index.php on line 12 Fatal error: require_once(): Failed opening required ‘/var/www/html/Yii/testdrive/../framework/yii.php’ (include_path=’.:/usr/share/pear:/usr/share/php’) in /var/www/html/Yii/testdrive/index.php on line 12

Hi and welcome to the Yii forum

As the error say… you have a permission problem… so check your permissions

Thanks. I figured that much out. /var/www/html/Yii/testdrive/index.php, /var/www/html/Yii/framework/yii.php, and /usr/share/php all have permissions -rwxr-xr-x. I don’t see where the problem could be.

Directory permission?


/var/www/html/Yii = drwxr-xr-x

All Yii subdirectories have the same permissions. Should I be looking somewhere else? Another directory? Could it be a misleading error?

This is probably a misleading error.

Where is your newly created app?

Where is Yii?

It would help if you threw in a bit more info. :)

Hi, i’am a new bee and have same problem when i try to get the first project to run. And i am administrotor on my win 7 machin and never have any problem with access before. Can anyone help to solve my problem, please!:

generate protected/yiic.bat

PHP Error[2]: file_put_contents(C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\yii\testdrive\protected\yiic.bat): failed to open stream: Per

mission denied

in file C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\yii\framework\console\CConsoleCommand.php at line 355

#0 C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\yii\framework\console\CConsoleCommand.php(355): file_put_contents()

#1 C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\yii\framework\cli\commands\WebAppCommand.php(70): WebAppCommand->copyFiles()

#2 C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\yii\framework\console\CConsoleCommandRunner.php(63): WebAppCommand->run()

#3 C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\yii\framework\console\CConsoleApplication.php(88): CConsoleCommandRunner->run()

#4 C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\yii\framework\base\CApplication.php(158): CConsoleApplication->processRequest()

#5 C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\yii\framework\yiic.php(33): CConsoleApplication->run()

#6 C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\yii\framework\yiic(15): require_once()

C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\yii\framework>

Welcome to the forum!

Check if this copy operation will work

C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\yii\framework>

copy cli\views\webapp\protected\yiic.bat ..\testdrive\protected


At first, I thought it was a permissions problem. After changing permissions and getting nowhere, I found the solution in a cakePHP forum… I adjusted it for Yii:

chcon -Rv --type=httpd_user_content_rw_t /var/www/html/yii/

No, sorry, not working.

Access denied (Åtkomst nekad)


This confirms it’s not a Yii problem. Check that you have read permission for the source file and write permission for the destination directory. Possibly also permission to delete an already existing file.


Hi I am a new to yii,

and created a new project (testdrive) on windows7 under xampp.

First there were Problems to get yiic.php running.

After getting the right Path into the Path variable i got yiic running.

In the console you have to write the following:

php C:\xampp\yii\framework\yiic.php webapp …\yii\testdrive

I copied the Project to the demofolder, opened the Browser



Here I got the following error:

require_once(C:\xampp\htdocs\yii\demos\teestdrive/../../test/yii.php): failed to open stream: No such file or directory in C:\xampp\htdocs\yii\demos\testdrive\index.php on line 12

to get the thing started i had to open the index.php in a editor

and change the following line:




Now it works !!!

when creating the new Project via yiic the path wasnt the right one ?

You have to change it manually. It is hard work to get this thing started

and the creators of yii have to think about that. A newbie will throw the whole thing away

and will test zend Framework :wink:

Maybe this will help someone


hi you can change the permission of your folder to write and execute to access for that.