linkyndy
linkyndy

Reputation: 17900

CakePHP 2.1 doesn't work on localhost

I deployed my app on a remote host and everything works as expected. But when I try to test my code on localhost, it gives me the following error, without any change to the code working on the host:

Fatal error: Class 'AppHelper' not found in [path]

I am using CakePHP 2.1 and MySQL as my default datasource.

I connect to my local database just like to the remote one (with authentication changes):

public $default = array(
    'datasource' => 'Database/Mysql',
    'persistent' => false,
    'host' => 'localhost',
    'login' => 'root',
    'password' => '',
    'database' => 'database',
    'prefix' => '',
    'encoding' => 'utf8',
);

Why isn't this working on my localhost? Thank you

Upvotes: 4

Views: 4223

Answers (1)

mark
mark

Reputation: 21743

Two possible things: either you didnt know about the AppHelper requirement for 2.1: http://book.cakephp.org/2.0/en/appendices/2-1-migration-guide.html

or you forget to declare the helper at the very top of your class:

 App::uses('AppHelper', 'View/Helper');

Although the second one is highly unlikely if you are not running any unit tests. So my bet is on the first one.

Upvotes: 5

Related Questions