Migration from Cloud9 to AWS Cloud9 was not easy. On cloud9, Apache was installed
and configured by default. On AWS, Apache is not properly configured, Once
Apache is installed and configure,
you sometime need to configure the php.ini
file. This page explains how to make the file edition
simple from the Cloud9 editor.
The following has been tested on a freshly AWS EC2 Cloud9 environment with the following versions:
The problem with the default Apache configuration on AWS Cloud9 is that
the php.ini
file is not at the root of your working directory (/home/ubuntu/environment
).
You can configure Apache to change the default location of the php.ini
file, but I prefere
creating a symbolic link and keeping the default apache configuration.
The php.ini file should be located at /etc/php/7.3/apache2/
php.ini
. If you can't find the file,
search for it with the following commands (the first one may be quite long):
sudo updatedb
locate php.ini
First, check there is not already a php.ini
file at the root of your working environment.
If a file already exists, you may delete, copy or backup the file:
cp php.ini backup_php.ini
Once the php.ini
file is located, create a symbolic link from the file
to the root of your working environment. In the following, we'll assume
the file is located at /etc/php/7.3/apache2/php.ini
:
(/en/aws-cloud9/how-to-run-apache-on-aws-ec2-cloud9-server/)
ln -s /etc/php/7.3/apache2/php.ini /home/ubuntu/environment
You can now edit the file, but you can't save it because the editor
does not have suffisant rights. Change the php.ini
file rights :
sudo chmod 666 /etc/php/7.3/apache2/php.ini
You can now edit and save the file at the root of your working environment, it will update you PHP configuration.
After updating your php.ini
file, do not forget to restart your Apache server:
sudo service apache2 restart