Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [Kohana] Nie działa po instalacji pomimo spełnienia wymagań
Forum PHP.pl > Forum > PHP > Frameworki
Agape
Ściągnąłem właśnie KohanaPHP v3.0.6 "sumar hiti", wrzyuciłem na ftp do katalogu kohana3. Serwer spełnił wszystkie podstawowe wymagania, z opcjonalnych nie ma cURL. Usunąłem install.php i nie działa:
Kod
ReflectionException [ -1 ]: Class controller_kohana3 does not exist

SYSPATH/classes/kohana/request.php [ 1007 ]
1002         Request::$current = $this;
1003
1004         try
1005         {
1006             // Load the controller using reflection
1007             $class = new ReflectionClass($prefix.$this->controller);
1008
1009             if ($class->isAbstract())
1010             {
1011                 throw new Kohana_Exception('Cannot create instances of abstract :controller',
1012                     array(':controller' => $prefix.$this->controller));


W aplication/config nie było nic. Skopiowałem więc z kohana2 config.php ale nic nie dało. sciana.gif
ziqzaq
Może napisz co chciałeś osiągnąć i jak skonfigurowałeś ko3 (struktura plików, bootstrap.php itd.).
Z tego co widzę to wywołujesz "http://moj.host/kohana3" i wygląda na to że nie masz takiego kontrolera.
oidnus
Spróbuj może takich ustawień
  1. Kohana::init(array(
  2. 'base_url' => '/kohana3/',
  3. 'index_file' => 'index.php',
  4. ));
Agape
Ogólnie chciałem się nauczyć frameworka, więc wrzuciłem zainstalowałem i nie robiłem nic więcej. Niestety czysta kohana wywala błędami. Próbowałem powyższego kodu ale to samo ;/. Jak dałem bezpośredni adres http://moj.host/kohana3/index.php błąd jest troche inny:

Kod
Kohana_Request_Exception [ 0 ]: Unable to find a route to match the URI: kohana3/index.php

SYSPATH/classes/kohana/request.php [ 635 ]
630         }
631
632         // No matching route for this URI
633         $this->status = 404;
634
635         throw new Kohana_Request_Exception('Unable to find a route to match the URI: :uri',
636             array(':uri' => $uri));
637     }
638
639     /**
640      * Returns the response as the string representation of a request.


i

  1. 1. SYSPATH/classes/kohana/request.php [ 272 ] ť Kohana_Request->__construct(arguments)
  2. 267
  3. 268 // Remove all dot-paths from the URI, they are not valid
  4. 269 $uri = preg_replace('#\.[\s./]*/#', '', $uri);
  5. 270
  6. 271 // Create the instance singleton
  7. 272 Request::$instance = Request::$current = new Request($uri);
  8. 273
  9. 274 // Add the default Content-Type header
  10. 275 Request::$instance->headers['Content-Type'] = 'text/html; charset='.Kohana::$charset;
  11. 276 }
  12. 277
  13.  
  14. 2. APPPATH/bootstrap.php [ 95 ] ť Kohana_Request::instance()
  15. 90
  16. 91 /**
  17.  92 * Execute the main request. A source of the URI can be passed, eg: $_SERVER['PATH_INFO'].
  18.  93 * If no source is specified, the URI will be automatically detected.
  19.  94 */
  20. 95 echo Request::instance()
  21. 96 ->execute()
  22. 97 ->send_headers()
  23. 98 ->response;
  24.  
  25. 3. DOCROOT/index.php [ 103 ] ť require(arguments)
  26. 98 // Load empty core extension
  27. 99 require SYSPATH.'classes/kohana'.EXT;
  28. 100 }
  29. 101
  30. 102 // Bootstrap the application
  31. 103 require APPPATH.'bootstrap'.EXT;


Poprzednia wersja 2.x działała bez problemu, po zainstalowaniu tej mimo że w innym katalogu nic nie działa i już nie wiem ...

routes.php mam taki:
  1. <?php defined('SYSPATH') OR die('No direct access allowed.');
  2. /**
  3.  * @package Core
  4.  *
  5.  * Sets the default route to "welcome"
  6.  */
  7. $config['_default'] = 'welcome';


w bootstrap.php nic nie zmieniałem a jak zmieniłem nic nie dało.

zamieszczam jeszcze 2 pliki

