Setting Up a Default CodeIgniter Installation Using Composer on WAMP

In this guide, we will walk through the steps to create a default installation of CodeIgniter 4.5.5 using Composer on a WAMP server. The installation will be set up in a subfolder named “test”. This process will ensure that you have a functional CodeIgniter environment ready for development. You don’t have to use “test”. You can name it whatever you want.

Getting Started:

  1. Install Composer (if not already installed):
    • Download Composer from getcomposer.org.
    • Follow the installation instructions for Windows.
  2. Open Command Prompt:
    • Navigate to the WAMP server’s www directory. This is typically located at C:\wamp64\www.
cd C:\wamp64\www

3. Create the Subfolder:

  • Create a new directory named “test”.
mkdir test

4. Install CodeIgniter:

  • Use Composer to create a new CodeIgniter project in the “test” directory.
composer create-project codeigniter4/appstarter test

5. Set Up Virtual Host (optional but recommended):

  • Open the WAMP server’s httpd-vhosts.conf file, usually located at C:\wamp64\bin\apache\apache2.x.x\conf\extra\httpd-vhosts.conf.
  • Add the following configuration:
<VirtualHost *:80>
    DocumentRoot "C:/wamp64/www/test/public"
    ServerName test.local
    <Directory "C:/wamp64/www/test/public">
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

6.Update Hosts File:

  • Edit the C:\Windows\System32\drivers\etc\hosts file and add the following line:
127.0.0.1 test.local

Steps Taken

  1. Composer Installation: Composer is a dependency manager for PHP, which simplifies the process of managing libraries and packages. By installing Composer, you ensure that you can easily manage CodeIgniter and its dependencies.
  2. Command Prompt Navigation: By navigating to the www directory, you are setting the context for where your web applications will reside. This is crucial for WAMP to serve your application correctly.
  3. Creating the Subfolder: The mkdir command creates a new directory named “test” where the CodeIgniter application will be installed. This helps in organizing your projects.
  4. Installing CodeIgniter: The composer create-project command initializes a new CodeIgniter project in the specified directory. This command downloads the latest version of CodeIgniter and sets up the necessary file structure.
  5. Setting Up Virtual Host: Configuring a virtual host allows you to access your application using a custom domain (e.g., test.local) instead of localhost/test. This makes development easier and more organized.
  6. Updating Hosts File: By adding an entry to the hosts file, you are mapping the custom domain to your local server. This step is essential for the virtual host to work correctly.
  7. Restarting WAMP Server: Restarting the server applies all configuration changes, ensuring that your new virtual host is recognized and accessible.

By following these steps, you will have a fully functional CodeIgniter installation in a subfolder named “test” on your WAMP server, ready for development.

Leave a Reply

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