navigation bar



How to Install CakePhp on Ubuntu (version 3.0 or latter)

To Install & Run CakePhp
Follow the below step....

1.     install php and apache

Install apache and php >= 5.4.16.

2.     Now change the directory where you want to install the composer by using this command:

cd /opt/lampp/htdocs/

3.   Install mbstring extension using the following command :

sudo apt-get install libapache2-mod-php5

4.   Install intl extension using the following command :

sudo apt-get install php5-intl

5.   Now restart apache using the command :

service apache2 restart

6.  Install Composer :

curl -s https://getcomposer.org/installer | php

7.  Else you can use command

php -r "readfile('https://getcomposer.org/installer');" | php


8.   Now type the command below :

php composer.phar create-project --prefer-dist cakephp/app [app_name]

9.   Your cakephp3 application will now be running.

10.   Connecting to database :

In cakephp3 we give database connection parameters in app.php in folder /config
Go to /config/app.php and change the requires parameters mentioned below


'Datasources' => [
'default' => [
'username' => '
',
'password' => '
',
'database' => '
',

Type http://localhost/app_name in browser to see your cakephp3 app.

Issues that you might face when you type command


php composer.phar create-project --prefer-dist cakephp/app [app_name]

1. Could not open input file: composer.phar
This means you haven't installed composer globally, and your composer installation was directory specific. Go to the directory where you have installed the composer and issue the above command.

2. This package requires php >=5.4.16 but your PHP version does not satisfy that requirement.
You will get this error when you are trying to install cakephp3 on php version lesser than 5.4.16.
PHP version of your machine has to be upgraded to version 5.4.16 or greater.
Note : Restart apache after the upgrade.

3. cakephp/cakephp 3.0.x- requires ext-intl * -> the requested PHP extension intl is missing from your system.
This means intl extension for php was not installed. You need to install intl extension as mentioned above, using the command sudo apt-get install php5-intl .
Note : Restart apache after installing.

Issues that you might face after installing

1. Database driver Cake\Database\Driver\Mysql cannot be used due to a missing PHP
extension or unmet dependency
The above error will be displayed on browser, if Mysql database driver couldn't be used by app or
is missing. Type the following command in terminal :
sudo apt-get install php5-mysql
Now restart mysql using command service mysql restart then restart Apache using command
service apache2 restart
Refresh the browser now, the above error would have disappeared.



Related Blog

cake php instalation on windows

No comments:

Post a Comment