1. Web Design
  2. WordPress
  3. WordPress Hosting

WordPress Troubleshooting: Where Is php.ini?

Scroll to top
Read Time: 5 min

In this quick article, we’ll discuss the different options that you can use to locate the php.ini file in WordPress. It’s good to know where it is, since you'll sometimes need to modify some settings in that file.

For example, you may have seen this error in your WordPress site:

“uploaded file exceeds the upload_max_filesize”

This tells you that the file you are trying to upload in WordPress exceeds the configured file size in the php.ini configuration file. So you might need to increase this maximum size in the php.ini file. 

Having said that, if you know the location of the php.ini configuration file, it also allows you to configure a lot of other options related to PHP.

What Is the php.ini File?

First of all, you should know that WordPress is built on the PHP programming language. Every time a WordPress page is loaded, PHP has to run on the server. And when PHP is run, it looks for a php.ini file in some specific locations and loads it. This file configures how PHP works and has a big impact on PHP software like WordPress.

It’s certainly possible that you've never needed to modify php.ini. PHP can run happily with the settings provided in the default php.ini file, since PHP ships with these default recommended settings. In fact, there are no critical configuration parameters that you must set in order to run PHP.

However, the php.ini file provides a couple of important settings that you want to make yourself familiar with. In fact, for PHP developers, it’s inevitable that you’ll encounter it sooner or later.

How to Locate the php.ini File in WordPress

In this section, we’ll see how to find the php.ini file, which is loaded when you run WordPress. This can be tricky—the location of the php.ini file vastly varies by the environment you’re running PHP with.

The best way to know the location of the php.ini file is to use the phpinfo() function. It will tell you where php.ini is located, and it will also output all the important PHP configuration information.

You can run phpinfo() by creating a .php file and calling that function. Go ahead and create the phpinfo.php file with the following contents and place it in your document root.


Now upload this file to the root directory of your WordPress installation. Next, run the URL in your browser, and you should see the output of phpinfo(). Look for the following section.

The phpinfo FunctionThe phpinfo FunctionThe phpinfo Function

As you can see, there are two sections. The first one, Configuration File (php.ini) Path, indicates the default path of the php.ini file in your system. And the second one, Loaded Configuration File, is the path from where the php.ini file is being loaded when PHP is run.

So you can edit the php.ini file indicated in the Loaded Configuration File section, and that should work in most cases. Once you've identified the php.ini file location, don’t forget to delete the phpinfo.php file from your site.

If you don’t have access to the location of the php.ini file, you could try the solution described in the next section.

Locate the php.ini File With cPanel

In this section, we’ll see how you could edit the php.ini file to your WordPress with the help of cPanel. Of course, you need to have cPanel access on your host to use this option!

Go ahead and log in to your cPanel. On your dashboard, you should be able to see the following options.

Cpanel File ManagerCpanel File ManagerCpanel File Manager

Next, click on the File Manager link on your dashboard, and that should take you to the screen which lists files on your server. Navigate to the root WordPress installation directory. It should display a list of files, as shown in the following screenshot.

File Manager ListFile Manager ListFile Manager List

Now, try to find the php.ini file in the list, and if it doesn’t exist, you could create a new file under the document root.

How to Fix the upload_max_filesize Error

In this section, we’ll see how to fix the upload_max_filesize error. Once you’ve found the location of the php.ini file for your WordPress site, you just need to change the following settings in that file.

upload_max_filesize = 64M
max_execution_time = 300
memory_limit = 128M
post_max_size = 64M
max_input_time = 300

If you’re editing the existing php.ini file, you just need to change the values as per your requirements. On the other hand, if you’ve created a new file, you’ll need to add it.

With these changes in place, you should not get the file size error anymore, as we’ve increased the file size limit significantly. Of course, you could adjust the above settings as per your requirements.

And with that, we’ve reached the end of this article.


Today, we discussed how you could find the php.ini file in your WordPress installation. Along with that, we also discussed how to change settings in that file. Feel free to post your queries using the feed below. And check out some of our other useful WordPress troubleshooting resources!

Useful WordPress Troubleshooting Resources

Here’s a list of tutorials and other resources to help you troubleshoot problems with WordPress.

Did you find this post useful?
Want a weekly email summary?
Subscribe below and we’ll send you a weekly email summary of all new Web Design tutorials. Never miss out on learning about the next big thing.
Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.