What is the difference in the php.ini file in /etc/php/7.0/apache2 and the one in /var/www/html in the WordPress droplet?

I was looking for php.ini to adjust some memory settings for my WordPress droplet when I noticed that there are multiple php.ini files.

I found one in /var/www/html and one in /etc/php/7.0/apache2. I altered the later and things seem to be working, but what is the purpose of having 2 php.ini files and what does each control?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

The one in /etc/php/7.0/apache2 is the base configuration that PHP uses. By default, PHP does not read php.ini files located in your website’s document root. You can configure Apache to use a different file by adding PHPINIDir /path/to/directory/containing/it to its configuration file (not the virtual host config), but you usually wouldn’t need to do so.

So, in short, only the one in /etc/php/7.0/apache2 matters. The other one is not used. You can verify which one is being used by placing a file containing the following and then browsing to it: