top of page

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

  • Writer: HolyHosting
    HolyHosting
  • Oct 30
  • 4 min read

The PHP.ini file is a configuration file that contains your web server’s PHP settings. Every time PHP starts, your system looks for this file and loads it to apply your site’s scripting rules.

Although it comes preconfigured, you might need to modify its default settings to better suit your website’s needs. For instance, you can change the session cookie name and lifetime to enable a “remember me” feature.

In this article, we’ll explain where to find the PHP.ini file, its most important parameters, and how to edit it to modify your PHP configuration.

ree

What Is PHP.ini?

PHP.ini is a configuration file that defines the PHP settings on your web server.

It allows you to control PHP-related rules for your site, such as setting upload size limits or hiding error messages.

The location of this file varies depending on your web server. To change its settings, simply open it in a text editor and modify the parameter values.


Where Is the PHP.ini File Located?

The location of PHP.ini depends on your server, PHP version, and operating system. When PHP runs, it searches for the file in the following locations:

  • The specific location for the server’s API (SAPI) module.

  • The PHP runtime configuration environment variable (PHPRC).

  • The current working directory, which can be checked with the getcwd() function.

  • The PHP or web server installation directory.

Instead of manually browsing through your hosting file manager, you can automatically locate it.

One of the easiest ways is to create a new PHP file in your domain’s root directory. Here’s how to do it using Panel:

  • Go to hPanel → Hosting → Manage.

  • Click File Manager.

  • Navigate to your site’s root directory (e.g., /home/username/public_html).

  • Click the + File icon, name it phpinfo.php, and click Create New File.

  • Right-click the new file → Edit, then paste this code:

<?php
phpinfo();
?>
  • Click Save Changes.

  • Open yourdomain.tld/phpinfo.php in your browser.

  • Find the Loaded Configuration File section — this shows your PHP.ini path.

This method also works in cPanel for locating the PHP.ini file on a VPS. Alternatively, connect via SSH and run:

php -i | grep 'Configuration File'

Your SSH client will display the directory, which is usually /usr/local/lib for most web servers.


Important PHP.ini Parameters

Here are some of the most important PHP.ini parameters (directives) and what they do:

display_errors

Controls whether PHP error messages are displayed to users (On or Off). For security reasons, this should only be enabled during development.

error_reporting

Determines which error messages are displayed when display_errors is enabled.Example:

E_ALL & ~E_DEPRECATED

This shows all errors except deprecation warnings.

error_log

Specifies the file where PHP will log errors. Ensure that your web server user has permission to write to it.

file_uploads

Enables or disables file uploads via HTTP (On or Off).

upload_max_filesize

Sets the maximum allowed file upload size (default: 2 MB). Increase it to allow larger uploads.


post_max_size

Defines the maximum size of POST data PHP can handle. This value should be higher than upload_max_filesize.


allow_url_fopen

Lets PHP scripts access remote files from other servers. Disabled by default for security reasons.


allow_url_include

Similar to allow_url_fopen, but for the include function. Requires allow_url_fopen to be enabled.


Sets the session cookie name (default: PHPSESSID). You can change it to something more descriptive.


Determines whether PHP sessions start automatically. Setting this to 0 means sessions start manually via session_start().


session.cookie_lifetime

Specifies the lifetime of the session cookie in visitors’ browsers. Default is 0 (expires when the browser closes).


memory_limit

Sets the maximum amount of RAM a PHP script can use. Increasing this too much can slow down your site or crash the server.


max_execution_time

Defines the maximum time (in seconds) a PHP script can run before being terminated (default: 30).


max_input_time

Sets how long a script can parse input data from forms using POST or GET methods.


upload_temp_dir

Specifies the temporary directory used for uploaded files. It must be writable by all users.


realpath_cache_ttl

Defines how long the system caches realpath information. Increase it for systems with files that rarely change.


arg_separator.output

Specifies the character used to separate arguments in URLs generated by PHP (default: &).


How to Edit the PHP.ini File

Before editing PHP.ini, check your server’s configuration using phpinfo.php.

⚠️ Important: Always back up your PHP.ini file before making changes. Incorrect settings can cause site errors or downtime.

If You’re Using Apache (PHP Module)

Edit PHP settings via the .htaccess file.

If You’re Using PHP CGI

Edit PHP.ini directly using cPanel’s MultiPHP INI Editor:

  • Open cPanel → Software → MultiPHP INI Editor.

  • Click the Basic Mode tab (or Editor Mode for advanced users).

  • Select your home directory or domain path.

  • Modify PHP directives and click Apply.

If your server doesn’t support this tool, use the PHP Selector instead, or download PHP.ini and edit it manually.

For VPS Users (via SSH)

Use a text editor like Nano:

nano /usr/local/lib/php.ini

Replace the path with your server’s PHP.ini directory.


Conclusion

We hope this guide has been helpful! 🚀 Remember, don’t hesitate to ask questions on the HolyHosting Discord or contact our support team.

Follow us on Twitter @HolyHosting to stay up to date.

ree

Stuffy @ HolyHosting


 
 

Related Posts

See All
How to Fix the "Mismatched Mod Channels" Error

Hello, HolyHosting players! 🌟We know that playing on modded servers is super fun, but it can also be a headache 🧠 when your mods don’t match between your game and the server. 😩 Here’s how to fix th

 
 

CREATE YOUR SERVER

READY TO GET STARTED?

Start today and we’ll offer you a 25% discount on your first bill with our new customer promotion!

Etiqueta.png
View active promotions and coupons
holyhosting logo

Powerful servers at affordable prices.

HolyHosting

Copyright © 2025 HOLY SERVERS LLC, operating under the name HolyHosting.

REG. NO.: 001599788. This business entity is officially registered at 30 N Gould St, Suite N, Sheridan, WY 82801, Wyoming, US.

  • X
  • Instagram
  • Facebook
  • Discordia
  • YouTube
  • Tik Tok

POPULAR

US

SUPPORT

Minecraft
Minecraft Dedicated Hosting
Discord Bot Hosting
Other Games Hosting
Voice Server Hosting
MC Servers Panel
Games Servers Panel

About Us
Client Area
Branding
Payment Methods
Hardware by Location
Terms and Conditions
Privacy Policies
Refund Policies

Create a Ticket
Knowledge Base
Discord
Network Status
Request Affiliation

dmca

Copyright © 2025 HOLY SERVERS LLC, operating under the registered name HolyHosting. All rights reserved.

The payment process may be handled by Tebex Limited, acting as the registered merchant and being responsible for product fulfillment and handling billing inquiries.

bottom of page