We help IT Professionals succeed at work.

PHP and Apache trouble

tblinc
tblinc asked
on
Greetings, I wanted to edit my website so I deicide to copy it on my local machine and test the changes I made locally. I installed it on a archlinux VM. I installed LAMP correctly. I was also able to download my mysql database and to load it into my local server. The first page load but I have some error with kohana.

Can you help me troubleshoot all this ?

You can see the SS of my webpage and the error log in /var/log/httpd/errorlog.

The error came right after I click on any menu.
 
Loaded-extensions.jpg
Class-controller-does-not-exist.jpg
included-file.jpg
Comment
Watch Question

Author

Commented:

Author

Commented:
Anyone ?
The page you're requesting "/srv/httpdocs/index.php" has a require statement on line 103 looking for "/srv/httpdocs/bootstrap.php".
The script is looking in your httpdocs folder for the file bootstrap.php
Because its a require statement, when it doesn't find it, php stops processingthe page = die();

also looks like you have a configuration issue with your LAMP install...
[Fri Dec 02 08:43:35 2011] [notice] Digest: done
PHP Warning:  Module 'mysql' already loaded in Unknown on line 0


Author

Commented:
This is the line 103:

require APPPATH.'bootstrap'.EXT;

Where can I modify the APPPATH ?

Author

Commented:
You said:

The page you're requesting "/srv/httpdocs/index.php" has a require statement on line 103 looking for "/srv/httpdocs/bootstrap.php".

the bootstrap is in the good folder. I modify the line

require APPPATH.'bootstrap'.EXT;
to
require APPPATH.'application/bootstrap'.EXT;

My log told me this:

[Sat Dec 03 01:55:49 2011] [notice] Digest: generating secret for digest authentication ...
[Sat Dec 03 01:55:49 2011] [notice] Digest: done
[Sat Dec 03 01:55:50 2011] [notice] FastCGI: process manager initialized (pid 10322)
[Sat Dec 03 01:55:50 2011] [notice] Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/1.0.0e DAV/2 PHP/5.3.8 with Suhosin-Patch mod_fastcgi/2.4.6 configured -- resuming normal operations
[Sat Dec 03 01:55:55 2011] [client 192.168.77.1] PHP Warning:  require(/srv/httpdocs/application/application/bootstrap.php): failed to open stream: No such file or directory in /srv/httpdocs/index.php on line 103
[Sat Dec 03 01:55:55 2011] [client 192.168.77.1] PHP Fatal error:  require(): Failed opening required '/srv/httpdocs/application/application/bootstrap.php' (include_path='.:/usr/share/pear') in /srv/httpdocs/index.php on line 103


and my website doesn't load the first page at all now. So this line :(require APPPATH.'bootstrap'.EXT;) was correctly configured.

Other idea ?
APPPATH and EXT are defined in the kohana config...

in your httpdocs folder should be a folder called "application" and in that folder should be the file bootstrap.php

Change your require statement back to: require(APPPATH.'bootstrap'.EXT);

A Reflection_Exception is usually because your Kohana::init 'base_url' setting is wrong.
"ReflectionException [ -1 ]: Class controller_<something> does not exist" // where <something> is part of the url

Make sure you set your Kohana::init 'base_url' to the correct setting.
The base url should be the path to your index.php file relative to the webserver document root.

Author

Commented:
This drives me nut...

This is a part of the content of bootstrap.php

I try to set base_url to '/' '/srv/httpdocs/' and I always have the same error.

'index_file' was set to false, I set it back to true.

Everything is under /srv/httpdocs/

I have my index.php, application folder, images... everything is there.
* The following options are available:
 *
 * - string   base_url    path, and optionally domain, of your application   NULL
 * - string   index_file  name of your index file, usually "index.php"       index.php
 * - string   charset     internal character set used for input and output   utf-8
 * - string   cache_dir   set the internal cache directory                   APPPATH/cache
 * - boolean  errors      enable or disable error handling                   TRUE
 * - boolean  profile     enable or disable internal profiling               TRUE
 * - boolean  caching     enable or disable internal caching                 FALSE
 */
Kohana::init(array(
'base_url' => '',
'index_file' => TRUE,
'errors' => TRUE
));

Open in new window

'index_file' is a string - not boolean...

it should be
Kohana::init(array(
'base_url' => '/',
'index_file' => 'index.php',
'errors' => TRUE
));

Author

