php - CakePHP based Application throws 500 Server Error on requiring Cache-Class

827

I'm trying to run a CakePHP based Application. this is it: Newsletter Mailer v1.1

I'm trying to get this running here: mailer.dasministerium.com

But as you can see all I receive is a 500 Internal Server error.

I tracked this error down to file:cake/libs/cache.php line 203

$core = App::core();
$path = $core['libs'][0] . 'cache' . DS . strtolower($name) . '.php';
if (file_exists($path)) {
    require $path;
    return true;
}

where line 203 is:require $path;

To track this down I die()d befor this line, and got my die() message.
Die()ing after this line resulted in the 500 Error, but die()ing in that required file (cake/libs/cache/file.php) gave me the 500 too.
So the whole thing is really crashing at that require thing.

I'm running Ubuntu 8.04 LTS 64Bit, PHP 5.2.4 (as apache module, NOT fast-cgi)

Any ideas how to get this running?

Thanks in advance! David


EDIT:

After printing out all errors into the error-file i found this:
PHP Fatal error: Class 'CakeLog' not found in /var/www/vhosts/dasministerium.com/subdomains/mailer/httpdocs/cake/libs/cache/file.php on line 83

Unfortnunately there is no reference at all toCakeLog in this file... so: wtf?!


EDIT 2:

var_dump(class_exists('CakeLog')); // this before the crashing 
                                   // require() returns true!

EDIT FINAL!

Its a CakePHP <-> eAccelerator issue.... SOLVED

471

Answer

Solution:

SOLVED: it was eAccelerator's fault. fixed it with a little hack...

Solution:

open/cake/libs/cake-log.php an scroll to the very bottom, then replace

if (!defined('DISABLE_DEFAULT_ERROR_HANDLING')) {
    set_error_handler(array('CakeLog', 'handleError'));
}

with:

if (!defined('DISABLE_DEFAULT_ERROR_HANDLING')) {
    $cakeLog =& CakeLog::getInstance();
    set_error_handler(array(&$cakeLog, 'handleError'));
}

that's it :)

323

Answer

Solution:

That solution is for Cake1.3 (and newer maybe).

What about 1.2?

There is no line:

if (!defined('DISABLE_DEFAULT_ERROR_HANDLING')) {
    set_error_handler(array('CakeLog', 'handleError'));
}

in cake_log.php file.

515

Answer

Solution:

I notice that cakephp 2.x may return http status 500 when there is no 'view' to the controller. It seems to be 'randomly occuring', as some Controllers without a view returns http status 200.

Anyway, to solve this http status 500 problem, ensure all your controllers has a view associated with it (you will see an error at the bottom of the page if there is no view associated with a controller).

People are also looking for solutions to the problem: php - Twitter OAuth Identification

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.