Php ini settings for wordpress

Skip to content

Php ini settings for wordpress

In case you don’t have your own server or you work in different server environments, here are some settings worth checking before installing WordPress in order for the platform to work good. Here is the list of recommended server configuration for WordPress environment.

php.ini file

In php.ini file define the following:


upload_max_filesize = 128M
post_max_size = 128M
memory_limit = 512M
max_execution_time = 600
max_input_vars = 5000
max_input_time = 400

Disk space

1 GB of disk space should be available.

Memory limit

Memory limit per process: 128 MB (256 MB or more recommended).

PHP and MySQL

PHP 7.4 or greater
MySQL 5.6 or greater OR MariaDB 10.1 or greater
Nginx or Apache with mod_rewrite module
HTTPS support

Web developer and IT consultant. Freelancer with full respect for OpenCart and WordPress. Gamer, (ex)drummer and parent.

View all of janoshke's posts.

Post navigation

This topic covers processes relating to the operation of a cPanel service, if you cannot access your service – first follow this guide before continuing.

When installing custom plugins and themes quite often the developer will require you to set custom (increased) limits for common PHP environment variables such as;

  • upload_max_filesize
  • post_max_size
  • memory_limit
  • file_uploads
  • max_execution_time

To update any of these settings follow these steps:

  1. Login to cPanel – if unsure on how to do so check this article.
  2. Navigate to File Manager.
    Php ini settings for wordpress
  3. Select public_html.
    Php ini settings for wordpress
  4. Use the +File button to create a new file and call it php.ini.
    Php ini settings for wordpress
  5. Open the php.ini file you created and edit as required.
    Php ini settings for wordpress

Common options for a php.ini file that might be useful could be:

upload_max_filesize = 64M
post_max_size = 32M
memory_limit = 192M
max_input_vars = 3000
max_execution_time = 180

As you probably know WordPress is developed by the powerful programming language of PHP. In this article, we would like to talk about the php.ini file and where is PHP.ini in WordPress?

Therefore, one of the most important files you may come across in the hosting panel is the php.ini file. There are many commands in the php.ini file, by changing each command a lot of things change in WordPress.

First, let us discuss where you can actually find the php.ini file in the server, Linux, XAMPP and etc. Then, we will recommend a few configurations for the php.ini file.

Where is PHP.ini in WordPress?

The first question we answer is where to find the php.ini file?

It doesn’t matter if WordPress is on a live server or a local server. The best way to find the location of this file is to create a PHP file.

It doesn’t matter what name you use for this file. You only need to use the .php extension for it.

Then copy and paste the code below into the created file:

Finally, once the file is saved, open it in the browser. After running the file, you should be able to see the information of php.ini file.

The location of php.ini should be visible in the Configuration file path or in the Loaded Configuration File.

In normal circumstances, the file will be placed in the first location. Otherwise, if the PHP is installed as a module, it will be in the second location.

Creating the .php file may not always work and you have to use other methods to find the location of the php.ini file.

Where is PHP.ini in WAMP?

If you have WordPress installed locally on your computer, you can find the file via the program you are using. Although, the location of php.ini is different in each program. Below, we discuss different programs and where to find the php.ini in each of them.

If you are using the WAMP, then finding the php.ini is an easy task. Simply, right-click on the icon of the program and from the appeared menu click on PHP. In the opened menu you will be able to see the php.ini. This is all you need to do to find the php.ini file in the WAMP server.

Where to Find PHP.ini in XAMPP?

Php ini settings for wordpress

Finding php.ini in the XAMPP server is a bit different. Open the program and click on Config next to the Apache module. From the opened menu click on PHP(php.ini).

Where to Find PHP.ini in Linux?

If you are a Linux user, to find the php.ini file, type the code below in the Linux terminal:

PHP –I | grep “Loaded Configuration File”

The output you receive should be like below:

Loaded Configuration File =>
/usr/local/lib/php.ini

Normally, the php.ini file is located in the Loaded Configuration File. If you couldn’t find it there, simply change the path to Configuration File.

Where is PHP.ini in cPanel?

As mentioned above, it doesn’t matter if you have WordPress installed locally or on a live server.

In any case, there are multiple ways of finding the php.ini file in WordPress. Follow the steps below if you have WordPress installed on a live server and have access to the cPanel:

Php ini settings for wordpress

  • Login to your hosting panel
  • Open File Manager
  • Php.ini file is located in the Root directory

Php ini settings for wordpress

Don’t forget that the root directory is in the public_html folder. Simply click on it from the left-hand side menu.

There are some recommended configurations for the php.ini that makes the WordPress run better. Other than php.ini configurations there are other options that we will mention down below:

PHP.ini

Copy and paste the following code in the PHP.ini file:

max_execution_time = 60
memory_limit = 128M
post_max_size = 8M
upload_max_filesize = 8M
max_input_time = 60
file_uploads = On
safe_mode = Off

.htaccess file

Copy and paste the line below into the .htaccess file. This file can be found in the root directory of your website. Often, it is hidden. Therefore, use an FTP client like FileZilla to show the hidden files.

php_value max_execution_time = 60

wp-config.php file

Copy and paste the line below in the wp-config.php file to eliminate the run-time limit. Or if it is already in the file, change the value to 60.

set_time_limit = 60

PHP.ini Configurations You Can Change

There are many commands in the php.ini file. Some of them can be changed. Below are those that we can change. Knowing what each of them does is very important.

Memory_limit

As you can probably tell by its name, memory_limit is the command to limit the memory usage of PHP in WordPress.

The value you define for the memory_limit must be more than the file you are trying to upload. This is the memory needed to upload files and run commands. The recommended value is 128 MB.

Max_execution_time

The time needed to execute every script is defined by this command. In other words, the time the server needs to run the commands.

For example, if you are uploading a fairly big size to the server, it will take more than a few seconds. Therefore, you must remove the execution time or increase it.

Post_max_size

This command defines the maximum data a post can have. To eliminate the limitation change the value to 0. By using the POST method you can call the post from the server.

Upload_max_filesize

This command defines the maximum file you are allowed to upload on WordPress. You have probably seen the limited upload number displayed in the WordPress gallery. This command defines that limitation.

If the memory limit exhaust error occurred, you must eliminate this command or increase it.

Max_input_time

This command defines the seconds required for each data to be analyzed. Data like POST and GET.

The time begins exactly when the command requests PHP from the server and it ends when the command starts. The default value is -1. To eliminate this limitation, set the value to 0.

What are the best WordPress PHP settings?

BEST CONFIGURATIONS FOR PHP..
PHP.ini. Copy and paste this code into the PHP.ini file max_execution_time = 60 memory_limit = 128M post_max_size = 8M upload_max_filesize = 8M max_input_time = 60 file_uploads = On safe_mode = Off..
File. htaccess. ... .
File wp-config.php..

How do I change PHP ini in WordPress?

To update any of these settings follow these steps:.
Login to cPanel – if unsure on how to do so check this article..
Navigate to File Manager..
Select public_html..
Use the +File button to create a new file and call it php. ini..
Open the php. ini file you created and edit as required..

What should be the setting for PHP ini?

It's very essential configuration file which controls, what a user can or cannot do with the website. Each time PHP is initialized, the php. ini file is read by the system. Sometimes you need to change the behavior of PHP at runtime, then this configuration file is to use.

How do I access PHP ini in WordPress?

If you're using WAMP for your local WordPress installation, you can easily find the location of php. ini by right-clicking on the program icon and navigating to PHP > php.