954,568 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

CakePHP installation problem

Hi all.

I've found a really nice looking calender, called CakeCalender that I want to install onto my site, it uses CakePHP http://cakephp.org/ . I am having a problem setting this up and was wondering if anyone has used Cake before and if possible they would have a spare couple of minutes to help me install it correctly. I'vefollowed the instructions in the manual and it doesn't seem to work at all.

Dave

davec271
Newbie Poster
16 posts since Jun 2005
Reputation Points: 10
Solved Threads: 0
 

Where is your site hosted? The majority of issues that people have with getting Cake setup involve mod_rewrite.

DanceInstructor
Posting Whiz
368 posts since Feb 2005
Reputation Points: 17
Solved Threads: 14
 

ill try it on my lan and see what happens

are tou using the stable or devel version?

jbennet
Moderator
Moderator
18,523 posts since Apr 2005
Reputation Points: 1,826
Solved Threads: 601
 
Where is your site hosted? The majority of issues that people have with getting Cake setup involve mod_rewrite.

I am using the free hosting service of my-pace.us as this is a personal site.

I have installed Joomla now after finding jake to try and run the cake apps but still nothing is working.

Dave

davec271
Newbie Poster
16 posts since Jun 2005
Reputation Points: 10
Solved Threads: 0
 

Which calendar were you trying to use? and which version of cake?

DanceInstructor
Posting Whiz
368 posts since Feb 2005
Reputation Points: 17
Solved Threads: 14
 
Which calendar were you trying to use? and which version of cake?

I am trying to use the CakeCalender by David Golding http://www.davidgoldingdesign.com/cakecalendar

I am using cake 1.1.13.4450

davec271
Newbie Poster
16 posts since Jun 2005
Reputation Points: 10
Solved Threads: 0
 

Pay close attention to the version number here:

How to Install

1. Download CakePHP 1.2 2. Download Cake Calendar 3. Put both directories on your server 4. That's it!

That's from his page.

Hmm, it will work. You have to add the user/administrator yourself, and the style is lacking. But it works... xD http://testing.clear-mind.com/

http://testing.clear-mind.com/users/login
user: Testing
pass: testing

DanceInstructor
Posting Whiz
368 posts since Feb 2005
Reputation Points: 17
Solved Threads: 14
 

Ok I've gone through and re-uploaded the directories to the server and I get the following messages

When I try and run Cake I get

Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/usr/share/php/cake/libs/view/templates/errors/home.ctp) is not within the allowed path(s): (/tmp/:/var/tmp/:/var/www/errors/:/home/vol3/myplace.us/daveclissold/daveclissold.com/htdocs) in /home/vol3/myplace.us/daveclissold/daveclissold.com/htdocs/cake/cake/basics.php on line 1440

and when I try and run cakecalendar

Warning: require(cake/bootstrap.php) [function.require]: failed to open stream: No such file or directory in /home/vol3/myplace.us/daveclissold/daveclissold.com/htdocs/cakecalendar/webroot/index.php on line 78

davec271
Newbie Poster
16 posts since Jun 2005
Reputation Points: 10
Solved Threads: 0
 

Ok. Find the file called bootstrap.php. It should be in app/config/bootstrap.php. Now edit bootstrap.php and add the following code:

[PHP]$modelPaths = array('/home/vol3/myplace.us/daveclissold/daveclissold.com/htdocs/cake/app/models');
$viewPaths = array('/home/vol3/myplace.us/daveclissold/daveclissold.com/htdocs/cake/app/views');
$controllerPaths = array('/home/vol3/myplace.us/daveclissold/daveclissold.com/htdocs/cake/app/controllers');[/PHP]

I think the paths are probably correct, but they may not be just right. So you may have to edit them slightly, maybe add the trailing / or whatever.

Let me know what happens.

Bah. The forum is cutting some of it off.
$modelPaths = array('....models');
$controllerPaths = array('...controllers');

DanceInstructor
Posting Whiz
368 posts since Feb 2005
Reputation Points: 17
Solved Threads: 14
 

Still getting the same errors.

davec271
Newbie Poster
16 posts since Jun 2005
Reputation Points: 10
Solved Threads: 0
 

Edit the file /cake/app/config/core.php and change:
define('DEBUG', 2); or it might be define('DEBUG', 1);
to:
define('DEBUG', 0);

You still need a database, once you have a database ready then rename:
/cake/app/config/database.php.default
to:
database.php

then edit the $default = array part so that it reflects the details of your db setup.

Get that far and I'll help you through the last 2-3 things you need to do to get this working

DanceInstructor
Posting Whiz
368 posts since Feb 2005
Reputation Points: 17
Solved Threads: 14
 

ok I have done that and I can access the main CakePHP page and everything there seems to be ok with the cake installation.

davec271
Newbie Poster
16 posts since Jun 2005
Reputation Points: 10
Solved Threads: 0
 

I'm assuming you have uploaded the calendar app.

Ok in /cake/app/sql/ you should find the file cakecalendar.sql. Your host probably has some way to use phpmyadmin via whatever control panel you use yes? Go into phpmyadmin and on the left pick the database you made for cakecalendar. Choose the SQL tab in the right hand pane. Now copy the contents of the file cakecalendar.sql to the textbox (Run SQL query/queries...) and click Go.

