Define your own php.ini for Wordpress within Apache2 Server to increase max_input_vars

It is not uncommon that you have to create/define a specified php.ini for a new website, if multiple websites are sharing the same dedicated server.

To do that, first you have to find which php.ini that your current website is loading, and then replace that php.ini with your own defined php.ini.

  1. Find the php.ini used by your existing website. To do that, we can create a php page, for example
Vim /var/www/html/
with the following content

Then you can see the php detail of your website by visiting the page, i.e. You will see something like /etc/php/7.0/php.ini, which is used by all the websites under the server.

2. Now, let’s copy the php.ini to your new website.

cp /etc/php/7.0/php.ini /var/www/html/

You now can edit the php.ini to suit your needs. In this case, I am just going to remove uncommon max_input_vars, and update the number from 1000 to 3000.

Vim /var/www/html/

3. Lastly, you will need to tell the server to load this new php.ini. To do that,

vim /etc/apache2/sites-available/

You then add the following code between the VirtualHost

PHPINIDir /var/www/html/

4. In the end, make sure you restart the apache

sudo service apache2 restart 


Leave a Reply