config.php
  1. <?php defined('SYSPATH') OR die('No direct access allowed.');
  2. /**
  3.  * Base path of the web site. If this includes a domain, eg: localhost/kohana/
  4.  * then a full URL will be used, eg: <a href="http://localhost/kohana/" target="_blank">http://localhost/kohana/</a>. If it only includes
  5.  * the path, and a site_protocol is specified, the domain will be auto-detected.
  6.  */
  7. $config['site_domain'] = '/';
  8.  
  9. /**
  10.  * Force a default protocol to be used by the site. If no site_protocol is
  11.  * specified, then the current protocol is used, or when possible, only an
  12.  * absolute path (with no protocol/domain) is used.
  13.  */
  14. $config['site_protocol'] = '';
  15.  
  16. /**
  17.  * Name of the front controller for this application. Default: index.php
  18.  *
  19.  * This can be removed by using URL rewriting.
  20.  */
  21. $config['index_page'] = 'index.php';
  22.  
  23. /**
  24.  * Fake file extension that will be added to all generated URLs. Example: .html
  25.  */
  26. $config['url_suffix'] = '';
  27.  
  28. /**
  29.  * Length of time of the internal cache in seconds. 0 or FALSE means no caching.
  30.  * The internal cache stores file paths and config entries across requests and
  31.  * can give significant speed improvements at the expense of delayed updating.
  32.  */
  33. $config['internal_cache'] = FALSE;
  34.  
  35. /**
  36.  * Internal cache directory.
  37.  */
  38. $config['internal_cache_path'] = APPPATH.'cache/';
  39.  
  40. /**
  41.  * Enable internal cache encryption - speed/processing loss
  42.  * is neglible when this is turned on. Can be turned off
  43.  * if application directory is not in the webroot.
  44.  */
  45. $config['internal_cache_encrypt'] = FALSE;
  46.  
  47. /**
  48.  * Encryption key for the internal cache, only used
  49.  * if internal_cache_encrypt is TRUE.
  50.  *
  51.  * Make sure you specify your own key here!
  52.  *
  53.  * The cache is deleted when/if the key changes.
  54.  */
  55. $config['internal_cache_key'] = 'foobar-changeme';
  56.  
  57. /**
  58.  * Enable or disable gzip output compression. This can dramatically decrease
  59.  * server bandwidth usage, at the cost of slightly higher CPU usage. Set to
  60.  * the compression level (1-9) that you want to use, or FALSE to disable.
  61.  *
  62.  * Do not enable this option if you are using output compression in php.ini!
  63.  */
  64. $config['output_compression'] = FALSE;
  65.  
  66. /**
  67.  * Enable or disable global XSS filtering of GET, POST, and SERVER data. This
  68.  * option also accepts a string to specify a specific XSS filtering tool.
  69.  */
  70. $config['global_xss_filtering'] = TRUE;
  71.  
  72. /**
  73.  * Enable or disable hooks.
  74.  */
  75. $config['enable_hooks'] = FALSE;
  76.  
  77. /**
  78.  * Log thresholds:
  79.  * 0 - Disable logging
  80.  * 1 - Errors and exceptions
  81.  * 2 - Warnings
  82.  * 3 - Notices
  83.  * 4 - Debugging
  84.  */
  85. $config['log_threshold'] = 1;
  86.  
  87. /**
  88.  * Message logging directory.
  89.  */
  90. $config['log_directory'] = APPPATH.'logs';
  91.  
  92. /**
  93.  * Enable or disable displaying of Kohana error pages. This will not affect
  94.  * logging. Turning this off will disable ALL error pages.
  95.  */
  96. $config['display_errors'] = TRUE;
  97.  
  98. /**
  99.  * Enable or disable statistics in the final output. Stats are replaced via
  100.  * specific strings, such as {execution_time}.
  101.  *
  102.  * @see <a href="http://docs.kohanaphp.com/general/configuration" target="_blank">http://docs.kohanaphp.com/general/configuration</a>
  103.  */
  104. $config['render_stats'] = TRUE;
  105.  
  106. /**
  107.  * Filename prefixed used to determine extensions. For example, an
  108.  * extension to the Controller class would be named MY_Controller.php.
  109.  */
  110. $config['extension_prefix'] = 'MY_';
  111.  
  112. /**
  113.  * Additional resource paths, or "modules". Each path can either be absolute
  114.  * or relative to the docroot. Modules can include any resource that can exist
  115.  * in your application directory, configuration files, controllers, views, etc.
  116.  */
  117. $config['modules'] = array
  118. (
  119. // MODPATH.'auth', // Authentication
  120. // MODPATH.'kodoc', // Self-generating documentation
  121. // MODPATH.'gmaps', // Google Maps integration
  122. // MODPATH.'archive', // Archive utility
  123. // MODPATH.'payment', // Online payments
  124. // MODPATH.'unit_test', // Unit testing
  125. );
  126.  


bootstrap.php
  1. <?php defined('SYSPATH') or die('No direct script access.');
  2.  
  3. //-- Environment setup --------------------------------------------------------
  4.  
  5. /**
  6.  * Set the default time zone.
  7.  *
  8.  * @see <a href="http://kohanaframework.org/guide/using.configuration" target="_blank">http://kohanaframework.org/guide/using.configuration</a>
  9.  * @see <a href="http://php.net/timezones" target="_blank">http://php.net/timezones</a>
  10.  */
  11. date_default_timezone_set('America/Chicago');
  12.  
  13. /**
  14.  * Set the default locale.
  15.  *
  16.  * @see <a href="http://kohanaframework.org/guide/using.configuration" target="_blank">http://kohanaframework.org/guide/using.configuration</a>
  17.  * @see <a href="http://php.net/setlocale" target="_blank">http://php.net/setlocale</a>
  18.  */
  19. setlocale(LC_ALL, 'en_US.utf-8');
  20.  
  21. /**
  22.  * Enable the Kohana auto-loader.
  23.  *
  24.  * @see <a href="http://kohanaframework.org/guide/using.autoloading" target="_blank">http://kohanaframework.org/guide/using.autoloading</a>
  25.  * @see <a href="http://php.net/spl_autoload_register" target="_blank">http://php.net/spl_autoload_register</a>
  26.  */
  27. spl_autoload_register(array('Kohana', 'auto_load'));
  28.  
  29. /**
  30.  * Enable the Kohana auto-loader for unserialization.
  31.  *
  32.  * @see <a href="http://php.net/spl_autoload_call" target="_blank">http://php.net/spl_autoload_call</a>
  33.  * @see <a href="http://php.net/manual/var.configuration.php#unserialize-callback-func" target="_blank">http://php.net/manual/var.configuration.ph...e-callback-func</a>
  34.  */
  35. ini_set('unserialize_callback_func', 'spl_autoload_call');
  36.  
  37. //-- Configuration and initialization -----------------------------------------
  38.  
  39. /**
  40.  * Initialize Kohana, setting the default options.
  41.  *
  42.  * The following options are available:
  43.  *
  44.  * - string base_url path, and optionally domain, of your application NULL
  45.  * - string index_file name of your index file, usually "index.php" index.php
  46.  * - string charset internal character set used for input and output utf-8
  47.  * - string cache_dir set the internal cache directory APPPATH/cache
  48.  * - boolean errors enable or disable error handling TRUE
  49.  * - boolean profile enable or disable internal profiling TRUE
  50.  * - boolean caching enable or disable internal caching FALSE
  51.  */
  52. Kohana::init(array(
  53. 'base_url' => '/',
  54. 'index_file' => FALSE,
  55. ));
  56.  
  57. /**
  58.  * Attach the file write to logging. Multiple writers are supported.
  59.  */
  60. Kohana::$log->attach(new Kohana_Log_File(APPPATH.'logs'));
  61.  
  62. /**
  63.  * Attach a file reader to config. Multiple readers are supported.
  64.  */
  65. Kohana::$config->attach(new Kohana_Config_File);
  66.  
  67. /**
  68.  * Enable modules. Modules are referenced by a relative or absolute path.
  69.  */
  70. Kohana::modules(array(
  71. // 'auth' => MODPATH.'auth', // Basic authentication
  72. // 'cache' => MODPATH.'cache', // Caching with multiple backends
  73. // 'codebench' => MODPATH.'codebench', // Benchmarking tool
  74. // 'database' => MODPATH.'database', // Database access
  75. // 'image' => MODPATH.'image', // Image manipulation
  76. // 'orm' => MODPATH.'orm', // Object Relationship Mapping
  77. // 'pagination' => MODPATH.'pagination', // Paging of results
  78. // 'userguide' => MODPATH.'userguide', // User guide and API documentation
  79. ));
  80.  
  81. /**
  82.  * Set the routes. Each route must have a minimum of a name, a URI and a set of
  83.  * defaults for the URI.
  84.  */
  85. Route::set('default', '(<controller>(/<action>(/<id>)))')
  86. ->defaults(array(
  87. 'controller' => 'welcome',
  88. 'action' => 'index',
  89. ));
  90.  
  91. /**
  92.  * Execute the main request. A source of the URI can be passed, eg: $_SERVER['PATH_INFO'].
  93.  * If no source is specified, the URI will be automatically detected.
  94.  */
  95. echo Request::instance()
  96. ->execute()
  97. ->send_headers()
  98. ->response;
  99.  
ziqzaq
Plik config.php, routes.php?... może zanim spróbujesz tych ustawień to poprzeglądaj sobie unofficial guide i zobacz jak działa i gdzie się konfiguruje kohane v3.
Próbowałeś rady oidnus'a?
Agape
Cytat(Agape @ 16.06.2010, 14:10:28 ) *
Próbowałem powyższego kodu ale to samo ;/.


Cos z konfiguracja serwera jest nie tak, zainstalowalem na innym i poszlo bez problemu. Ten unofficial pare razy wertowalem tak jak i google.


Dobra, działa już. O dziwo tylko na moim koncie użytkownika nie działa ale już sobie poradze
xairo
Miałem ten sam problem.

Zmień
  1. Kohana::init(array(
  2. 'base_url' => '/',
  3. ));


na

  1. Kohana::init(array(
  2. 'base_url' => '/[NAZWA FOLDERU na serwerze]',
  3. ));
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.