【Kohana】 Class ‘Kohana’ not found が出た場合。

】 Class ‘’ not found が出た場合。お久しぶりでーす、先日「まーた更新されてないですねぇ」と秘孔を突かれたikedaですこんにちは。

以前からPHPのフレームワークとしてCakePHPを使っていましたが、新たにKohana Frameworkを使い始めています。




‘Kohana’ クラスが見つからないぞ、というException(例外)ですね。



「Autoloader problem  – Kohana Forums」  http://forum.kohanaframework.org/discussion/9249/autoloader-problem/p1

flyderflyder June 2011

Im currently deploying my kohana website with nginx, mysql… pretty usual you’ll say!

I got an error telling me that Class ‘Kohana’ not found. However, the autoloader is able to load many classes before it fails. Look at this log (I print every classes that worked.. its fails at Kohana_HTML) :

I18n Kohana_I18n Debug Kohana_Debug Date Kohana_Date

ErrorException [ Fatal Error ]: html Kohana_HTML Class ‘Kohana’ not found

Can you help me out please


  • AkkiAkki June 2011

    If you set 'errors' => FALSE in the kohana init function. Does it give the same error message?

  • flyderflyder June 2011

    @Akki Now I’m getting a database error. Seems good to me… but I don’t think disabling errors is the best solution. Don’t you think?

  • AkkiAkki June 2011

    Yes that’s true, but I think you don’t understand the purpose.

    You didn’t disable errors with that option, the idea is to (temporarily) reverted the system to standard errors. Because Kohana has this stacking system where even very critical functions can be replaced there’s potential for a vicious error loops occurring. Simple example: you overwrite HTML in your application, and make a typo, HTML doesn’t parse, an error is thrown, the error handler is called, and it displays an error page, which just happens to use the class HTML, so you don’t get the error page, instead you get a ambiguous error with little information. By setting 'errors' => FALSE kohana won’t attach it’s error handlers, so now the loop is broken.

    Fix your database error, and any others. Then revert back; see if you still get errors.

  • flyderflyder June 2011

    @Akki Wow!! That last post solve my problem. In fact, I was just ignoring that Kohana works that way. I turned off debug, then fixed all my errors and put back the setting to TRUE and everything is working perfect now. Thank you so much for your help!!



言われてみりゃそうだわなー( ̄ω ̄;;


Kohanaのエラー捕捉のON/OFFは、APPDIR/bootstrap.php 内にある Kohana::init() のオプションで指定することができます。
      71 /**
     72  * Initialize Kohana, setting the default options.
     73  *
     74  * The following options are available:
     75  *
     76  * - string   base_url    path, and optionally domain, of your application   NULL
     77  * - string   index_file  name of your index file, usually "index.php"       index.php
     78  * - string   charset     internal character set used for input and output   utf-8
     79  * - string   cache_dir   set the internal cache directory                   APPPATH/cache
     80  * - boolean  errors      enable or disable error handling                   TRUE
     81  * - boolean  profile     enable or disable internal profiling               TRUE
     82  * - boolean  caching     enable or disable internal caching                 FALSE
     83  */
     84 Kohana::init(array(
     85     'base_url'      => '/7373/',
     86     'index_file'    => FALSE,
     87     'charset'       => 'utf-8',
     88     'cache'         => FALSE,
     89     'profile'       => FALSE,
     90     'errors'       => FALSE,  // ←ここ
     91 ));
こんな感じで ‘errors’ => FALSE を追加するだけです。


Warning: require() [function.require]: Filename cannot be empty in /home/ikeda/testapp/modules/email/init.php on line 4
Fatal error: require() [function.require]: Failed opening required ” (include_path=’.:/usr/local/lib/php’) in/home/ikeda/testapp/modules/email/init.php on line 4




  1. コメント 0

  1. トラックバック 0

return top