CakePHP "Warning: Cache not configured properly" - cakephp

I am using CakePHP and getting the following error
Warning: Cache not configured properly. Please check Cache::config(); in APP/config/core.php in D:\PHP-SERVER\cheesecake\cake\libs\configure.php on line 663
Notice: Undefined variable: Route in D:\PHP-SERVER\cheesecake\app\config\routes.php on line 38
Fatal error: Call to a member function connect() on a non-object in D:\PHP-SERVER\cheesecake\app\config\routes.php on line 38
Any problem in the settings?

Which CakePHP version are you using?
The fatal error looks like a typo. Open the file D:\PHP-SERVER\cheesecake\app\config\routes.php and check what there is written on line 38. It looks like there is a letter missing.
It should be something along the lines of
Router::connect(...[whatever your route settings are]...);
and I guess in your file it says (note the missing r in Router)
Route::connect(...);
Did you do what the other error message said? Check the Cache::config call in app/config/core.php. You seem to have not properly set your cache configuration.
The default call looks like
Cache::config('default', array('engine' => 'File'));
If you changed that post the code-piece to figure out if something is wrong..

Related

Drupal Domain Access module Settings Tab White Screen of Death WSOD

In the Drupal 7.x project I'm developing, I'm using Domain Access module.
Somehow, when I try to access the Settings tab (admin/structure/domain/settings) I get a WSOD.
ERROR LOG:
[Wed May 07 11:20:08 2014] [error] [client 127.0.0.1] PHP Fatal error: Call to undefined function object_log() in /var/www/MYDRUPALPROJECT/sites/all/modules/custom/domain_bonus/domain_bonus_login_restrict/domain_bonus_login_restrict.module on line 55, referer: http:// MYDRUPALPROJECT/en/admin/structure/domain
Content from the file in question:
......
/**
*Implements hook_form_alter().
*/
function domain_bonus_login_restrict_form_alter(&$form, &$form_state, $form_id) {
switch ($form_id) {
.....
// Provide option to enable / disable restriction on domain settings form.
case 'domain_configure_form':
(LINE 55:) object_log('form_id ' . time(), $form_id);
.....
This custom module is a copy of the contrib module with just some simple modifications that don't involve the line in question.
Anyone have any idea what can be the cause of this?
Should I share any other relevant information to help you understand this?
Thank you!
Solved!
The problem was that the contrib module Domain Bonus: Login Restrict comes with the following lines of code:
object_log('form_id ' . time(), $form_id);
object_log('form_state ' . time(), $form_state);
object_log('form ' . time(), $form);
Those lines are used to debbug, probably during the module development.
object_log() function is a function from the object log module that can be used to debbug, more specifically to check variables value in a specific part of the code.
Since in the module .info file isn't defined that the Domain Bonus: Login Restrict module depends on the Object Log module, the Object Log module wasn't even installed in our project... In that conditions when reading that line, Drupal crashes.
So, for this function to work Object Log module needs to be installed, this module needs Devel module to work. Or simply just comment or delete those lines.
Cheers.

Parse error: syntax error, unexpected 'image' (T_STRING) in eval line

I`m trying to create a page that read the metadata of an image and allow user to edit it and save it to the same image.
After searching the internet I have found exiftool as the solution but I can make it work only as a command line not as a library in the page.
I have this code:
eval('$metadata=' . exiftool.exe -php -q $imagePath);
foreach ($metadata[0] as $key => $value) {
if ($metadata[0][$key]!=$_POST[$key]){
if ($_POST[$key]=="") $_POST[$key]=" "; //if metadata is not set, than create an empty metadata
eval('$metadata=' . exiftool.exe "-$key=$_POST[$key]" $imagePath);
}
}
and I`m getting this error:
Parse error: syntax error, unexpected 'image' (T_STRING) in E:\xampp\htdocs\imgdata\index.php(30) : eval()'d code on line 1
I tried to replace the ` with other like " and ' but no luck.
What do I miss?
Any better idea on how to do it?
Thanks
I had the same problem, but using Centos OS, and found a solution here:
'command not found' error when using subprocess in apache
Might not work for Windows but worth a look. Basically the answer suggests specifying the full exiftool path rather than simply exiftool.exe.
If that doesn't help then have a look for errors in the Apache Error Log File.

mpdf no output and php errors in mpdf.php

I'm trying to generate a pdp file in a cakephp application. Therefore, I use the mpdf library as a vendor. But when I try to make a even very simple output it doesn't work. Then when I use the debug property, it shows php errors in the mpdf.php file.
Here is my source code:
<?php
$mpdf=new mPDF();
$mpdf->WriteHTML('hello');
$mpdf->debug = true;
$mpdf->Output();
exit;
?>
And these are the errors shown in the browser:
Notice (8): Undefined index: BODY [APP\vendors\MPDF54\mpdf.php, line 14242]
Notice (8): Undefined index: BODY>>ID>> [APP\vendors\MPDF54\mpdf.php, line 14288]
Notice (8): Undefined offset: -1 [APP\vendors\MPDF54\mpdf.php, line 14421]
Thank you for your help!
This is not a CakePHP problem but related to the library you're using.
Read about how to use the WriteHTML() method.
http://mpdf1.com/manual/index.php?tid=121
And try passing 2 as the 2nd argument.
$mpdf->WriteHTML('hello', 2);
If this still does not work read the documentation, check the examples there.
This is caused by buggy mpdf code. It depends on error (level "notice") reporting to be switched off (it switches it off itself). But if you handle errors some nonstandard way, it is problem..
I solved it by ignoring errors from mpdf.php file in my custom error handler.
I was using my custom error reporting via set_error_handler();

cakephp app error problem

I have the following function in my app_controller:
function beforeFilter() {
$this->set('lastThreePosts', $this->Blog->find_latest_posts());
}
I then use the variable 'lastThreePosts' that I have set in my layout. This works fine apart from on my 404 page where I get the following error:
Notice (8): Undefined index: lastThreePosts [APP\views\layouts\default.ctp, line 29]
I have made my own 404 page by created the file error404.ctp in my /views/errors/ directory.
So it seems when theres a 404 error the code in the controller doesn't get executed. Does anyone know how I can make it work?
Thanks
Phew! I found the answer here:
http://www.bradezone.com/2009/05/21/cakephp-beforefilter-and-the-error-error/

I am getting error : Fatal error: Call to undefined method Debugger::checkSessionKey() in F:\xampp\htdocs\cakecms\views\pages\home.ctp on line 3

Fatal error: Call to undefined method Debugger::checkSessionKey() in F:\xampp\htdocs\cakecms\views\pages\home.ctp on line 3
in cake php .
Are you trying to call $this->Session from your home.ctp? I don't think $this->Session is available to views.
If you show your code for home.ctp we could better see what is going on.

Resources