Categories: Learn PHP Tutorials, Tips And Guides

How to Host CodeIgniter PHP on Cloud using SSH

Codeigniter is an open source MVC framework used to make dynamic websites using PHP including ecommerce, blogs and many more.

We, at Cloudways, have been getting many requests from our clients to add codeigniter as a one-click application install. We are looking into the feasibility of adding this app inside the Console. Meanwhile, we think it is a great idea to teach our users how to easily install any version of codeigniter on Cloudways through SSH terminal.

You can follow the below steps:

Step 1: Launch PHP Stack

Signup or login to your Cloudways account and launch a new php stack server. You can find the option under the Server Management tab and click “Add App”. Select PHP Stack, as shown in the picture.

Wait for the server to be fully launch.

Step 2: Login to your SSH Terminal

Navigate to Server Management tab and under your Master Credentials launch SSH terminal.

Step 3: Install Codeigniter Using wget Command

Now go to the official page of codeigniter on github. Right click on the Download Zip button, and click copy link address. Now go to your SSH terminal and type these commands to goto your root folder where you will download the codeigniter.

cd applications

Now type ls and copy the name of the newly created folder and paste this command from the browser.

cd foldername/public_html

Since you are now in your root now type wget and paste the link that you have copied.

wget https://github.com/bcit-ci/CodeIgniter/archive/develop.zip

This will download the zip content of Codeigniter on your server.

Step 4: Unzip the Folder

Since the file you downloaded is zip you need to unzip it by typing

unzip develop.zip

Now type ls -al to view the files. You will see that the folder in which the content of Codeigniter has been unzipped to, is big. We need to rename it to use it easily. For this, type the following command

mv CodeIgniter-develop codeigniter

Now, lets remove the index.php and develop.zip file from your root folder by typing this command.

rm index.php
rm develop.zip

Step 5: Configure Codeigniter

Now connect to your ftp server using filezilla or other software. Enter your ftp info, which can be found in Server Management tab under Master Credential tile.

Now go to your codeigniter folder which is under public_html. Goto application -> config -> config.php.  In config.php set your base URL to this.

$config['base_url'] = 'localhost/codeigniter/Welcome';

Step 6: Run it

Now go to the application management tab and copy the application url. Paste the url in new tab and type /codeigniter at the end. If you see the page as in the picture, you have downloaded it correctly.

And we are done! You can now configure your server with your domain and start using it! Looking for a host provider? Haven’t tried Cloudways yet? Now is the perfect time to Sign Up and try out our proficiently Managed PHP Cloud Hosting platform. You have the option of choosing any of the four major cloud infrastructure provider from DigitalOcean, Vultr, GCE and Amazon. If the process is still not clear, we have a KB entry explaining the process in detail. Please refer to it to be able to install CodeIgniter easily on Cloudways servers.

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