How to configure ini_set in functions.php and wp-config files

WordPress Views: 435 Added Date: July 04, 2023 BZOTech Like
WordPress News: How to configure ini_set in functions.php and wp-config files

While importing WordPress theme demo data or running a PHP script, a fatal error might occur because the maximum limitations were exceeded. For example, a PHP script can run for a maximum of 30 seconds by default. So, the system will give an error if the script is ran for more than 30 seconds. We should increase these limitations in certain circumstances in the functions.php and wp-config files by using the ini_set() method.

There are 2 parameters:

  • setting_name: It specifies the name of the setting we need to modify.
  • value: Assigns the value to the setting.

Increase the limitations in functions.php and wp-config files

Find the functions.php and wp-config files and add the following code and Update File.

@ini_set('max_input_time', '6000'); //300 seconds = 5 minutes
@ini_set('max_execution_time', '6000'); // for infinite time of execution
@ini_set('memory_limit', '128M');
@ini_set('post_max_size', '64M');
@ini_set('upload_max_filesize', '32M');

How to find functions.php and wp-config files?

1. functions.php file

Go to Admin dashboard -> Appearance -> Theme File Editor -> functions.php file and add following code and Update File.

2. wp-config file

The wp-config.php file is a WordPress configuration file that is produced during the installation process. To find the PHP file in the root directory of your WordPress site, utilize your web hosting provider’s File Manager or an FTP client.
2.1. wp-config.php File via cPanel

  1. Navigate to File Manager under the Files section of your cPanel.

  1. Access the public_html → wp folder from the sidebar.
  2. Scroll down until you locate the wp-config.php file.

2.2. wp-config.php File via FTP

Connect to your FTP, navigate to the root directory of your site (public_html). The wp-config file should be there.

2.3. wp-config.php File via Local Host

If you are installing on your local host using Xampp, go to xampp → htdocs → your theme folder.

You might find other useful tutorials in our WordPress Theme FAQs page.

Reviews (0):

Rate this: