Wednesday, 4 February 2015

Baking CakePHP in ubuntu


Baking CakePHP in ubuntu

Step1

download  CakePHP file and paste where you want
for example
i have placed in mycomputer/opt/lampp/htdocs/foldername
i am using Linux system

Step2 
Give read and write permission to tmp folder


Step3 
Create database and tables for your application
configure your application with database i.e.  app/config/database.php
change password and salt password in app/config/core.php

Step4

path name should be like this

user@dreamphp:/opt/lampp/htdocs/cakephpbake/app/Console$ 
 
(cakephpbake--> folder_name)

Step5

next step copy and run this cmd prompt

sudo apt-get install cakephp-scripts 

Step6

password of system have to give

[sudo] password for user: ******
Reading package lists... Done

//result displayed given below.. for references 
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
apache2 apache2-bin apache2-data cakephp libapache2-mod-php5
libaprutil1-dbd-sqlite3 libaprutil1-ldap php5 php5-cli php5-common php5-json
php5-readline


Suggested packages:
apache2-doc apache2-suexec-pristine apache2-suexec-custom apache2-utils
cakephp-instaweb php5-mysql php-pear php5-user-cache
The following NEW packages will be installed:
apache2 apache2-bin apache2-data cakephp cakephp-scripts libapache2-mod-php5
libaprutil1-dbd-sqlite3 libaprutil1-ldap php5 php5-cli php5-common php5-json
php5-readline


0 upgraded, 13 newly installed, 0 to remove and 136 not upgraded.
Need to get 6,885 kB of archives.
After this operation, 32.0 MB of additional disk space will be used.
Do you want to continue? [Y/n] y

Y
 

After that installation process.. it will take 10 to 20 mins
//result displayed given below.. for references
Get:1 http://in.archive.ubuntu.com/ubuntu/ trusty/main php5-json i386 1.3.2-2build1 [34.2 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu/ trusty-updates/main php5-common i386 5.5.9+dfsg-1ubuntu4.5 [443 kB] 


Step7
Here you are setting database through cmd prompt

user@dreamphp:/opt/lampp/htdocs/cakephpbake/app$ cake bake all


//result displayed given below.. for references
---------------------------------------------------------------
The following database configuration will be created:
---------------------------------------------------------------
Name:         default
Driver:       mysql
Persistent:   true
Host:         host_name
User:         user_name
Pass:        
Database:     database_name
---------------------------------------------------------------
 Creating file /opt/lampp/htdocs/cakephpbake/app/myapp/config/database.php
Wrote `/opt/lampp/htdocs/cakephpbake/app/myapp/config/database.php`

Step8

if you want to create new folder and should execute in that folder means use Step8 other wise skip this step

user@dreamphp:/opt/lampp/htdocs/cakephpbake/app$ cake bake 

//result displayed given below.. for references
Welcome to CakePHP v1.3.14 Console
---------------------------------------------------------------
App : app
Path: /opt/lampp/htdocs/cakephpbake/app
---------------------------------------------------------------
What is the full path for this app including the app directory name?
 Example:/opt/lampp/htdocs/cakephpbake/app/myapp 
[/opt/lampp/htdocs/cakephpbake/app/myapp] > 

 opt/lampp/htdocs/cakephpbake/app/myapp 

Step9

You can skip if you skip 8th step

next have check path is in myapp if not give
cd myapp

user@dreamphp:/opt/lampp/htdocs/cakephpbake/app/myapp$ cake bake

//result displayed given below.. for references 

Welcome to CakePHP v1.3.14 Console
---------------------------------------------------------------
App : myapp
Path: /opt/lampp/htdocs/cakephpbake/app/myapp
---------------------------------------------------------------
Interactive Bake Shell
---------------------------------------------------------------
[D]atabase Configuration
[M]odel
[V]iew
[C]ontroller
[P]roject
[F]ixture
[T]est case
[Q]uit
What would you like to Bake? (D/M/V/C/P/F/T/Q)


m

[[[[[[[[
I got an error like fatal error mysql_query() not fount
i added  

PATH=/opt/lampp/bin:$PATH 

in home->.bashrc file 
and restart your apache ]]]]]



//result displayed given below.. for references 

---------------------------------------------------------------
Bake Model
Path: /opt/lampp/htdocs/cakephpbake/app/myapp/models/
---------------------------------------------------------------
Possible Models based on your current database:
1. Category
2. Job
3. OrderInfo
4. Product
5. User
Enter a number from the list above,
type in the name of another model, or 'q' to exit
[q] > 1
Would you like to supply validation criteria
for the fields in your model? (y/n)
[y] >y


Field: id
Type: integer
---------------------------------------------------------------
Please select one of the following validation options:
---------------------------------------------------------------
1 - alphanumeric
2 - between
3 - blank
4 - boolean
5 - cc
6 - comparison
7 - custom
8 - date
9 - decimal
10 - email
11 - equalto
12 - extension
13 - inlist
14 - ip
15 - maxlength
16 - minlength
17 - money
18 - multiple
19 - notempty
20 - numeric
21 - phone
22 - postal
23 - range
24 - ssn
25 - time
26 - url
27 - userdefined
28 - uuid
29 - Do not do any validation on this field.
... or enter in a valid regex validation string.


Would you like to add another validation rule? (y/n)
[n] >
Would you like to define model associations
(hasMany, hasOne, belongsTo, etc.)? (y/n)
[y] > y
One moment while the associations are detected.
---------------------------------------------------------------
Please confirm the following associations:
---------------------------------------------------------------
Category hasMany Job? (y/n)

[y] >
Would you like to define some additional model associations? (y/n)
[n] > y
What is the association type?
1. belongsTo
2. hasOne
3. hasMany
4. hasAndBelongsToMany
Enter a number











No comments:

Post a Comment