Commented:
Kohana::init(array(
'base_url' => '/',
'index_file' => 'index.php',
'errors' => TRUE
));
/**


Exact same error.
error.jpg
please post the full code of your index.php

Author

Commented:

<?php

/**
 * The directory in which your application specific resources are located.
 * The application directory must contain the config/kohana.php file.
 *
 * @see  http://docs.kohanaphp.com/install#application
 */
$application = 'application';

/**
 * The directory in which your modules are located.
 *
 * @see  http://docs.kohanaphp.com/install#modules
 */
$modules = 'modules';

/**
 * The directory in which the Kohana resources are located. The system
 * directory must contain the classes/kohana.php file.
 *
 * @see  http://docs.kohanaphp.com/install#system
 */
$system = 'system';

/**
 * The default extension of resource files. If you change this, all resources
 * must be renamed to use the new extension.
 *
 * @see  http://docs.kohanaphp.com/install#ext
 */
define('EXT', '.php');

/**
 * Set the PHP error reporting level. If you set this in php.ini, you remove this.
 * @see  http://php.net/error_reporting
 *
 * When developing your application, it is highly recommended to enable notices
 * and strict warnings. Enable them by using: E_ALL | E_STRICT
 *
 * In a production environment, it is safe to ignore notices and strict warnings.
 * Disable them by using: E_ALL ^ E_NOTICE
 * 
 * When using a legacy application with PHP >= 5.3, it is recommended to disable
 * deprecated notices. Disable with: E_ALL & ~E_DEPRECATED
 */
error_reporting(E_ALL | E_STRICT);

/**
 * End of standard configuration! Changing any of the code below should only be
 * attempted by those with a working knowledge of Kohana internals.
 *
 * @see  http://docs.kohanaphp.com/bootstrap
 */

// Set the full path to the docroot
define('DOCROOT', realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR);

// Make the application relative to the docroot
if ( ! is_dir($application) AND is_dir(DOCROOT.$application))
	$application = DOCROOT.$application;

// Make the modules relative to the docroot
if ( ! is_dir($modules) AND is_dir(DOCROOT.$modules))
	$modules = DOCROOT.$modules;

// Make the system relative to the docroot
if ( ! is_dir($system) AND is_dir(DOCROOT.$system))
	$system = DOCROOT.$system;

// Define the absolute paths for configured directories
define('APPPATH', realpath($application).DIRECTORY_SEPARATOR);
define('MODPATH', realpath($modules).DIRECTORY_SEPARATOR);
define('SYSPATH', realpath($system).DIRECTORY_SEPARATOR);

// Clean up the configuration vars
unset($application, $modules, $system);

if (file_exists('install'.EXT))
{
	// Load the installation check
	return include 'install'.EXT;
}

// Load the base, low-level functions
require SYSPATH.'base'.EXT;

// Load the core Kohana class
require SYSPATH.'classes/kohana/core'.EXT;

if (is_file(APPPATH.'classes/kohana'.EXT))
{
	// Application extends the core
	require APPPATH.'classes/kohana'.EXT;
}
else
{
	// Load empty core extension
	require SYSPATH.'classes/kohana'.EXT;
}

// Bootstrap the application
require APPPATH.'bootstrap'.EXT;

Open in new window

<?php defined('SYSPATH') or die('No direct script access.');

//-- Environment setup --------------------------------------------------------

/**
 * Set the default time zone.
 *
 * @see  http://docs.kohanaphp.com/about.configuration
 * @see  http://php.net/timezones
 */
date_default_timezone_set('America/Montreal');

/**
 * Set the default locale.
 *
 * @see  http://docs.kohanaphp.com/about.configuration
 * @see  http://php.net/setlocale
 */
setlocale(LC_ALL, 'en_US.utf-8');

/**
 * Enable the Kohana auto-loader.
 *
 * @see  http://docs.kohanaphp.com/about.autoloading
 * @see  http://php.net/spl_autoload_register
 */
spl_autoload_register(array('Kohana', 'auto_load'));

/**
 * Enable the Kohana auto-loader for unserialization.
 *
 * @see  http://php.net/spl_autoload_call
 * @see  http://php.net/manual/var.configuration.php#unserialize-callback-func
 */
ini_set('unserialize_callback_func', 'spl_autoload_call');

//-- Configuration and initialization -----------------------------------------

