Open In App

How to configure the php.ini File ?

Last Updated : 13 Feb, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

The php.ini file is a configuration file used to specify various settings for PHP. It allows developers to customize PHP behavior according to their requirements. Changing PHP settings in the php.ini file is essential for adjusting parameters such as maximum execution time, memory limit, error reporting level, etc.

Approach

  • Locate the php.ini file on your server. Its location can vary depending on your server setup.
  • Open the php.ini file using a text editor.
  • Find the section related to the setting you want to change. PHP settings are typically categorized and well-commented for easy navigation.
  • Modify the value of the setting according to your requirements.
  • Save the php.ini file and restart your web server for the changes to take effect.

Important Points:

  • Make sure to backup the php.ini file before making any changes to avoid accidentally breaking your PHP configuration.
  • Some settings may require server administrator privileges to modify.
  • Changes made to the php.ini file affect all PHP scripts running on the server.

Example: Suppose you want to increase the maximum execution time for PHP scripts from the default 30 seconds to 60 seconds. Here’s how you can do it:

  • Open the php.ini file.
  • Find the max_execution_time setting under the “Resource Limits” section.
  • Change the value from 30 to 60.
  • Save the php.ini file.
  • Restart your web server.
Maximum execution time of each script, in seconds
http://php.net/max-execution-time
Note: This directive is hardcoded to 0 for the CLI SAPI
max_execution_time = 60


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads