Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
December 30, 2020 01:09 pm

WordPress Troubleshooting: Where is php.ini?


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 allows you to configure a lot of other options as well 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, and you’ll encounter it sooner rather than 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 https://your-wordpress-site.com/phpinfo.php URL in your browser, and you should see the output of phpinfo(). Look for the following section.


The 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 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 login to your cPanel. On your dashboard, you should be able to see the following different options.


Cpanel 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 files like what is shown in the following screenshot.


File Manager List

Now, try to find the php.ini file in the list, and if it doesn’t exit, 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.



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.


Conclusion


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.




Original Link: https://webdesign.tutsplus.com/tutorials/wordpress-troubleshooting-where-is-phpini--cms-36398

Share this article:    Share on Facebook
View Full Article

TutsPlus - Code

Tuts+ is a site aimed at web developers and designers offering tutorials and articles on technologies, skills and techniques to improve how you design and build websites.

More About this Source Visit TutsPlus - Code