Hello, i have run into problem, i have develpoed website on my local server, everything looked fine, but i have uploaded it to hosting server, and got error:
Quote
include(ModelClass.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory
public static function autoload($className)
{
// use include so that the error PHP file may appear
if(isset(self::$_coreClasses[$className]))
include(YII_PATH.self::$_coreClasses[$className]);
else if(isset(self::$_classes[$className]))
include(self::$_classes[$className]);
else
include($className.'.php'); // <- this line causes problem
}
I do not understand how include(‘ModelClass.php’); can work on framework directory on my local server… if so, why hosting server can’t?
It could be that your hosting server doesn't allow setting PHP include path.
The reason that you can use "ModelClass" without including it explicitly is because Yii uses autoload to automatically include ModelClass.php (without full path) and it relies on PHP include path to find the correct file. In your app config, you have imported "application.models.*", which actually adds the models path to PHP include path.
What can I do if my hosting server doesn’t support include_path, or doesnt allow to change it. I haven’t permision to access php.ini, and i have tryied to set it in .htaccess file (default values, to test), but this caused me 500 Internal Server Error.