CakePHP is an open source web development framework for PHP 5.4+. It is a critical programming framework used by web developers which is completely based on MVC structure, a very powerful used to build complex web applications. CakePHP offers many useful design patterns, which can be seen in other popular frameworks also. CakePHP also offers a huge number of libraries which are beneficial for the web development and that support common programming tasks. Apart from this it also includes amazing feature of organising the code in different folders. As a result, time spent in writing and organising code will be greatly reduced. It is most powerful framework to develop complex web application.
In this tutorial on CakePHP 3.x, I will be explainging you an overview on how the different concepts in cakePHP are implemented and what are the basic steps required to start the installation process of a CakePHP application on ubuntu operating system.
Quick Steps to Implement and Install CakePHP 3.x Application on Ubuntu
Minimum Requirements for installation:
1. You should have PHP 5.5.9 or higher
2. mbstring extension package
3. intl extension package
3. Web Server For example: Apache having mod_rewrite is recommended
Lets start with the installation process
Step 1. Download and install the Composer by running the following command
curl -s https://getcomposer.org/installer | php
Step 2: Install intl and mbstring extension packages by running the following command
sudo apt-get install php5-intl
sudo apt-get install mcrypt php5-mcrypt
sudo apt-get install libapache2-mod-php5
Step 3: Edit php.ini file and add following lines
extension = mcrypt.so
extension = intl.so
by running following commands
sudo nano /etc/php5/apache2/php.ini
sudo service apache2 restart
Step 4: To get a new CakePHP application by running this command
sudo php composer.phar create-project --prefer-dist -s dev cakephp/app Folder_Name
Step 5: Always make sure the directories logs, tmp and all its subdirectories in your CakePHP installation(cakephp folder) are writable.
Step 6: Go to phpmyadmin and create a database e.g:cakephp_3
Step 7: Open Config/app.php and replace the values in the Datasources.default array with database details like database, username and password.
'Datasources' => [
'default' => [
'className' => 'Cake\Database\Connection',
'driver' => 'Cake\Database\Driver\Mysql',
'persistent' => false,
'host' => 'localhost',
'username' => 'root',
'password' => '',
'database' => 'cakephp_3',
'encoding' => 'utf8',
'timezone' => 'UTC',
'cacheMetadata' => true,
'quoteIdentifiers' => false,
],
]
Step 8: Now go into your Application folder(eg:cake_project$ bin/cake server) and run
bin/cake server
This will make our application available at http://localhost:8765/. This code will make running the server, and if you want to exit then press
CTRL + C
0 Comment(s)