How to Update PHP Configurations for WordPress?

PHP is a server side scripting language used by popular content manage systems like WordPress Drupal and Joomla. It’s part of the LAMP or LEMP stack. Do does one configure PHP settings to support WordPress or other content manage systems?

PHP as you may already know is a server side scripting language. It’s widely used to support content management systems like WordPress, Joomla and Drupal. One question students ask always is how to configure PHP or where can I find PHP config files?

This brief tutorial is going to show you how to easily configure PHP and where to find the configuration files when you need to edit settings to fit your environments.

Before PHP and other PHP modules can be configured, you must first install the packages. PHP can easily be install in Ubuntu by running the commands below

sudo apt-get install php

In other Linux distributions, PHP installation might be different from the commands above. For example in CentOS, the commands to install PHP is,

sudo yum install php

Now that you know, continue below to learn where to find PHP configuration file and what are some of the common settings to configure.

Step 1: Find PHP configuration files

When you install PHP, in most cases all configuration settings are stored in the /etc/ directory. In that directory, might be other folders and files for PHP modules. The easiest way to find and identify PHP configuration file is to use PHP information page.

You’ll need Apache2 webserver for this. Again, you’ll probably always need Apache2 or other web servers when using PHP.

To view PHP info page , create a file called phpinfo.php in Apache2 root directory with the content highlighted below.

sudo nano /var/www/html/phpinfo.php

Then add the content below into the file and save it.


After saving the file, browse to the page using your web browser and you’ll find information about PHP, including where it was installed and where the configuration files are stored.


php loaded configuration file

This is how PHP info page looks like. On the page, you’ll see the default location for PHP configurations. Navigate to the config file and begin editing it to suite your environment.

Step 2: Configure PHP settings

Open PHP configuration file by running the commands below

sudo nano /etc/php/7.0/apache2/php.ini

Then look for these lines and edit them.

This line controls file upload size.. increase the values if your environment requires  you to.

post_max_size = 8M
upload_max_filesize = 2M

This line controls PHP memory limit.. increase if your environment requires it

memory_limit = 128M

Those are just few of the settings you can configure with PHP.  Be mindful of the changes, some may actually hurt your sites then provide benefits.


Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.