Search:
 
PHP Site Solutions  ::  Board index  ::  PHP Frameworks  ::  CakePHP
Forum Navigation Forum Navigation



All times are UTC - 5 hours [ DST ]





Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
  Print view

Baking an application: user auth, manage files, activity log
Author Message
PostPosted: Sun Apr 26, 2009 3:30 pm 
Offline
Site Admin
User avatar

Joined: Thu Apr 24, 2008 5:29 am
Posts: 50
This is Part 1 of this tutorial, subsequent parts will be posted in this same thread.
This thread will remain locked from comments until the tutorial is completed.

I'll be taking you through the whole process of the development of a cake application.
This application will have admin-managed users, file uploads, and a simple user activity log.
Additionally, this application will be accessible only to logged in users & administrators.

This assumes that you have a Linux hosting account with shell (SSH) access.

First, you need to download CakePHP to somewhere that can be accessed by your SSH/web user.
This location doesn't need to be web *visible* though.
I store mine in a directory outside of my document root (see below). Please be sure you extract the files of course :-)

My environment:
Quote:
/home/webuser/ # my home directory
/home/webuser/lib/ # where I store common PHP files that don't need to be accessed directly via the web. ** This is where I store CakePHP, after it's been downloaded and extracted
/home/webuser/mydomain.com/ # this is the path to my domain's document root, so for example, index.php would go here


Download CakePHP.
Quote:
cd /home/webuser/lib/
wget http://cakeforge.org/frs/download.php/7 ... n=complete
tar xzf cake_1.2.2.8120.tar.gz
rm -f cake_1.2.2.8120.tar.gz


So that I can "bake" a CakePHP application from command line, without having to constantly reference the full path to my cake installation, I add my CakePHP console directory to my PATH by issuing the following commands in SSH:
Quote:
PATH=/home/webuser/lib/cake_1.2.2.8120/cake/console/:$PATH
export PATH


If you'd like to ensure that path gets set every time you login to SSH, you can add those commands to your ~/.bash_profile

Now you can proceed to set up your application.
Quote:
cd /home/webuser/mydomain.com/
cake bake


At this point, you should see a prompt, asking you for the path that you want your application to exist in.
Assuming you want cake to be accessible at the root of your website, give it the full path to your document root.
Note: When cake is prompting you for your application path, it provides an example using path-to-this-directory/myapp. You can just copy that entire directory path, and strip off the /myapp bit.

After entering your document root and pressing enter, you'll be asked if it's okay for cake to copy in a "skeleton" application. Enter "y" and hit enter. Say "n" to verbose output.

Now you'll be asked for your database configuration.
The first prompt for "Name:", is just the name that you want to call this configuration grouping.
You can leave it as "default" (the value that cake assumes by default).
You'll also be prompted for the driver to use. If you use PHP5 & MySQL, I recommend using the "mysqli" driver (note the i on the end). This is a higher quality implementation of mysql that came out with PHP5.
I also always hit "n" for persistent connection (MySQLi doesn't even support persistent connections currently, though MySQLnd will rectify that)
Proceed to enter the rest of your db details.

One note regarding the database settings, I personally use "utf8" encoding in my MySQLi connection in CakePHP.
I also set my Database, Tables, and all of my columns to use utf8/utf8_unicode_ci. You're not required to use UTF8 though, that's just a preference of mine.

Once you've finished entering your database details, the database config file will be written and the cake console will close out.

_________________
Original Open Source projects:
CRaniuM CRM - Open Source CRM based on Yii Framework
OpenVIN - Open Source VIN decoding solution
Tiny Templater - Integrate logic into your content
XCSEO Basic - X-Cart (4.0,4.1) free SEO module

Maintained Open Source projects:
Sphider Plus - Spider/search engine
Template Lite - Alternative to Smarty


Top
 Profile  
 

Re: Baking an application: user auth, manage files, activity log
PostPosted: Sun Apr 26, 2009 3:42 pm 
Offline
Site Admin
User avatar

Joined: Thu Apr 24, 2008 5:29 am
Posts: 50
This is Part 2 of this tutorial

Now we have Cake installed, and our initial application setup complete.
If you visit your website (of course remembering the path where you set up your Cake app), you should see a nice Success page. Here you'll see a short summary of how cake is set up, how you can change the displayed content, and also any errors that are occurring will display here. Correction of any errors is outside the scope of this article.

Before we can continue with baking your application, we'll need to set up your database schema.

TO BE CONTINUED...

_________________
Original Open Source projects:
CRaniuM CRM - Open Source CRM based on Yii Framework
OpenVIN - Open Source VIN decoding solution
Tiny Templater - Integrate logic into your content
XCSEO Basic - X-Cart (4.0,4.1) free SEO module

Maintained Open Source projects:
Sphider Plus - Spider/search engine
Template Lite - Alternative to Smarty


Top
 Profile  
 

Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Authentication Authentication


Copyright © 2006-2008 PHP Site Solutions