Friday, August 21, 2009

CakePHP - start a project with the console application

To start fast a new project with cakephp 1.2 you will need:

- web server - I use apache 2.2
- php4 or php5 - I use php5
- mysql server - I use mysql 5.0.45
- cakephp - I use cake_1.2.4.8284

After the web and mysql servers are installed install the cakephp - I choosed the path

/var/www/frameworks/cake_1.2.4.8284

Then open a xterm or any shell:

cd /var/www/frameworks/cake_1.2.4.8284/cake/console
cake bake help

Will give you all the info you need to know on how to bootstrap your new project.
I choosed the following:

cake bake project
Then just answer the questions that cake asks:


Welcome to CakePHP v1.2.4.8284 Console
---------------------------------------------------------------
App : app
Path: /var/www/frameworks/cake_1.2.4.8284/app
---------------------------------------------------------------
What is the full path for this app including the app directory name?
Example: /var/www/frameworks/cake_1.2.4.8284/app/myapp
[/var/www/frameworks/cake_1.2.4.8284/app/myapp] > /var/www/frameworks/cake_1.2.4.8284/app/slash0
Bake Project
Skel Directory: /var/www/frameworks/cake_1.2.4.8284/cake/console/libs/templates/skel
Will be copied to: /var/www/frameworks/cake_1.2.4.8284/app/slash0
---------------------------------------------------------------
Look okay? (y/n/q)
[y] > y
Do you want verbose output? (y/n)
[n] > n
---------------------------------------------------------------
Created: slash0 in /var/www/frameworks/cake_1.2.4.8284/app/slash0
---------------------------------------------------------------

Creating file /var/www/frameworks/cake_1.2.4.8284/app/slash0/views/pages/home.ctp
Wrote /var/www/frameworks/cake_1.2.4.8284/app/slash0/views/pages/home.ctp
Welcome page created
Random hash key created for 'Security.salt'
CAKE_CORE_INCLUDE_PATH set to /var/www/frameworks/cake_1.2.4.8284 in webroot/index.php
CAKE_CORE_INCLUDE_PATH set to /var/www/frameworks/cake_1.2.4.8284 in webroot/test.php
Remember to check these value after moving to production server



Change myapp to whatever name you want to have for the app.I put slash0.
At this point the application project is created into the path you specified.

/var/www/frameworks/cake_1.2.4.8284/app/slash0

From now on all you have to do is follow the cakephp book on how to develop :)
See http://book.cakephp.org

0 comments: