Free collection of beautiful vector icons for your web pages.

How to install CodeIgniter 4 on Amazon AWS Cloud9 server

The following has been tested with:

Configure your Amazon AWS server. First read the following guide to set up your server:

Install composer

Start by installing composer :

sudo apt install composer

Install PHP extensions

Install the following extensions:

sudo apt install php-curl
sudo apt install php-intl
sudo apt install php-xml
sudo apt install php-mbstring

Install CodeIgniter with composer

Everything should be ready to install CodeIgniter with composer. I installed CodeIgniter in the ci folder with the following command:

composer create-project codeigniter4/appstarter ci

Set rights

CodeIgniter needs right access to the folder writable. Let's add the rights to the group www-data:

sudo chown www-data -R ci/writable/  

Check the /ci/public/ uri in your browser, you should get the CodeIgniter welcome page.

Update document root

Once it works, you should update your document root folder in apache files:

Set Apache root directory

Apache is configured with the root directoy located at /var/www/ or ou /home/ubuntu/environement/. As we want to use public folder as server root, we need to change Apache root directory for /home/ubuntu/environement/ci/public/.

Edit the file /etc/apache2/apache2.conf with one of the following commands:

sudo vim /etc/apache2/apache2.conf
sudo nano /etc/apache2/apache2.conf

Update the following line:

<Directory /home/ubuntu/environment/ci/public>

Edit the file /etc/apache2/sites-enabled/000-default.conf with one of the following commands:

sudo vim /etc/apache2/sites-enabled/000-default.conf
sudo nano /etc/apache2/sites-enabled/000-default.conf

Find and update the following line:

DocumentRoot /home/ubuntu/environment/ci/public/

Restart Apache with the following command:

sudo service apache2 restart

You should now have the welcome page at the root of your server.

See also

Last update : 05/06/2020