Showing posts with label Yii Require Once Cpanel Error. Show all posts
Showing posts with label Yii Require Once Cpanel Error. Show all posts

Monday, July 1, 2013

Yii Require Once Error Cpanel

I tried to install Yii the first time on my cpanel hosting. However, when I try to launch my website I got the following errors:

Warning: require_once(/home/user_name/public_html/yii/demos/your_app/../../YII/framework/yii.php) [function.require-once]: failed to open stream: No such file or directory in /home/user_name/public_html/yii/demos/your_app/index.php on line 12

Fatal error: require_once() [function.require]: Failed opening required '/home/user_name/public_html/yii/demos/your_app/../../YII/framework/yii.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/user_name/public_html/yii/demos/your_app/index.php on line 12

However, when I try the Yii demo apps like hangman, it works.

So I copied yii/demos/hangman/index.php to your_app/index.php file and it works. The reason I got the above error is because the yii path on my cpanel is different than on my local.

My cpanel index.php (I install yii on my public_html/yii)

<?php

// change the following paths if necessary
$yii=dirname(__FILE__).'/../../framework/yii.php';
$config=dirname(__FILE__).'/protected/config/main.php';

// remove the following line when in production mode
// defined('YII_DEBUG') or define('YII_DEBUG',true);

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