One thing to note: It's for the best that this database isnt shared with other apps you may be using.

If you get an error message about syntax then just change all these:
ENGINE=MyISAM DEFAULT CHARSET=latin1;
to this:
ENGINE=MyISAM;
and repeat the copy/paste again.

Now add this function to /cake/app/controllers/users_controller.php
[PHP]function addUser() {
$query = "INSERT INTO `users` ( `id` , `username` , `password` )
VALUES (
NULL , 'myName', 'myPass'
)";
$result = $this->User->query($query);
if(mysql_error()) {
die(mysql_error());
} else {
die('User successfully added.');
}
}
[/PHP]
You should comment this function out once you have added your user.

Now the users controller doesn't use any hashing and it probably should xD. So if you are concerned then do the following before you add the user
On line 21, change this:
if(!empty($someone['User']['password']) && $someone['User']['password'] == $this->data['User']['password'])
to this:
if(!empty($someone['User']['password']) && $someone['User']['password'] == sha1($this->data['User']['password']))
then in the addUser function change:
NULL , 'myName', 'myPass'
to:
NULL , 'myName', '".sha1(myPass)."'

Oh yeah, to add the user you will go to http://mysite.com/users/addUser

You should be all set at this point. If you have any problems just post here.

DanceInstructor
Posting Whiz
368 posts since Feb 2005
Reputation Points: 17
Solved Threads: 14
 

Ok I've done all that. I have had to edit a lot ofpaths that have been incorrect but now I've come across one that I can't edit. The error message is

Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/cake/app/tmp/cache/persistent/class.paths.php) is not within the allowed path(s): (/tmp/:/var/tmp/:/var/www/errors/:/home/vol3/myplace.us/daveclissold/daveclissold.com/htdocs) in /home/vol3/myplace.us/daveclissold/daveclissold.com/htdocs/cake/cake/basics.php on line 1056

however line 1056 reads

if(file_exists($filename)) {

and I'm not sure as to what this is referencing as class.paths.php is in the directory that it is pointing to.

davec271
Newbie Poster
16 posts since Jun 2005
Reputation Points: 10
Solved Threads: 0
 

That is a warning, it doesnt necessarily mean the app is broken. As long as you are not in debug mode you won't see that. So edit /cake/app/config/core.php and change:
define('DEBUG', 2); or define('DEBUG', 1);
to:
define('DEBUG', 0);

If you uploaded the calendar app it probably overwrote core.php file and set it back into debug mode.

DanceInstructor
Posting Whiz
368 posts since Feb 2005
Reputation Points: 17
Solved Threads: 14
 

Am still getting the same error message come up. Have changed the core.php file in both cake and cakecalendar

davec271
Newbie Poster
16 posts since Jun 2005
Reputation Points: 10
Solved Threads: 0
 

Huh?? There should only be 1 core.php to edit!

Describe your folder/directory layout for me.

Edit:

Actually, which directory do you want the calendar installed in? I figured out that you are now trying to install it in /cakecalendar/ so you need to ditch the /cake/ directory cause it will only cause confusion.

Now make sure you edit /cakecalendar/app/config/bootstrap.php and add the following:
$modelPaths = array('/home/vol3/myplace.us/daveclissold/daveclissold.com/htdocs/cakecalendar/app/models');

$viewPaths = array('/home/vol3/myplace.us/daveclissold/daveclissold.com/htdocs/cakecalendar/app/views');

$controllerPaths = array('/home/vol3/myplace.us/daveclissold/daveclissold.com/htdocs/cakecalendar/app/controllers');

Then make sure that /cakecalendar/app/config/database.php has the correct info.
Then make sure that /cakecalendar/app/config/core.php has
define(DEBUG, 0);

Just so we are clear. The calendar and cake should be in the same directory (/cakecalendar/), so the dir structure should be like so

/cakecalendar/
/app/
/config/
/controllers/
/locale/
/models/
etc...
/cake/
/config/
/libs/
/locale/
etc...
etc

Let me know how it goes.

DanceInstructor
Posting Whiz
368 posts since Feb 2005
Reputation Points: 17
Solved Threads: 14
 

I ran out of time on the other post ;_;
/cakecalendar//app//config/
/controllers/
/locale/
/models/
etc...

/cake//config/
/libs/
/locale/
etc...


etc...

DanceInstructor
Posting Whiz
368 posts since Feb 2005
Reputation Points: 17
Solved Threads: 14
 

I have re-installed everything as per your instructions and am still getting this warning on line 1056.


However when I run it using jake in joomla it sort of works I'm not able to create an admin user section or change the month, but its a start. However I really do not like joomla its a pre-installed CMS on my server so thought I'd test it there.

davec271
Newbie Poster
16 posts since Jun 2005
Reputation Points: 10
Solved Threads: 0
 

I should say that in Joomla it displays the calendar but thats it none of the functions are working

davec271
Newbie Poster
16 posts since Jun 2005
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You