ad

Friday, 12 February 2016

Installing CodeIgniter on Linux Ubuntu Server for Beginners

Installing CodeIgniter on linux

*Basic Linux CLI knowledge required*

CodeIgiter is a PHP Framework or tool-kit to develop full featured or simple application. If you've been working with PHP for a while now you should definitely try new frameworks now, though today we'll be learning how to install Codeigniter framework on Linux.

To download CodeIgniter navigate to Apache public/root directory and run the following command in Terminal. You can also use SSH to connect to your server shell and follow the exact same steps. Once you're in 'var/www/html' directory(root), run 'wget https://github.com/bcit-ci/CodeIgniter/archive/3.0.4.zip' in Teminal to download the Framework.

When the download is done. Stay in same directory and extract the file using command 'unzip CodeIgniter-3.0.4'. Make sure though that you've got unzip program installed to unzip the file. You can check if you've command installed using command 'whereis', 'whereis unzip'. It should show the bin directory path where command code is.

Now lets move index.php file out of CodeIgniter folder to our root using mv command 'sudo mv CodeIgniter-3.0.4/index.php /var/www/html'. Remember that there's only two main folders, 'application' and 'system', and we need to move these outside the root folder 'html' to 'www' so user cannot access them. We move those two folders to www using mv command again. 'sudo mv CodeIgniter-3.0.4/system CodeIgniter-3.0.4/application /var/www'.

That's our main job done, we can now delete codeIgniter folder as it's no longer needed. To delete the folder use 'rm' command with '-r' options, r stands for recursive. 'sudo rm -r CodeIgniter-3.0.4/'.

Lastly we need to tell CodeIgniter where our 'system' and 'application' folder is. This requires full path. Open index.php file and edit following variables $system_path, $application_folder and $view_folder. For example, my 'application' folder is inside var/www so I do 'gedit index.php' to start editing it, and replace '$application_folder''s value to /var/www/application.

Remember that permissions to edit, read and execute are required for root folder and read and write permissions for 'application' and 'system' folder and its subdirectories. You can learn more about in my permissions introductory tutorial. http://www.webdevtown.com/2016/02/what-is-file-permission-in-linux-and.html

So that's all you do to install CodeIgniter on linux! If there's any questions feel free to ask in comments.

You can read more about codeIgniter framework on their official website.
http://www.codeigniter.com/

No comments:

Post a Comment