How Do I Know php.ini Location?

If you’re dealing with WordPress, sooner or later you have to ask yourself this question. Although not directly connected to WordPress, php.ini is one of the most important configuration files on your server because it is responsible for configuring your PHP installation, and in such a way your WordPress site and knowing php.ini location is important.

The most frequent parameter that you might need to change is upload_max_filesize. By default it’s 2Mb, which can be quite low. Other popular ones include register_globals, safe_mode, and max_execution_time. You can also use this file to enable or disable extensions of your PHP installation.

Depending on your system and server environment there are different places and ways you can find the php.ini location.

What's php.ini Location?

Whether you’re working on localhost, or on a live server, the easiest and proven way to locate your php.ini file is to create a PHP file with a single line of code in it, and view the output.

  1. Create a file (name it however you want, in our case it’s ‘test.php’), and make sure it ends with .php extension.
  2. Put this line of code in it:
<?php phpinfo(); ?>
  1. Open the file via your browser. For example if you placed it into your root folder, run

You should see something like this:

Your php.ini file should be located either in the ‘Configuration File Path’ section, or like in my case in ‘Loaded Configuration File’ section. The first location is the default one, the second location applies in case your PHP installation is used as a module.

Other solutions

If in some cases creating a php file and inserting a single line of code doesn’t work for you, there are some other ways to find php.ini.

Local server

If you’re working locally, finding php.ini would depend on the server environment you’re using. Let’s go quickly through some of the most popular ones.


php.ini on WAMP

Left click on your WAPM server icon, then go to PHP -> php.ini. Easy? Easy.


XAMPP is a bit different beast, but also can be tamed without much difficulty. Run your XAMPP installation, right click the ‘Config’ button (in front of the Apache module) and here it is, our little guy:

php.ini XAMPP


If you’re on Linux, run the following command in the terminal:

php -i | grep "Loaded Configuration File"

It should output something like this:

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

In most cases the php.ini would be located in the ‘Loaded Configuration File’, but if it’s not there, replace the ‘Loaded Configuration File’ string with ‘Configuration File’.

Live server

The location of php.ini mostly depends on the hosting you’re using, but we’ll cover here some of the most common scenarios.


Open your file manager, and navigate to the root directory. Our little guy should be sitting at the bottom.

php.ini cPanel

If you don’t know how to find your root folder, simply go one level up your main public_html directory.

Shared Hosting

Unfortunately, if you’re on a shared hosting, you cannot access your php.ini file. The workaround would be to specify the needed configuration settings in your .htaccess file in the following pattern:

php_value name value

The name here represents the name of the PHP property you need to change. The same applies to the value. For example this line changes the maximum uploaded file size to 8 Mb:

php_value  upload_max_filesize  8M

Restart after the changes

If you made at least one change to php.ini file, you have to restart your server, otherwise the changes won’t apply. If you’re on Linux write the following command:

/etc/init.d/httpd restart

The WAMP users have to right click on the server icon in the toolbar, and choose ‘Restart all services’.

If you’re using XAMPP, go to the main dashboard, click the ‘stop’ button in front of the ‘Apache’ module, and then click the ‘start’ button again.

Final words

As you can see, finding php.ini can be both tricky and easy at the same time. I’ve tried to cover the most common solutions and server environments, and hope this guide would help you to finally locate this file. If you know any other ways to find php.ini, feel free to share your thoughts in the comments below.


What is php.ini?

It is a file that defines the work of all programs which demand PHP. It contains default configurations and controls such important things as resource limits and upload size.

Why could you need to find the php.ini?

As was previously said – it contains very important configurations for the apps that work on PHP. If you want to change some of them – you will need phph.ini.

What are the parameters that are changed the most frequently?

Well, first of all, it will probably be upload_max_filesize. The default value for it (2Mb) is commonly too small and website owners make it bigger. Besides that, chances are you would like to change the values of register_globals, safe_mode, and max_execution_time.

Read Also

How to Build & Maintain Elementor WordPress Website? [Free Course]

How to Build and Maintain an HTML5 Website? [Free Course]

Ultimate Gutenberg Editor Learning Course

Don’t miss out these all-time favourites

  1. The best hosting for a WordPress website. Tap our link to get the best price on the market with 82% off. If HostPapa didn’t impress you check out other alternatives.
  2. Website Installation service - to get your template up and running within just 6 hours without hassle. No minute is wasted and the work is going.
  3. ONE Membership - to download unlimited number of WordPress themes, plugins, ppt and other products within one license. Since bigger is always better.
  4. Ready-to-Use Website service is the ultimate solution that includes full template installation & configuration, content integration, implementation of must-have plugins, security features and Extended on-page SEO optimization. A team of developers will do all the work for you.
  5. Must-Have WordPress Plugins - to get the most essential plugins for your website in one bundle. All plugins will be installed, activated and checked for proper functioning. 
  6. Finest Stock Images for Websites - to create amazing visuals. You’ll get access to to choose 15 images with unlimited topic and size selection.
  7. SSL Certificate Creation service - to get the absolute trust of your website visitors. Comodo Certificate is the most reliable https protocol that ensures users data safety against cyber attacks. 
  8. Website speed optimization service - to increase UX of your site and get a better Google PageSpeed score.

Matthew Cain

I like to create websites from the ground up, coding them carefully with HTML and CSS. Sometimes even the best and professionally created templates need some coding tricks. And here is my Quora account.

Get more to your email

Subscribe to our newsletter and access exclusive content and offers available only to MonsterPost subscribers.

From was successfully send!
Server error. Please, try again later.

Leave a Reply