CakePHP won't launch [SOLVED]

Code junkies hangout here

Moderators: ChrisThornett, LXF moderators

CakePHP won't launch [SOLVED]

Postby bbagger » Sat Nov 27, 2010 12:04 pm

I don't even get the green bars when I try to do the tutorial. I'm using CakePHP 1.3.6 and get a warning on timezone setting, which I ignore for the time being. Worse is this:
Code: Select all
Notice: Trying to get property of non-object in /srv/www/htdocs/cake/libs/cache/file.php on line 248 Fatal error: Call to a member function cd() on a non-object in /srv/www/htdocs/cake/libs/cache/file.php on line 248
What am I doing wrong?

Bent
Last edited by bbagger on Wed Dec 15, 2010 6:49 pm, edited 1 time in total.
bbagger
 
Posts: 12
Joined: Sat Apr 11, 2009 6:15 pm

CakePHP won't launch

Postby NormanDunbar » Tue Dec 14, 2010 4:55 pm

I don't even get the green bars when I try to do the tutorial. I'm using CakePHP 1.3.6 and get a warning on timezone setting, which I ignore for the time being. Worse is this:

You must set the timezone, if you don't you get the error you are seeing.

I know this, because I had it too.

I changed mine to "Europe/London" but you can simply un-comment the UTC setting if you wish.

Once you do that, refresh the browser and you will either get a yippee moment, or the next error!

basically, the things you must do are:

* Set the salt
* Set the crypto seed
* Set the timezone
* Make app/tmp directory writable to the webserver user.

Anything less gives errors.

Cheers,
Norm.
If at first you don't succeed, sky diving is probably not the sport for you.
NormanDunbar
 
Posts: 5
Joined: Wed May 31, 2006 11:57 am
Location: West Yorkshire, UK

Postby bbagger » Wed Dec 15, 2010 9:26 am

Thanks for the answer.

I'm afraid I have to ask you to explain more specifically how you did set the timezone. Mine is set to Europe/Copenhagen using method 1 in http://www.thegeekstuff.com/2010/09/change-timezone-in-linux/.

Still, I don't understand why a warning can blow up a program. If it does it should be classified as an error. Anyway, the complete output from my attempt is this:
Code: Select all
Warning (2): strtotime() [http://php.net/function.strtotime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CET/1.0/no DST' instead [CORE/cake/libs/cache.php, line 570]
Code | Context

$settings   =   array(
   "engine" => "File",
   "path" => "/srv/www/htdocs/app/tmp/cache/persistent/",
   "prefix" => "cake_core_",
   "lock" => false,
   "serialize" => true,
   "isWindows" => false,
   "duration" => "+10 seconds",
   "probability" => 100
)

strtotime - [internal], line ??
CacheEngine::init() - CORE/cake/libs/cache.php, line 570
FileEngine::init() - CORE/cake/libs/cache/file.php, line 81
Cache::_buildEngine() - CORE/cake/libs/cache.php, line 151
Cache::config() - CORE/cake/libs/cache.php, line 126
Configure::__loadBootstrap() - CORE/cake/libs/configure.php, line 421
Configure::getInstance() - CORE/cake/libs/configure.php, line 52
include - CORE/cake/bootstrap.php, line 38
require - APP/webroot/index.php, line 76
[main] - CORE/index.php, line 55

Notice: Trying to get property of non-object in /srv/www/htdocs/cake/libs/cache/file.php on line 248 Fatal error: Call to a member function cd() on a non-object in /srv/www/htdocs/cake/libs/cache/file.php on line 248
I hope you can shed more light on this.

Bent
bbagger
 
Posts: 12
Joined: Sat Apr 11, 2009 6:15 pm

CakePHP won't launch

Postby NormanDunbar » Wed Dec 15, 2010 4:49 pm

Evening!

As I'm in the UK and currently on GMT, which is equivalent to UTC, I have a choice:

Edit the file <your_install>/app/config/core.php and either un-comment the line (by removing the // at the start) :

//date_default_timezone_set('UTC');

Or, set it to:

date_default_timezone_set('Europe/London');

Both options cause the warning to vanish, plus, allows the failing "cd" command to work. It's very strange indeed.

It's a PHP 5.3 thing where yo have to tell it the time zone you wish to use rather than relying on the server time zone. makes no sense to me, but there you have it!


Cheers,
Norm.
If at first you don't succeed, sky diving is probably not the sport for you.
NormanDunbar
 
Posts: 5
Joined: Wed May 31, 2006 11:57 am
Location: West Yorkshire, UK

Postby bbagger » Wed Dec 15, 2010 6:49 pm

Indeed, it works! After doing as you suggest - except using Europe/Copenhagen - everything fell into place.

Thanks a lot for your help

Bent
bbagger
 
Posts: 12
Joined: Sat Apr 11, 2009 6:15 pm

Postby NormanDunbar » Wed Dec 15, 2010 7:24 pm

Evening Bent,

bbagger wrote:Thanks a lot for your help

Glad to help. I have to confess, I was stuck in exactly the same position as you were just on Monday this week, and once I decided to get rid of the warning message, I found the error message went away as well.

My next problem is that I can't get any of my controllers to work! I just get a 404 page not found. Sigh!

Good luck. Happy christmas.

Cheers,
Norm.
If at first you don't succeed, sky diving is probably not the sport for you.
NormanDunbar
 
Posts: 5
Joined: Wed May 31, 2006 11:57 am
Location: West Yorkshire, UK

Postby bbagger » Wed Dec 15, 2010 8:08 pm

Hi Norm

I was very tempted to answer "That makes two of us", but then I discovered that I did not have mod_rewrite loaded. Once I got that done, I got my controller working and am now down to the 'real' coding errors :wink:

Merry Christmas to you too.

Bent
bbagger
 
Posts: 12
Joined: Sat Apr 11, 2009 6:15 pm

Post subject: CakePHP won't launch

Postby NormanDunbar » Wed Dec 15, 2010 9:13 pm

Hi Bent,

bbagger wrote:...I discovered that I did not have mod_rewrite loaded. Once I got that done, I got my controller working and am now down to the 'real' coding errors :wink:


That's the avenue I'm working down now.


Cheers,
Norm.
If at first you don't succeed, sky diving is probably not the sport for you.
NormanDunbar
 
Posts: 5
Joined: Wed May 31, 2006 11:57 am
Location: West Yorkshire, UK


Return to Programming

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest