{"id":5442,"date":"2021-04-11T17:21:54","date_gmt":"2021-04-11T17:21:54","guid":{"rendered":"https:\/\/programmingfields.com\/?p=5442"},"modified":"2026-05-02T06:32:20","modified_gmt":"2026-05-02T06:32:20","slug":"how-to-install-codeigniter-4-in-windows-and-linux","status":"publish","type":"post","link":"https:\/\/programmingfields.com\/how-to-install-codeigniter-4-in-windows-and-linux\/","title":{"rendered":"How to Install CodeIgniter 4 in Windows and Linux"},"content":{"rendered":"\n<p>Currently, Codeigniter 4 is the latest release of Codeigniter framework. It is a PHP framework and built for the web development. Also, you can create RESTful API using this framework. From this post, I have started a new series on <strong>Codeigniter4<\/strong> from very scratch. Firstly, I will show you how you can <strong>install Codeigniter4<\/strong> in <strong>Windows<\/strong> and <strong>Linux<\/strong> platform. <strong>Codeigniter4 installation<\/strong> is quite simple in any operating system. After updating the Codeigniter version, in the latest release it is much similar to the Laravel framework. Here, serveral new features are added. Most interesting is now you can manage Codeigniter 4 application using the command line just like the Laravel. Now, you can download codeigniter4 directly. So, let&#8217;s move to the installation process quickly.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-light-blue ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/programmingfields.com\/how-to-install-codeigniter-4-in-windows-and-linux\/#Prerequisites\" >Prerequisites<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/programmingfields.com\/how-to-install-codeigniter-4-in-windows-and-linux\/#Install_Codeigniter4_in_Windows_and_Linux\" >Install Codeigniter4 in Windows and Linux<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/programmingfields.com\/how-to-install-codeigniter-4-in-windows-and-linux\/#Download_and_Install_Codeigniter4\" >Download and Install Codeigniter4<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/programmingfields.com\/how-to-install-codeigniter-4-in-windows-and-linux\/#Run_CodeIgniter_4_in_Localhost\" >Run CodeIgniter 4 in Localhost<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/programmingfields.com\/how-to-install-codeigniter-4-in-windows-and-linux\/#Configure_CodeIgniter_Application\" >Configure CodeIgniter Application<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/programmingfields.com\/how-to-install-codeigniter-4-in-windows-and-linux\/#How_to_Fix_CodeIgniter_Cache_Exception\" >How to Fix CodeIgniter Cache Exception<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/programmingfields.com\/how-to-install-codeigniter-4-in-windows-and-linux\/#Install_CodeIgniter4_Using_Composer\" >Install CodeIgniter4 Using Composer<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/programmingfields.com\/how-to-install-codeigniter-4-in-windows-and-linux\/#Run_CodeIgniter_4_Application_Using_Spark\" >Run CodeIgniter 4 Application Using Spark<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/programmingfields.com\/how-to-install-codeigniter-4-in-windows-and-linux\/#Compare_the_CodeIgniter_4_Directories\" >Compare the CodeIgniter 4 Directories<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/programmingfields.com\/how-to-install-codeigniter-4-in-windows-and-linux\/#Differences_of_Project_Folder\" >Differences of Project Folder<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/programmingfields.com\/how-to-install-codeigniter-4-in-windows-and-linux\/#CodeIgniter_4_Project_Folder_Structure\" >CodeIgniter 4 Project Folder Structure<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/programmingfields.com\/how-to-install-codeigniter-4-in-windows-and-linux\/#app_Directory\" >app Directory<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/programmingfields.com\/how-to-install-codeigniter-4-in-windows-and-linux\/#CodeIgniter_Helpers_Directory\" >CodeIgniter Helpers Directory<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/programmingfields.com\/how-to-install-codeigniter-4-in-windows-and-linux\/#Generate_Vendor_Directory_in_CodeIgniter_4\" >Generate Vendor Directory in CodeIgniter 4<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/programmingfields.com\/how-to-install-codeigniter-4-in-windows-and-linux\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Prerequisites\"><\/span><strong>Prerequisites<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Before creating the new project in Codeigniter 4 framework, you will require the below configurations.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>PHP &gt;= 7.3<\/strong><\/li><li><strong>MySQL (version &gt; 5)<\/strong><\/li><li><strong>Apache\/Nginx Server<\/strong><\/li><li><strong>VS Code Editor<\/strong><\/li><li><strong>Composer<\/strong> <strong>(Optional)<\/strong><\/li><li><strong>XAMPP\/WAMP<\/strong> <strong>(for windows user)<\/strong><\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Install_Codeigniter4_in_Windows_and_Linux\"><\/span><strong>Install Codeigniter4 in Windows and Linux<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>For installing Codeigniter4, you can download it from it&#8217;s official website. However, you can install it using the composer. So, you have both options. Either you can download it&#8217;s<strong> zip file<\/strong> or you may use the composer CLI to install it. I will show you the both options here. Firstly, we will see the first option to <strong>install CodeIgniter4 <\/strong>by downloading it.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Download_and_Install_Codeigniter4\"><\/span><strong>Download and Install Codeigniter4<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>You can download the latest version of Codeigniter framework from it&#8217;s <a rel=\"noreferrer noopener\" href=\"https:\/\/codeigniter.com\/download\" target=\"_blank\">official website<\/a>. You will see the CodeIgniter 4 (future) version on it&#8217;s official download page. Here, we will download the <strong>CodeIgniter 4<\/strong>.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"543\" src=\"https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-17-39-07.png?resize=1024%2C543&#038;ssl=1\" alt=\"Codeigniter Download Page\" class=\"wp-image-5448\" srcset=\"https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-17-39-07.png?resize=1024%2C543&amp;ssl=1 1024w, https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-17-39-07.png?resize=300%2C159&amp;ssl=1 300w, https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-17-39-07.png?resize=768%2C408&amp;ssl=1 768w, https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-17-39-07.png?w=1172&amp;ssl=1 1172w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><figcaption><strong>Codeigniter Download Page<\/strong><\/figcaption><\/figure><\/div>\n\n\n\n<p>For the windows user, I assume you already have XAMPP or WAMP installed in your system. XAMPP user, simply paste this downloaded framework inside the <strong>xampp\/htdocs<\/strong> folder. If you have installed WAMP then paste it inside the <strong>wamp\/www<\/strong> folder. After pasting the folder, you will require to extract the <strong>.zip file<\/strong>.<\/p>\n\n\n\n<p>Also, it will require to rename the folder. Actually, by default, the name of the folder is the <strong>framework-4.1.1<\/strong> (as per the latest version). So, here, I will rename it. After that, you can run it directly from the localhost as a PHP application runs.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Run_CodeIgniter_4_in_Localhost\"><\/span><strong>Run CodeIgniter 4 in Localhost<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>For running the codeigniter 4 in the browser, you can <strong>localhost\/folderpath\/appname<\/strong>. In my case, I pasted the downloaded file inside a folder name codeigniter. So, here this is the absolute path in the browser. I have opened it in the browser and you can see the result.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"594\" height=\"583\" src=\"https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-17-58-15.png?resize=594%2C583&#038;ssl=1\" alt=\"Codeigniter4 Project Directory\" class=\"wp-image-5450\" srcset=\"https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-17-58-15.png?w=594&amp;ssl=1 594w, https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-17-58-15.png?resize=300%2C294&amp;ssl=1 300w\" sizes=\"auto, (max-width: 594px) 100vw, 594px\" \/><figcaption><strong>Codeigniter4 Project Directory<\/strong><\/figcaption><\/figure><\/div>\n\n\n\n<p>Here, in the above result, you can see, we haven&#8217;t entered into the application completely. So, for that, you will have to click on the public\/ directory. The CodeIgniter 4 application bootstrapping starts from the <strong>index.php<\/strong> file. And this<strong> index.php<\/strong> file is contained inside the <strong>public folder<\/strong>. I will explain the folder structure in the next step.<\/p>\n\n\n\n<p>When, you will enter intot he public\/ directory then it will show you some error as showing below.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"472\" src=\"https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-17-58-28.png?resize=1024%2C472&#038;ssl=1\" alt=\"CodeIgniter 4 index file giving error\" class=\"wp-image-5451\" srcset=\"https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-17-58-28.png?resize=1024%2C472&amp;ssl=1 1024w, https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-17-58-28.png?resize=300%2C138&amp;ssl=1 300w, https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-17-58-28.png?resize=768%2C354&amp;ssl=1 768w, https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-17-58-28.png?w=1277&amp;ssl=1 1277w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><figcaption><strong>CodeIgniter 4 index file giving error<\/strong><\/figcaption><\/figure><\/div>\n\n\n\n<p>So, let&#8217;s fix this issue. Firstly, open the application into the editor. Here, I am using VS Code editor. Therefore, I have opened the folder inside it. Now, search for <strong>env<\/strong> file. The <strong>env <\/strong>file is the environment file of the application here.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Configure_CodeIgniter_Application\"><\/span><strong>Configure CodeIgniter Application<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Here, you will have to follow these steps-<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Rename <strong>env<\/strong> file to <strong>.env<\/strong> file.<\/li><li>Uncomment <strong>CI_ENVIRONMENT<\/strong><\/li><li>Change <strong>CI_ENVIRONMENT<\/strong> = <strong>production<\/strong> to <strong>development<\/strong><\/li><\/ul>\n\n\n\n<p>In the .env file, look for the <strong>CI_ENVIRONMENT<\/strong>. By default, it is commented, so you have to uncomment it by removing the <strong># symbol<\/strong>.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"446\" src=\"https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-18-14-53.png?resize=1024%2C446&#038;ssl=1\" alt=\".env File in CodeIgniter 4\" class=\"wp-image-5452\" srcset=\"https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-18-14-53.png?resize=1024%2C446&amp;ssl=1 1024w, https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-18-14-53.png?resize=300%2C131&amp;ssl=1 300w, https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-18-14-53.png?resize=768%2C335&amp;ssl=1 768w, https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-18-14-53.png?w=1133&amp;ssl=1 1133w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><figcaption><strong>env File in CodeIgniter 4<\/strong><\/figcaption><\/figure><\/div>\n\n\n\n<p>After renaming the <strong>env<\/strong> file, I just uncommented the <strong>CI_ENVIRONMENT<\/strong> and changed the <strong>production<\/strong> to <strong>development<\/strong>.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"456\" src=\"https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-18-37-14.png?resize=1024%2C456&#038;ssl=1\" alt=\"..env file after renaming\" class=\"wp-image-5454\" srcset=\"https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-18-37-14.png?resize=1024%2C456&amp;ssl=1 1024w, https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-18-37-14.png?resize=300%2C133&amp;ssl=1 300w, https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-18-37-14.png?resize=768%2C342&amp;ssl=1 768w, https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-18-37-14.png?w=1142&amp;ssl=1 1142w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><figcaption><strong>.env file in CodeIgniter 4<\/strong><\/figcaption><\/figure><\/div>\n\n\n\n<p>After the above operations, you can refresh the page. After refreshing the page, you will see the below exception.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"491\" src=\"https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-18-55-57.png?resize=1024%2C491&#038;ssl=1\" alt=\"CodeIgniter 4 Cache Exception in CodeIgniter4 Installation\" class=\"wp-image-5455\" srcset=\"https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-18-55-57.png?resize=1024%2C491&amp;ssl=1 1024w, https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-18-55-57.png?resize=300%2C144&amp;ssl=1 300w, https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-18-55-57.png?resize=768%2C368&amp;ssl=1 768w, https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-18-55-57.png?w=1281&amp;ssl=1 1281w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><figcaption><strong>CodeIgniter Cache Exception<\/strong><\/figcaption><\/figure><\/div>\n\n\n\n<p>In the above result, you can see the CodeIgniter cache exception. So, let&#8217;s find out the source of this exception.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_to_Fix_CodeIgniter_Cache_Exception\"><\/span><strong>How to Fix CodeIgniter Cache Exception<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Before, fixing this issue, firstly find out the source of the cache exception. If you are a Linux user then you will have to give the <strong>rwx<\/strong> permission to this directory. This is basically the permission issue in this directory. By default, in the Linux, writable folder has not the write permission. So, here, we will have to set the permission.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"418\" height=\"558\" src=\"https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-18-59-31.png?resize=418%2C558&#038;ssl=1\" alt=\"CodeIgniter 4 Cache Directory\" class=\"wp-image-5457\" srcset=\"https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-18-59-31.png?w=418&amp;ssl=1 418w, https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-18-59-31.png?resize=225%2C300&amp;ssl=1 225w\" sizes=\"auto, (max-width: 418px) 100vw, 418px\" \/><figcaption><strong>CodeIgniter 4 Cache Directory<\/strong><\/figcaption><\/figure><\/div>\n\n\n\n<pre title=\"set rwx permission in linux\" class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">sudo chmod -R 777 writable\/<\/code><\/pre>\n\n\n\n<p>The above command will set the read, write and execute permission to the writable folder and its subfolder. This permission is given in the recursive mode.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"635\" height=\"82\" src=\"https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-19-06-48.png?resize=635%2C82&#038;ssl=1\" alt=\"Set rwx permission in CodeIgniter 4 Writable Folder\" class=\"wp-image-5459\" srcset=\"https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-19-06-48.png?w=635&amp;ssl=1 635w, https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-19-06-48.png?resize=300%2C39&amp;ssl=1 300w\" sizes=\"auto, (max-width: 635px) 100vw, 635px\" \/><figcaption><strong>Set rwx permission in CodeIgniter 4 Writable Folder<\/strong><\/figcaption><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"566\" src=\"https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-19-13-10.png?resize=1024%2C566&#038;ssl=1\" alt=\"CodeIgniter 4 Homepage (Default Page)\" class=\"wp-image-5460\" srcset=\"https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-19-13-10.png?resize=1024%2C566&amp;ssl=1 1024w, https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-19-13-10.png?resize=300%2C166&amp;ssl=1 300w, https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-19-13-10.png?resize=768%2C424&amp;ssl=1 768w, https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-19-13-10.png?w=1252&amp;ssl=1 1252w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><figcaption><strong>CodeIgniter 4 Homepage (Default Page)<\/strong><\/figcaption><\/figure><\/div>\n\n\n\n<p>So, finally, we are able to run the homepage. Now, we will see the second way of <strong>CodeIgniter4 installation<\/strong>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Install_CodeIgniter4_Using_Composer\"><\/span><strong>Install CodeIgniter4 Using Composer<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>If you want to install CodeIgniter4 using the CLI, then you will have to go through the composer. Here, using the composer you can create a project in CodeIgniter 4. So, let&#8217;s open the command prompt or terminal. Then hit the below command there.<\/p>\n\n\n\n<pre title=\"create codeigniter4 project\" class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">composer create-project codeigniter4\/appstarter my-blog<\/code><\/pre>\n\n\n\n<p>Here, the above command will install CodeIgniter4 in the specified directory. The project name will be <strong>my-blog<\/strong>.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"827\" height=\"492\" src=\"https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-19-23-05.png?resize=827%2C492&#038;ssl=1\" alt=\"CodeIgniter4 Installation Using Composer\" class=\"wp-image-5463\" srcset=\"https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-19-23-05.png?w=827&amp;ssl=1 827w, https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-19-23-05.png?resize=300%2C178&amp;ssl=1 300w, https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-19-23-05.png?resize=768%2C457&amp;ssl=1 768w\" sizes=\"auto, (max-width: 827px) 100vw, 827px\" \/><figcaption><strong>CodeIgniter4 Installation Using Composer<\/strong><\/figcaption><\/figure><\/div>\n\n\n\n<p>After finishing the installation, let&#8217;s run the application using the <strong>spark<\/strong>. Spark is just like artisan in Laravel. Here, in the CodeIgniter 4 you can manage the <strong>CodeIgniter 4 CLI<\/strong> using the spark. It is a new package management system for the CodeIgniter.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Run_CodeIgniter_4_Application_Using_Spark\"><\/span><strong>Run CodeIgniter 4 Application Using Spark<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>To run the CodeIgniter 4 application using the command line, you can hit the below command.<\/p>\n\n\n\n<pre title=\"run codeigniter 4 application\" class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">php spark serve<\/code><\/pre>\n\n\n\n<p>After executing the above command, you will see the below response in the terminal. Here, CodeIgniter development server started on the <code>http:\/\/localhost:8080<\/code>. This is the default port of the CodeIgniter 4 application.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"673\" height=\"212\" src=\"https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-19-34-41.png?resize=673%2C212&#038;ssl=1\" alt=\"CodeIgniter 4 development server started\" class=\"wp-image-5467\" srcset=\"https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-19-34-41.png?w=673&amp;ssl=1 673w, https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-19-34-41.png?resize=300%2C95&amp;ssl=1 300w\" sizes=\"auto, (max-width: 673px) 100vw, 673px\" \/><figcaption><strong>CodeIgniter 4 development server started<\/strong><\/figcaption><\/figure><\/div>\n\n\n\n<p>You have to open the above URL in the browser to see the running application result.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"504\" src=\"https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-19-35-00.png?resize=1024%2C504&#038;ssl=1\" alt=\"CodeIgniter 4 Application Running on localhost\" class=\"wp-image-5468\" srcset=\"https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-19-35-00.png?resize=1024%2C504&amp;ssl=1 1024w, https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-19-35-00.png?resize=300%2C148&amp;ssl=1 300w, https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-19-35-00.png?resize=768%2C378&amp;ssl=1 768w, https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-19-35-00.png?w=1257&amp;ssl=1 1257w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><figcaption><strong>CodeIgniter 4 Application Running on localhost<\/strong><\/figcaption><\/figure><\/div>\n\n\n\n<p>Let&#8217;s compare the folder structure of both project directory. Firstly, we installed <strong>CodeIgniter<\/strong> by downloading from it&#8217;s official site. Secondly, we installed <strong>CodeIgniter 4<\/strong> using the composer.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Compare_the_CodeIgniter_4_Directories\"><\/span><strong>Compare the CodeIgniter 4 Directories<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The first project folder is downloaded by it&#8217;s official website.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"418\" height=\"425\" src=\"https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-21-06-52.png?resize=418%2C425&#038;ssl=1\" alt=\"\" class=\"wp-image-5472\" srcset=\"https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-21-06-52.png?w=418&amp;ssl=1 418w, https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-21-06-52.png?resize=295%2C300&amp;ssl=1 295w\" sizes=\"auto, (max-width: 418px) 100vw, 418px\" \/><figcaption><strong>Folder Structure of CodeIgniter 4 Downloaded Project<\/strong><\/figcaption><\/figure><\/div>\n\n\n\n<p>The second one is installed using the composer. So, here you may find the differences in both project folders.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"326\" height=\"503\" src=\"https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-21-07-06.png?resize=326%2C503&#038;ssl=1\" alt=\"Folder Structure of CodeIgniter 4 Using Composer\" class=\"wp-image-5473\" srcset=\"https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-21-07-06.png?w=326&amp;ssl=1 326w, https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-21-07-06.png?resize=194%2C300&amp;ssl=1 194w\" sizes=\"auto, (max-width: 326px) 100vw, 326px\" \/><figcaption><strong>Folder Structure of CodeIgniter 4 Using Composer<\/strong><\/figcaption><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Differences_of_Project_Folder\"><\/span><strong>Differences of Project Folder<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Here, some of the measure differences you may find in both folders.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>vendor directory missing in first folder.<\/li><li>tests directory is missing in first folder.<\/li><li>system directory missing in second folder.<\/li><\/ul>\n\n\n\n<p>You may generate the <strong>vendor<\/strong> directory by running the <strong>composer update<\/strong> command.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"CodeIgniter_4_Project_Folder_Structure\"><\/span><strong>CodeIgniter 4 Project Folder Structure<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"app_Directory\"><\/span><strong>app Directory<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li>The first folder is <strong>app<\/strong>. This folder contains all the important folders and subfolders which required the application.<\/li><li>The <strong>app\/Config<\/strong> folder contains all the configuration files of the application.<\/li><li>Inside the <strong>app\/Config\/Boot<\/strong> folder there are files for setting environment for development, production and testing.<\/li><li>The <strong>app\/Controllers<\/strong> folder will contain all the functions which contain logical codes. These functions will be linked with the routes.<\/li><li>Next folder is <strong>app\/Database<\/strong>. The <strong>app\/Database<\/strong> folder has two subfolders. The <strong>Migrations<\/strong> folder contain the schema of the database table. The <strong>Seeds<\/strong> folder is helpful for putting dummy records in the tables. These two features were not available in the previous version of CodeIgniter.<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"CodeIgniter_Helpers_Directory\"><\/span><strong>CodeIgniter Helpers Directory<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li>You can create and use <strong>Helpers<\/strong> in CodeIgniter using the <strong>Helper<\/strong> directory.<\/li><li>Also, you can create multilingual or set Localization using <strong>Language<\/strong> folder.<\/li><li>The next important folder is <strong>Models<\/strong> and <strong>Views<\/strong>. The <strong>Models<\/strong> contain all the <strong>database<\/strong> related query and operations. Basically, the models help the synchronization between the controllers and database.<\/li><li>The Views contain the HTML templates which are used to send and populate the data.<\/li><li>The <strong>public<\/strong> folder contains the i<strong>ndex.php<\/strong>, and <strong>.htaccess<\/strong> file. By default, the user has the access of the public folder. You can upload the images and keep into this folder.<\/li><li>If you want to create the <strong>tests<\/strong> case for your application, then you can create inside the <strong>tests<\/strong> folder.<\/li><li>The <strong>vendor<\/strong> directory contains all the necessary files on which the framework runs.<\/li><li>In the <strong>writable<\/strong> folder, you will have the <strong>cache<\/strong>, <strong>debugbar<\/strong>, <strong>logs<\/strong>, <strong>session<\/strong>, etc.<\/li><\/ul>\n\n\n\n<p>So, these are the overview of the folder strucutre in CodeIgniter 4.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Generate_Vendor_Directory_in_CodeIgniter_4\"><\/span><strong>Generate Vendor Directory in CodeIgniter 4<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>You can create vendor directory in CodeIgniter 4 by using composer. Open the project directory and hit the below command in the terminal.<\/p>\n\n\n\n<pre title=\"generate vendor directory\" class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">composer update<\/code><\/pre>\n\n\n\n<p>The above command will generate the missing vendor directory in the project folder.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"793\" height=\"411\" src=\"https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-21-41-09.png?resize=793%2C411&#038;ssl=1\" alt=\"Generating Vendor Directory in CodeIgniter 4\" class=\"wp-image-5475\" srcset=\"https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-21-41-09.png?w=793&amp;ssl=1 793w, https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-21-41-09.png?resize=300%2C155&amp;ssl=1 300w, https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Screenshot-from-2021-04-11-21-41-09.png?resize=768%2C398&amp;ssl=1 768w\" sizes=\"auto, (max-width: 793px) 100vw, 793px\" \/><figcaption><strong>Generating Vendor Directory in CodeIgniter 4<\/strong><\/figcaption><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span><strong>Conclusion<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In this post, we installed the CodeIgniter 4 in two ways. The first way, is simply download and extract the .zip file. The second way is through the composer dependency manager. So, you can follow both options as per your convenience. In CodeIgniter 4, you can use CLI, just like the other PHP framework. The CodeIgniter 4 is very much similiar to the Laravel framework. You can create database migration, seeder, and all. I will discuss all these features in the upcoming CodeIgniter posts. So, say tuned with us.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Currently, Codeigniter 4 is the latest release of Codeigniter framework. It is a PHP framework and built for the web development. Also, you can create RESTful API using this framework. From this post, I have started a new series on Codeigniter4 from very scratch. Firstly, I will show you how you can install Codeigniter4 in [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":5477,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[1977],"tags":[2019,2017],"yst_prominent_words":[825,379,1286],"class_list":{"0":"post-5442","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-codeigniter-4","8":"tag-codeigniter-4-download-and-install","9":"tag-install-codeigniter","10":"entry"},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/programmingfields.com\/wp-content\/uploads\/2021\/04\/Install-CodeIgniter.png?fit=2240%2C1260&ssl=1","jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/programmingfields.com\/wp-json\/wp\/v2\/posts\/5442","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/programmingfields.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/programmingfields.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/programmingfields.com\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/programmingfields.com\/wp-json\/wp\/v2\/comments?post=5442"}],"version-history":[{"count":1,"href":"https:\/\/programmingfields.com\/wp-json\/wp\/v2\/posts\/5442\/revisions"}],"predecessor-version":[{"id":8655,"href":"https:\/\/programmingfields.com\/wp-json\/wp\/v2\/posts\/5442\/revisions\/8655"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/programmingfields.com\/wp-json\/wp\/v2\/media\/5477"}],"wp:attachment":[{"href":"https:\/\/programmingfields.com\/wp-json\/wp\/v2\/media?parent=5442"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/programmingfields.com\/wp-json\/wp\/v2\/categories?post=5442"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/programmingfields.com\/wp-json\/wp\/v2\/tags?post=5442"},{"taxonomy":"yst_prominent_words","embeddable":true,"href":"https:\/\/programmingfields.com\/wp-json\/wp\/v2\/yst_prominent_words?post=5442"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}