/**
 * Initialize Kohana, setting the default options.
 *
 * The following options are available:
 *
 * - string   base_url    path, and optionally domain, of your application   NULL
 * - string   index_file  name of your index file, usually "index.php"       index.php
 * - string   charset     internal character set used for input and output   utf-8
 * - string   cache_dir   set the internal cache directory                   APPPATH/cache
 * - boolean  errors      enable or disable error handling                   TRUE
 * - boolean  profile     enable or disable internal profiling               TRUE
 * - boolean  caching     enable or disable internal caching                 FALSE
 */
Kohana::init(array(
'base_url' => '/', 
'index_file' => 'index.php', 
'errors' => TRUE
));
/**
 * Attach the file write to logging. Multiple writers are supported.
 */
Kohana::$log->attach(new Kohana_Log_File(APPPATH.'logs'));

/**
 * Attach a file reader to config. Multiple readers are supported.
 */
Kohana::$config->attach(new Kohana_Config_File);

/**
 * Enable modules. Modules are referenced by a relative or absolute path.
 */
Kohana::modules(array(
	 'auth'       => MODPATH.'auth',       // Basic authentication
	// 'codebench'  => MODPATH.'codebench',  // Benchmarking tool
	 'database'   => MODPATH.'database',   // Database access
	// 'image'      => MODPATH.'image',      // Image manipulation
	 'orm'        => MODPATH.'orm',        // Object Relationship Mapping
	// 'pagination' => MODPATH.'pagination', // Paging of results
	// 'userguide'  => MODPATH.'userguide',  // User guide and API documentation
	));

/**
 * Set the routes. Each route must have a minimum of a name, a URI and a set of
 * defaults for the URI.
 */
 
Route::set('admin', 'admin(/<controller>(/<action>(/<id>)))')
    ->defaults(array(
        'directory'  => 'admin',
        'controller' => 'home',
        'action'     => 'index',
    ));
Route::set('solutions', '<lang>/solutions/<slug>', array('lang' => 'fr|en'))
    ->defaults(array(
        'controller' => 'solutions',
        'action'     => 'show',
        'lang'       => 'fr',
        'slug'       => 'accueil',
    ));
    
Route::set('pages', '<lang>/<slug>(/<year>/<month>)', array('lang' => 'fr|en'))
    ->defaults(array(
        'controller' => 'pages',
        'action'     => 'show',
        'lang'       => 'fr',
        'slug'       => 'accueil',
    ));

Route::set('default', '(<controller>(/<action>(/<id>)))')
	->defaults(array(
		'controller' => 'pages',
		'action'     => 'show',
		'lang'       => 'fr',
		'slug'       => 'accueil',
	));

/**
 * Execute the main request. A source of the URI can be passed, eg: $_SERVER['PATH_INFO'].
 * If no source is specified, the URI will be automatically detected.
 */
echo Request::instance()
	->execute()
	->send_headers()
	->response;

Open in new window

Author

Commented:
The first one is my index.php and the other is bootstrap.php
can you please post the last dozen or so lines from your error log

also include the Kohana log...
Kohana::$log->attach(new Kohana_Log_File(APPPATH.'logs'));
Does it work with the default bootstrap config???

Comment out lines 84 to 114 and paste the following in below:

Route::set('default', '(<controller>(/<action>(/<id>)))')
      ->defaults(array(
            'controller' => 'welcome',
            'action'     => 'index',
      ));

That should output "Hello, world"

Author

Commented:

I only have logs in my webpage. I don't have anything in /var/log/httpd/errorlog.
There is the screenshot. The controller still doesn't exist.
Controller-Welcome.jpg
Have you got all of the files in \application\classes\...

That error is saying that the controller _welcome (welcome.php) is not in the folder \application\classes\controller\

Author

Commented:
You're right, the welcome.php wasn't in the folder. I added it.

I restarted apache and now I have the following error with the welcome controller
Welcome.jpg
What version of Kohana are you using???
How much experience do you have with Kohana?

It looks like your Kohana system is heavily configured and things are missing.

First i'd install a clean copy of Kohana to a new directory: http://kohanaframework.org/download
Make sure you're able to get it all running
then compare your original with the new version

You could try updating your Kohana installation but it'll depend on what version you're running and how comfortable you are with it.
Install Guide: http://kohanaframework.org/3.2/guide/kohana/install
Upgrade Notes: http://kohanaframework.org/3.2/guide/kohana/upgrading

Author

Commented:
thanks