The base of a WordPress site is always a server that is able to run PHP scripts.

PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML.

Due to performance reasons, the resources of a web server are usually limited by the administrator or hosting provider. Sometimes these limitations can interfere with the functionality of WordPress and its themes and plugins.

We, at ModelTheme, recommend the following settings for an optimal experience with our themes and their features, such as the Demo Importer.

PHP version 7.2 and the following values:

  • post_max_size 64M
  • upload_max_filesize 64M
  • max_file_uploads 128M
  • max_input_vars 5000
  • max_execution_time 300

How to check your server specification

There are multiple ways to check the server specifications. In this article, we will present the most popular.

WordPress had its own tool that allows you to check the status of the installation, it provides many details about the theme and plugins installed, possible errors and recommendations to increase performance, the database and the server.

In the WordPress Dashboard head to Tools and then in the Site Health subsection, in the Info tab, Server section

The following are important to be checked:

  • PHP version
  • PHP max input variables
  • PHP time limit
  • Upload max filesize
  • PHP post max size

How to increase PHP limits

Sometimes those values do not match the recommended one and this can affect the performance and well-being of your website, theme, and plugins.

There are several methods to increase the values, in this article, the most popular 4 methods will be presented.

First of all, make sure to create a backup of your WordPress installation and database.

cPanel

Many hosting plans these days come with a control panel, many times it is a cPanel.

To increase the limits find the PHP Selector sections in your control panel.

In the PHP Selector, you can enable or disable PHP extensions and adjust limits, do not modify the extensions unless is it required by WordPress or you really know what you are doing as this can break your website.

Here you can set the default PHP version your website will use, and, in the options tab, adjust the limits.

Edit the wp-config.php file

Add this line at the end of your wp-config file. It is usually perfect if you place it on the spot in the screenshot below the code.

define('WP_MAX_FILE_UPLOADS', '256M');
define('WP_POST_MAX_SIZE', '64M');
define('WP_UPLOAD_MAX_FILESIZE', '128M');
define('WP_MAX_INPUT_VARS', '5000');
define('WP_MAX_EXECUTION_TIME', '300');

Edit your php.ini file

For this method, you will need to access your WordPress site’s root folder by using FTP or File Manager app in your hosting account’s cPanel dashboard.

In most cases, if you are on a shared host, then you will not see a php.ini file in your directory. If you do not see one, then create a file called php.ini and upload it in the root folder. In that file add the following code:

upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300
max_input_vars = 5000

Edit your .htaccess file

.htaccess can be edited via FTP (File Transfer Protocol) or via cPanel. If you try to modify it from your cPanel, but the file isn’t visible on the file list, then most probably you need to enable the option to view hidden files.

The .htaccess is located next to the wp-includes folder, on the root of your site.

These lines need to be added into the .htaccess file in order to increase limits

php_value post_max_size 64M
php_value upload_max_filesize 64M
php_value max_file_uploads 128M
php_value max_input_vars 5000
php_value_max_execution_time 300

After each of these methods, you can return to the first step, clear your cache and reload the WordPress Site Health page.

If none of these methods worked, we recommend you contact your hosting provider to make the changes for you.

Leave a comment