How to Install & Configure Codeigniter 4 in XAMPP

This tutorial help to configure and install Codeigniter 4, This is latest version of codeigniter and supported by php 7.2+.The CodeIgniter 3.1.11 is the stable version of the framework which supported by PHP 5.6+.

CodeIgniter 4 is the upcoming version of the framework, intended for use with PHP7.2. Development is underway, and the current version is v4.0.0-rc.3. You can get more information from here.

CodeIgniter is a powerful PHP framework with a very small footprint, built for developers who need a simple and elegant toolkit to create full-featured web applications.

The Pre-requisite For Codeigniter 4

  • System must have php 7.2+.
  • The composer must have installed into the system.
  • The php internationalize package(php_intl.dll) must be enabled.

I am using xampp to install and configure codeigniter, You can check php version using below command –

D:\xampp\htdocs\codeigniter-blog>php -v
PHP 7.3.8 (cli) (built: Jul 30 2019 12:44:06) ( ZTS MSVC15 (Visual C++ 2017) x64 )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.8, Copyright (c) 1998-2018 Zend Technologies

Install CodeIgniter in Xampp

I am using composer to install package. Open the window command window and run below command –

composer create-project codeigniter4/appstarter codeigniter-blog -s rc

codeigniter-blog is a your codeigniter project name.

I am creating skeleton app of codeigniter 4, The CodeIgniter 4 app starter repository holds a skeleton application, with a composer dependency on the latest released version of the framework.

Now, We will update dependency using below command. Whenever there is a new release, then from the command line in your project root:

composer update

Create Virtual Host in XAMPP

Let’s create virtual host for this codeigniter projects, open the the Apache httpd-vhosts.conf file which are located in D:\xampp\apache\conf\extra\httpd-vhosts.conf, Added below lines of code at the end of the file.

    DocumentRoot "D:/xampp/htdocs/codeigniter-blog/public"
    ServerName codeigniter-blog.com

Now, Open the hosts file which are located at C:\Windows\System32\drivers\etc\hosts, Added below code into this file at the end.
127.0.0.1 codeigniter-blog.com

restart the xampp server.

Let’s open the browser and navigate http://codeigniter-blog.com, if you are getting welcome page, that means everything fine otherwise you ll get intl package is not enabled.

You can enable php intl package by following steps:

php_intl.dll file exist in php/ext folder

  • Open php config file (php.ini, ) usually in the same folder as the php executable.
  • Search the "extension=php_intl.dll" line into the php.ini file, if it is existing and commented, un-comment it.
  • Restart the web server (usually Apache).
  • Check if the extension is enabled using phpinfo().

php_intl.dll doest not exist in php/ext folder

  • Check your php version by running the php -v command.
  • Download the PHP version that corresponds to yours from the PHP Downloads Page (TS/NTS, x86/x64).
  • Search for the php_intl.dll file in the ext folder in that version and copy it in your php\ext folder.
  • Search the php.ini file and open it.
  • Add "extension=php_intl.dll" into the php.ini file.
  • Restart the web server (usually apache)
  • Check if the extension is enabled using phpinfo()

Open your favorite browser and navigate http://codeigniter-blog.com. Hopefully, You will get codeigniter welcome message.

Leave a Reply

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