Fatal Error: Require_Once()

Hi,i upload my webapp by using FileZilla , and i open the url http://fcsitroomreservation.orgfree.com/fyp that given but some how it give this error


Fatal error: require_once(): Failed opening required '/home/vhosts/fcsitroomreservation.orgfree.com/fyp/yiiframework/framework/yii.php' (include_path='.:/usr/share/pear:/usr/share/php') in /home/vhosts/fcsitroomreservation.orgfree.com/fyp/index.php on line 12

this is my index.php


// change the following paths if necessary

$yii=dirname(__FILE__).'/yiiframework/framework/yii.php';

$config=dirname(__FILE__).'/protected/config/main.php';


// remove the following lines when in production mode

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

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

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


require_once($yii);

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



I no idea is path directory problem or other problem, hope anyone can guide.

The first thing on my mind is check if the file /home/vhosts/fcsitroomreservation.orgfree.com/fyp/yiiframework/framework/yii.php exists on the server.

If it does, check if the file rights are correct, does the web server have access to the files?

ya, it allow to access it to the file.

Try that:


$yii=dirname(__FILE__).'/../yiiframework/framework/yii.php';



It give this error.


Application runtime path "/home/vhosts/fcsitroomreservation.orgfree.com/fyp/protected/runtime" is not valid. Please make sure it is a directory writable by the Web server process. 

It looks like the index.php file is in ‘/home/vhosts/fcsitroomreservation.orgfree.com/fyp’ folder, Is this correct?

Where is the yiiframework folder physically located?

the yiiframework folder is under the same root with fyp folder. but now i create the new directory folder fcsitreservation in filezilla and i upload both fyp and yiiframework folder under the fcsitreservation folder.

The fyp folder become

fcsitroomreservation.orgfree.com/fcsitreservation/fyp/

while the yiiframework is

fcsitroomreservation.orgfree.com/fcsitreservation/yiiframework/

this is the link:http://fcsitroomreservation.orgfree.com/

i really try and error on the index.php that under fyp folder.

Remember that the php require()'s are OS files not web files. When I go to


http://fcsitroomreservation.orgfree.com/

do I get


/home/vhost/fcsitroomreservation.orgfree.com/fcsitreservation/fyp/index.php

Given that:


/home/vhost/fcsitroomreservation.orgfree.com/fcsitreservation/yiiframework/

is located /../../ from /fyp/.

try:


$yii=dirname(__FILE__).'/../../yiiframework/framework/yii.php';

try:


$yii=dirname(__FILE__).'/../../yiiframework/framework/yii.php';

[/quote]

i still can error after i change the code.

i get this error


Fatal error: require_once(): Failed opening required '/home/vhosts/fcsitroomreservation.orgfree.com/fcsitreservation/fyp/../../yiiframework/framework/yii.php' (include_path='.:/usr/share/pear:/usr/share/php') in /home/vhosts/fcsitroomreservation.orgfree.com/fcsitreservation/fyp/index.php on line 12

if i put


$yii=dirname(__FILE__).'/../yiiframework/framework/yii.php';

it give me this


Application runtime path "/home/vhosts/fcsitroomreservation.orgfree.com/fcsitreservation/fyp/protected/runtime" is not valid. Please make sure it is a directory writable by the Web server process. 

OK. THis error is saying that you are getting to the Yii framework with ‘/../yiiframework/’ setting. However the ‘protected/runtime/’ dir is the problem. If ‘runtime’ exists on the server check the permissions. The user that the web server is running under is unable to write to that dir.

I believe the Yii documentation on installation says that the ‘/protected/runtime/’ and the root ‘assests’ need to be be writable by the server, and indicate the permissions needed. Check with you host admin about how to make these dirs accessible by the web server.

thank for the information, but i change another webserver, it not have this problem.

I had the same problem as in topic (Linux host). I changed the SElinux context: for all dirs "assets", "runtime" and "framework" - httpd_var_run_t; for each other is httpd_sys_content_t. My problem was fixed.