How to Install CakePHP on Cloudways using SSH Client

by Ahmed Khan  January 14, 2016

CakePHP is a free open source framework which is used to develop rapid application using PHP. It is a MVC framework and it has an active friendly community from where you can take guidance too.

cakerphp

A lot of our users at Cloudways have been sending in requests to add CakePHP as a one-click application install. We are looking into that feasibility however, at the moment you can easily install any version of CakePHP on Cloudways using the SSH terminal. For this, you need to sign up on Cloudways Managed PHP Hosting and follow the instructions given below to install CakePHP on Cloudways.

After you have created an account with Cloudways, Select PHP Stack from the drop down and then fill up your Application name, Server Name and Select Default Project from drop down.

selecting php stack

 

Then choose your desired cloud provider from Vultr, DigitalOcean, Amazon or Google and desired server size and location. Now click on Launch and wait for the server to start.

Selecting server and location

After the server is launched, rename your application to cakephp so it becomes easy for you to access it via SSH client. For this navigate to select Applications from the top menu, then select your application.

selecting application

Now select Application Setting from the left side menu in your application and click on pencil below the Folder to rename it.

change application name

Launch your SSH Terminal

Now navigate to Servers from the top menu, click on your server and then from the left side menu select Master Credentials launch the SSH terminal.

select your server

Launch SSH terminal

Once SSH is launched, log in to it with your username and password provided in Master Credentials and type the following commands to reach your public_html

How to Install CakePHP using Git

Now go to the git repository of CakePHP, copy the HTTPS and type the following command to install it.

To check whether cakephp is installed or not, copy the application url from Application Tab, paste it in to your browser and type /cakephp at the end of it. Your page should look like this:

CakePHP 2.7.8 release

Now, there are 2 errors which you see. One is that your database file is not configured and the second is, that the debug kit is not installed.

Enable Database Config file

First we need to rename the database file. For that, you need to perform the following commands on your SSH.

Since we have renamed the database file, you need to reload the cakephp page and the error will be removed now.

CakePHP after db

Install Debug Kit

CakePHP recommends you to use its own debug kit to enhance CakePHP debugging and error reporting. Let’s get started. First you need to reach the main cakephp folder and then need to update it. Perform the following commands to reach the cakephp folder and install debug kit.

Once the update is complete, the debug kit will be installed in Plugin/DebugKit. We need to copy it inside the plugin folder in your app to use it. To do this type the following command.

Now we need to configure your CakePHP to use it. For that connect it to your ftp server using filezilla or other software. Enter your ftp info, which can be found in Server Management tab under Master Credentials. First, you need to go to your cakephp folder inside public_html and then need to do the following steps to enable it.

  1. Go to app/config/ open bootstrap.php in an editor and type the following line of code in it:
  2. Now open core.php in an editor and set debug to 1
  3. Now we need to include its toolbar in AppController for that go to app/Controller/ and open AppController.php and add the following line inside its controller
  4. Now we need to remove sql dump to use the log of Debug kit only. For that goto app/View/Layouts/ and open default.ctp and comment the following line in it.

Now goto your cakephp link in the browser and you will find Debug kit enabled.

CakePHP 2.7.8 release

Now CakePHP is fully configured! What you can do more? You can configure your database with this and connect your domain with Cloudways and start using it. Cloudways is not only an affordable managed cloud hosting provider, but it is also the most robust platform that is built to withstand the maximum surge in traffic and greatly streamlines how you could install CakePHP. Sign up now and experience the difference in pageload times yourselves.

Create PHP websites without the worry of server management.

Deploy your PHP app on optimized PHP hosting servers.

About Ahmed Khan

Ahmed was a PHP community expert at Cloudways - A Managed PHP Hosting Cloud Platform. He is a software engineer with extensive knowledge in PHP and SEO. He loves watching Game of Thrones is his free time. Follow Ahmed on Twitter to stay updated with his works. You can email him at ahmed.khan@cloudways.com

Stay Connected:

You Might Also Like...

  • zedguy

    Good read, I’ve moved all my code over to CakePHP 3 though since it came out a year ago, any changes needed?

    • For upgrading you can refer to cakephp official documentaion.

      And if you are using cloudways you can do following steps to do it

      1. Click on Clone application from application management tab and select server. It will create ab staging site for you to update your existing site easily without affecting to your on running site.
      2. Upgrade CakePHP and test it
      3. Upload it on your main site or point it to staging site