×


Install and configure Kohana on Linux

Are you trying to install Kohana on Linux?

This guide will help you.


Kohana PHP Framework is an open source PHP software development framework that helps php developers to build web applications faster, and also, more effectively by providing them with a set of built-in objects/classes. It also enforces highly organized coding standards.

Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform Linux related tasks.

In this context, you shall learn the steps to install Kohana on Linux.


More information about Kohana?

Kohana is a web application development framework.

Also, it is a light framework that consists of many files that are scattered across carefully structured directories. In the end, these directories are transferred to the production server and used to run the web application.

Moreover, it offers many features that include:

i. Getting started with Kohana and setting up is easy.

ii. Also, it comes with commonly required additional tools or modules.

iii. Additionally, it offers the possibility to simply expand the defaults.

iv. You can build commercial applications with its BSD licensing and so on.


How to download and Install the Kohana Framework on Linux?

Here, you will see how easy it is to install Kohana.

1. Start by installing the repositories. 

For that, execute the following commands;

sudo yum install epel-release yum-utils -y
sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y

2. Next, enable the repository by executing;

sudo yum-config-manager –enable remi-php70


3. Then install the packages by running the command;

sudo yum install php php-common php-opcache php-fpm php-zip php-mcrypt php-cli php-gd php-curl php-mysqlnd php-intl httpd* elinks -y

4. Add the parameter in the php.ini file.

vi /etc/php.ini
cgi.fix_pathinfo=0

5. Now download the kohana software;

cd /var/www/html
wget https://github.com/kohana/kohana/releases/download/v3.3.1/kohana-v3.3.1.zip

6. Then unzip the file and move to the opt folder;

unzip kohana-v3.3.1.zip
mv kohana-v3.3.1.zip /opt/

After this, the installation will be accessible from the WWW directory. So to test it, simply open your URL on a web browser.

http://localhost
or
http://ip

How to configure Kohana Installation on Linux?

1. First, run the below to edit the bootstrapping file using the nano text editor.

nano application/bootstrap.php

2. Next, run the below to edit the timezone, set the locale, and to set the base application directory location.

# Find date_default_timezone_set and set your timezone
date_default_timezone_set('Europe/London');

# Find setlocale and set your locale

setlocale(LC_ALL, 'en_UK.utf-8');

# Find base_url and set the base application directory

# Relative to the base Apache directory (i.e. /var/www/my_app)
Kohana::init(array(
'base_url' => '/',
));

3. Now, enable the modules.

# Find Kohana::modules and uncomment them
Kohana::modules(array(
'auth' => MODPATH.'auth', // Basic authentication
'cache' => MODPATH.'cache', // Caching with multiple backends
'codebench' => MODPATH.'codebench', // Benchmarking tool
'database' => MODPATH.'database', // Database access
'image' => MODPATH.'image', // Image manipulation
'orm' => MODPATH.'orm', // Object Relationship Mapping
'oauth' => MODPATH.'oauth', // OAuth authentication
'pagination' => MODPATH.'pagination', // Paging of results
'unittest' => MODPATH.'unittest', // Unit testing
'userguide' => MODPATH.'userguide', // User guide and API documentation
));

4. Save the file and exit it by pressing CTRL+X and confirm with Y.


5. Now set the permissions of two of its folders so that it is writable.

$ sudo chmod -R a+rwx application/cache
$ sudo chmod -R a+rwx application/logs

6. Finally, enable and start service

$ sudo systemctl enable httpd
$ sudo systemctl start httpd


Finalizing Everything and Testing Kohana

After bootstrapping the setup and configuring folder permissions, now you can test it by accessing the application in a web browser.

http://localhost

or

http://ip


Finally, after confirming everything is set correctly and working fine, you can remove the install.php file by running the below command.

rm -v install.php

[Need urgent assistance with Linux tasks? – We are here to help you.]


Conclusion

This article will guide you on the easy steps to install and configure Kohana on Linux.