No results found. Try again with different words?

Search must be at least 3 characters.

Modify Your PHP Configuration

Sidebar Image

Did not find a solution? We are here to help you succeed.

Occasionally, you might need to modify your website’s PHP configuration. You will be able to solve some issues or make your website work better. Also, some plugins you would like to add to your website might require more resources. This document shows you how to do it.

PHP and why itโ€™s important?

PHP is a programming language used for writing WordPress. PHP makes it possible for WordPress to interact with the database and fetch data from it. It goes the same for your themes and plugins. 

These processes happen on your server before they are delivered to the browser, as PHP is a server-side language.ย 

PHP Limits and why do you might need to modify them?

Each WordPress installation comes with the default limits set by your hosting provider. These are usually optimal settings adjusted to the hosting services you use and will satisfy most of your websitesโ€™ needs.

As mentioned before, PHP can perform many different processes, and for all of these, it needs server resources. If, for example, you have some plugins that require more resources to function, they can take up most of the available resources, not leaving enough space for other plugins. Not having enough server resources will cause these plugins not to perform well.  

Once your websiteโ€™s needs exceed the allocated resources, a fatal error happens on your website. Thus, to have all of your plugins function correctly, you would need to increase PHP limits.

Astra and Starter Templates – PHP configuration

Astra theme and Starter Templates require minimal resources to function correctly. Occasionally, it happens that your PHP limits are set too low for the plugins already running on your website, which can cause issues. If you see a fatal error message or have your Starter Template imports fail, please modify your PHP configuration to make more resources available for your website. 

These settings will ensure that there are enough resources on your website, even if youโ€™re, for example, running some highly demanding plugins. These are not, in any case, the minimum required values, but these can be used as a configuration that would guarantee, in most cases, that your website has enough resources to function correctly:

  • memory_limit = 512M
  • max_execution_time = 900
  • max_input_time = 900
  • post_max_size = 256M
  • upload_max_filesize = 720M

You can also try increasing your values gradually and checking if you can import your template successfully with those values:

For example, if your memory_limit is set by default to 128M – try changing it first to 256M, and check if your import goes well. If not, change the value then to 315M, and then to 512M, and so on.

Modify your PHP limits – Step 1

Modifying your server and website files can be challenging if you donโ€™t have experience with this. Thus itโ€™s always a good choice to contact your hosting provider and ask for assistance with this. Most hosting companies will help you with this. Make sure to mention the values for the PHP configuration which we suggested previously.

Modify your PHP limits – Step 2

There are several ways that you can modify your PHP configuration yourself. Depending on your host, these settings could be available through your admin panel (host admin, cPanel, etc.).

If not, you can change these values directly in the PHP.ini file.

Alternatively, if it suits you more, you can make these changes also in one of the following files:

  • wp-config.php
  • .htaccess 

All of these files can be found in the root directory of your website. To access it, you would need an FTP client (like FileZilla, for example) installed on your computer and your websiteโ€™s FTP access details.

How to access the files?

Before making any changes to any of your files, please create a complete backup of your website. Also, it is advisable to make a copy of the original file before editing it – in case something goes wrong, you can always use this original file to start over.

Weโ€™ll use the FileZilla FTP client for this article, so please install it on your computer (unless you are familiar with another FTP client you would prefer to use). Letโ€™s start:

  1. Add your FTP access data to FileZillasโ€™ Site Manager;
  2. Connect to your server;
  3. Navigate to your websitesโ€™ public_html (root) folder. Here you should find the files. 

How to modify your PHP configuration? 

Now that you have found your file (PHP.ini OR wp-config.php OR .htaccess), right-click on the file and select โ€œDownloadโ€™ to copy the file to your computer.

Now you can edit the file on your computer. You can edit these files using some of the code editors like Sublime Text or Notepad++

Once you modified your file, upload it back to your server (using the FTP client), replacing the original file with this modified one, and your new values will become active.

Method 1 – modify PHP.ini

If you canโ€™t find the PHP.ini file, you can create the file yourself. Some hosts do not allow users to access the PHP.ini file. In this case, you can ask your host to allow you to create a duplicate PHP.ini file in your directory or try. The data or values in the duplicate file will override those in the original PHP.ini file. 

You can create a new file named PHP.ini in the directory where your WordPress website is installed (your root directory). Once you have the file, please follow the instructions:

Step 1 – Open the file using the code editor;

Step 2 – Add the following values:

memory_limit = 512M;
max_execution_time = 900;
max_input_time = 900;
post_max_size = 256M;
upload_max_filesize = 720M;

Step 3 – Save the file.

Note

Some servers will require a restart (Apache or Nginx) for php.ini changes to take effect. Also, depending on your server configuration, you’ll need to restart the PHP-FPM server process too. If you’re not sure how to do this, please get in touch with your hosting provider.

Method 2 – modify wp-config.php

Alternatively to modifying the PHP.ini file, you can modify the memory limit in your wp-config.php file, following these steps:

Step 1 – Open the file using the code editor;

Step 2 – Scroll down to the โ€œThatโ€™s all, stop editing! Happy publishingโ€ line;

Step 3 – Add the following value before that line:

define( 'WP_MEMORY_LIMIT', '512M' );

Step 4 – Save the file.

Method 3 – modify .htaccess

You can modify your PHP configuration also by using the .htacces file. Keep in mind that the .htaccess file may be hidden, so once you access your root directory using the FTP client, make sure you check the folder for the hidden files.ย 

To modify the file, follow these steps:

Step 1 – Open the file using the code editor;

Step 2 – Add the following values:

php_value memory_limit 512M
php_value max_execution_time 900
php_value max_input_time 900
php_value post_max_size 256M
php_value upload_max_filesize 720M

Step 3 – Save the file.

Important Note:

Please note that installing a third-party plugin may hamper your Website Design. We strongly recommend taking a backup of your website before installing the plugin. Here is anย articleย that will guide you through the process of taking a quick backup of your website.
Was this article helpful?
Sidebar Image

Did not find a solution? We are here to help you succeed.

Related Docs

Join 1,653,898+ Happy Site Owners Using Astra

Whether you are a beginner, small business owner, or professional web developer, Astra provides all the tools you need to easily build your beautiful WordPress website.

Scroll to Top
Now choose your preferred
page builder addon
Choose your preferred page builder addon

Download is Just A Click Away!

Enter your email address and be the first to learn about updates and new features.

Download Free Astra Theme - Modal Popup Form