General

What Is the PHP.ini File and Where Is It Located? Understanding the Main Parameters and How to Edit It

General·March 22, 2026·26 min read

The PHP.ini file is a configuration file that contains your web server's PHP settings.

Although it comes preconfigured, you may need to change the default PHP settings for your website to work properly. However, the process can be challenging if you don't know the file's location and parameters.

In this article, we will explain the location of the PHP.ini file and its important parameters. We will also show you how to edit the PHP.ini file using the control panel, SSH client, and WordPress to change its configuration settings.

What Is PHP.ini?

PHP.ini is a configuration file that contains your web server's PHP settings.

It allows you to control PHP-related rules on your site, such as setting the upload file size limit, resource timeouts, and session handling.

This PHP configuration file location varies depending on the web server. To change its settings, you must find the file in the correct directory.

Where Is the PHP.ini File Located?

The PHP.ini file location varies depending on your server, PHP version, and operating system. The system loads it in the following order:

1. The location specific to the server application programming interface (SAPI) module.

2. The PHP runtime configuration environment variable (PHPRC).

3. The current working directory, which can be searched using the getcwd() function.

4. The installed PHP or web server directory.

Instead of manually searching for your INI files through your hosting's file managers, create a new PHP file to display the PHP.ini path. This method is simpler and works for any system.

Among various methods, creating a new PHP file within your domain's root directory is the easiest way to find the PHP.ini location. Here is the quick guide for HolyHosting hPanel users:

1. Go to hPanel → Hosting → Manage.

2. Click on File Manager.

3. Navigate to your site's root directory. In our case, it is /home/user/public_html.

4. Select the + File icon. Enter a file name with a PHP extension, such as phpinfo.php. Click Create.

5. Right-click on the new file → Edit and enter the following code:

```php

<?php

phpinfo();

?>

```

6. Click Save Changes.

7. Enter your domain.tld/phpinfo.php in your web browser and press Enter.

8. Look for the Loaded Configuration File. The PHP.ini path should look like this:

PHP.ini file path in the PHP info output

This method also works on cPanel to locate the PHP.ini file of a virtual private server or dedicated server. Alternatively, connect to the server's terminal using SSH and run the following command:

```bash

php -i | grep 'Configuration File'

```

Your SSH client will display the directory, which is usr/local/lib for most web servers. Alternatively, you can use the find command for Linux to search for the PHP.ini file path.

Important PHP.ini File Parameters

In this section, we will explain the most important parameters in the PHP.ini file, including their values and functions.

display_errors

Determines whether PHP error messages are displayed to users during script execution. Its value can be either on or off. The default is off for production, as error messages can reveal sensitive server information.

error_reporting

Sets which error message is displayed to users when display_errors is enabled. The PHP.ini parameter supports values and predefined constants.

You can use various constants and exclude specific errors. For example, to display all errors except deprecation notices, set the value to:

```php

E_ALL & ~E_DEPRECATED

```

error_log

Specifies the file where PHP will log errors for troubleshooting. Before enabling it, check if the logging service is writing error log data properly.

file_uploads

Sets whether HTTP file uploads are enabled or not. The on value will allow users to upload images, documents, and other types of files.

upload_max_filesize

This parameter determines the maximum uploaded file size that PHP allows on your site. Since the default value is only 2 MB, you may need to increase the PHP maximum upload size.

Read more about this topic in our tutorial on how to fix the upload_max_filesize issue in WordPress.

post_max_size

The maximum size of POST data that PHP can collect from HTML forms on your site. The default value is 8 MB, but you may need to increase it if you expect large form submissions.

allow_url_fopen

Allows writing a PHP script to access remote files from another server. It is disabled by default for security reasons.

allow_url_include

This directive has a similar function to allow_url_open, but uses the include function. To enable it, set the value to On.

session.name

This directive sets the name of the current session used in cookies and URLs. You can change the default value from PHPSESSID.

session.auto_start

Chooses whether a PHP session starts automatically or upon request when users access your site. The default value is 0, meaning the feature is off.

session.cookie_lifetime

Specifies the duration of the session cookie in your site visitors' browsers. By default, the value is 0, meaning the cookie will expire once the browser is closed.

memory_limit

Sets the maximum amount of RAM that a PHP script can use. Be careful when increasing the memory limit, as setting it too high can cause resource issues.

max_execution_time

Determines the maximum execution time for a script. You can change the maximum execution time from the prec

onfigured 30 seconds to any value, but setting it too high could cause performance issues on the web server.

Read more in our guide on how to fix the fatal error: max_execution_time exceeded if you encounter this error.

max_input_time

Sets how long a script can parse data collected from HTML forms on your site through the POST, GET, and PUT methods. The default value is 60 seconds.

upload_temp_dir

Specifies the temporary directory for storing uploaded files. All users must be able to write to this temporary directory.

realpath_cache_ttl

Sets the duration for your system to cache realpath information. We recommend increasing the value if PHP files don't change frequently to improve performance.

arg_separator.output

Use this data handling directive to separate arguments in PHP-generated URLs. Its value is the ampersand sign (&).

arg_separator.output

Set the separator PHP uses to parse input URLs into variables. By default, it is &, but you can use a semicolon (;).

How to Edit the PHP.ini File

Before editing the PHP.ini file, check your server's PHP configuration using phpinfo and note the current settings. This helps you track changes if issues arise.

Important! Back up your PHP.ini file before editing. This allows you to quickly restore the original configuration if a mistake occurs.

For PHP CGI, edit the INI file directly using cPanel's MultiPHP INI Editor to configure your server's PHP settings. However, the procedure may differ for other hosting or configurations.

If you are using hPanel, simply download and edit the file with a text editor.

For cPanel users, here are the steps:

1. Access your cPanel.

2. Go to the Software section → MultiPHP INI Editor.

3. Click on the Basic Mode tab. For deeper customization, select Editor Mode to manually change the PHP directives.

4. From the dropdown menu, select the home directory or domain path. This will configure the PHP.ini of the selected domain.

5. Change the settings for each PHP directive and click Apply to save the changes.

6. If your server does not support the editor tool, use the PHP Selector instead.

Alternatively, download the PHP.ini file and change the configuration directives with a text editor.

PHP Selector configuration menu in cPanel

For VPS users, configure PHP settings through an SSH client. Make sure you have root access and run the following command:

```bash

nano usr/local/lib/php.ini

```

Change the directory with the path of your PHP.ini file on your VPS.

Conclusion

PHP.ini is a configuration file that stores your web server's PHP settings. You can edit it using different methods depending on your hosting platform.

Since its location varies, create a PHP info file in your domain's root directory to find the PHP.ini file path.

The PHP.ini file contains several parameters to configure error handling, file uploads, sessions, and memory limits. We recommend only changing the parameters you understand.

HolyHosting hPanel users can simply download the file and change the parameters with a text editor, while cPanel users can use the MultiPHP INI Editor. VPS users can access the file through SSH.

Still have questions?

Come chat with us and we will get back to you as soon as possible!

Contact Support