PHP | How to install CakePHP 3.0

These are the steps to install CakePHP 3.0 on Ubuntu machine:

Make sure you have PHP 5.5.9 (CLI) or higher installed. Check php version on your system using this command:

php -v

Run the following commands:

1. Download the composer installer in your current directory and rename it to filename ‘composer-setup.php’ with this command (Composer is a dependency management tool for PHP 5.3+):

php -r “copy(‘’, ‘composer-setup.php’);”

2. Now for security issues we have to check that installer (composer-setup.php) is not a corrupt file. The hash_file command is used to convert the content of file in ‘SHA384’ hash value. If the hash value of composer-setup.php file is equal to “e115a8dc7871f15d853148a7fbac7da27d6c0030b848d9b3dc09e2a0388afed865e6a3d6b3c0fad45c48e2b5fc1196ae” then installer is correct otherwise it may be corrupted. For this check execute this command:

php -r “if (hash_file(‘SHA384’, ‘composer-setup.php’) === ‘e115a8dc7871f15d853148a7fbac7da27d6c0030b848d9b3dc09e2a0388afed865e6a3d6b3c0fad45c48e2b5fc1196ae’) { echo ‘Installer verified’; } else { echo ‘Installer corrupt’; unlink(‘composer-setup.php’); } echo PHP_EOL;”

If you see Installer verified message that means installer is in good shape.

3. Then run the installer file through this command. It will install the composer:

php composer-setup.php

4. After this remove the installer file from your current directory:

php -r “unlink(‘composer-setup.php’);”

5. Create a cakephp project through composer. This is the step when cakephp will be downloaded (on this step if any extensions or libraries required for cakephp will be missing, errors will flash and they will need to be resolved first):

php composer.phar create-project –prefer-dist cakephp/app my_app_name

Once cakephp is installed you can start using it or execute bake command to generate code for your project.

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *