Skip to content

3 Easy Steps to Change PHP Configuration in AWS EC2 Ubuntu Server – php.ini ec2

Reading Time: < 1 minute

AWS is one of the best cloud hosting providers on the Internet. But it’s very challenging to configure something on their server as well. Here is our simple guide to change or update any PHP configuration values in AWS EC2 Ubuntu Server.

Step#1 Find your php.ini file.

Connect your Ubuntu Server AWS EC2 Instance and find the php.ini file.
The php.ini file is mostly found in the following location.

/etc/php/7.4/apache2/php.ini 
/etc/php/7.4/cli/php.ini 
ESNBM

Generally, you can find the file here. If you can’t find the above directories, simply type the following command and you can find the exact location of php.ini in AWS.

php --ini

Step#2 Change the Values

You can now change the values in your php.ini value in the AWS server with VIM Editor.

sudo vim php.ini

It will open a file editor. You can edit the values of your PHP configuration file and save the file with :wq command.

Step#3 Restart the Apache Server

Now we restart the Apache server to reflect our changes.

sudo /etc/init.d/apache2 restart

It will throw a message like ‘Restarting apache2 (via systemctl): apache2.service

Now we changed the variable successfully in php.ini file in AWS.

Looking forward to your comments.

See also  Yii PHP Framework Application Workflow

Leave a Reply