• logo
  • PHP
  • PHP OOPs
  • script
    • JavaScript
    • JQuery
    • Ajax
    • AngularJs
    • VueJs
    • NodeJs
    • ReactJs
  • wordpress
  • Codeigniter
  • Codeigniter 4
  • Laravel
  • Python
  • MySql
  • Json
  • C
  • C++
  • More ...
    • Cakephp Framework
    • MongoDb
    • MySqli PDO
    • .htaccess
    • HTML 5
    • CSS
    • SEO
    • DCA

Codeigniter 4 Tutorials

  • Codeigniter 4
  • Application Run
  • Application Structure
  • Configuration files
  • Errors
  • Controller
  • View
  • Model
  • How to remove index.php from URL
  • Route
  • CodeIgniter URLs
  • Helper
  • Session
  • Global Functions and Constants
  • Logging Information in CI4
  • Error Handling
  • Signin / SignUp
  • Login / Register
  • CRUD
  • Crud 1
  • Form Validation
  • Data Table
  • Pagination
  • File Upload
  • Show Data Using Ajax
  • Select2 AJAX Autocomplete Search
  • Curl Post
  • Rest API
  • Weblink
Home » HTML »  Codeigniter 4

How to Setup Codeigniter4?

Download Codeigniter4

open htdocs directory of xampp server.

unzip codeigniter in this directory

Server Requirement

PHP version 7.2 and above with the *intl* extension and *mbstring* extension installed.

File name : php.ini file

Enable

  • extension=intl
  • extension=mbstring
  • php-json
  • php-mysqlnd
  • php-xml

  • Default Directories

    File name :

    A fresh install has six directories:

    /app,
    /system,
    /public,
    /writable,
    /tests
    /docs.
    Each of these directories has a very specific part to play.

    File name :

    The source code of the project resides in the app directory. The following folders make up the basic contents:

    /app
    /Config Stores the configuration files
    /Controllers Controllers determine the program flow
    /Database Stores the database migrations and seeds files
    /Filters Stores filter classes that can run before and after controller
    /Helpers Helpers store collections of standalone functions
    /Language Multiple language support reads the language strings from here
    /Libraries Useful classes that don't fit in another category
    /Models Models work with the database to represent the business entities.
    /ThirdParty ThirdParty libraries that can be used in application
    /Views Views make up the HTML that is displayed to the client.
    All files in this directory inside the App namespace, though you are free to change that in

    File name :

    system
    This directory stores the files that make up the framework. The files in the system directory should never be modified.

    public
    The public folder contains the required assets for the application such as css, javascript and images.

    writable
    This includes directories for storing cache files, logs, and any uploads a user might send.

    tests
    This directory contains your test files.

    docs
    It holds a local copy of the CodeIgniter4 User Guide.

    Codeigniter 4 Environment Variables

    File name :

    CodeIgniter set Environment Variables by using a “dotenv” (.env) file. CodeIgniter expects .env to be at the root of your project beside the system and app directories.


    CI_ENVIRONMENT = development

    Config File

    File name : App/Config/App.php

  • public $baseURL = 'http://localhost/ci4setup/';
  • public $indexPage = '';
  • public $uriProtocol = 'PATH_INFO';

  • //change the baseUrl
    public $baseURL = 'http://localhost:8080';
    To
    public $baseURL = 'http://localhost/your_project_name/';
    //remove the index.php from indexPage
    public $indexPage = '';
    //change the uriProtocol
    public $uriProtocol = 'REQUEST_URI';
    To
    public $uriProtocol = 'PATH_INFO';

    File name :

    Step 2: Copy index.php and .htaccess files
    The second step Copy the “index.php” and “.htaccess” files file in the public directory and paste on root your project directory.

    Step 3: Update In the index.php
    Finally, after move successfully files on the root directory. The open “index.php” file and change the pathsPath.

    File name :

    $pathsPath = FCPATH . '../app/Config/Paths.php';
    To
    $pathsPath = FCPATH . 'app/Config/Paths.php';

    Error

    File name :

    Fatal error: Uncaught Error: Call to undefined function CodeIgniter\locale_set_default() in C:\xampp\htdocs\CodeIgniter4-4.0.4\system\CodeIgniter.php:184 Stack trace: #0 C:\xampp\htdocs\CodeIgniter4-4.0.4\system\bootstrap.php(181): CodeIgniter\CodeIgniter->initialize() #1 C:\xampp\htdocs\CodeIgniter4-4.0.4\public\index.php(36): require('C:\\xampp\\htdocs...') #2 {main} thrown in C:\xampp\htdocs\CodeIgniter4-4.0.4\system\CodeIgniter.php on line 184


    Enable from php.ini file

    extension=intl

    File name :

    http://localhost/ci4setup/

    File name :


    File name :


    File name :





    Itechtuto

    Connect Us Socially:

    Quick Links

    • itech
    • About Us
    • Feedback
    • Trademarks
    • Privacy Policy
    • Terms of Use
    • Sitemap
    • Trademarks
    • Privacy Policy
    • Terms of Use
    • Sitemap

    Copyright © 2016 itechxpert (P) Ltd. All rights reserved.

    Copyright © 2016 itechxpert (P) Ltd. All rights reserved.