php.ini changes don't have any effect

if you're unsure what php.ini is being used, create a new file in your webfolder, name it phpinfo.php for example , with the following content

<?php
phpinfo();
?>

then open the url in your browser (http://www.example.com/phpinfo.php). it will show the path to the php.ini being used.

when you have identified the correct file, make your desired changes, and be sure to remove the leading ; in case there is one to activate the setting.

restart apache and reload the phpinfo page, your changed setting should now show up. if it doesn't, make sure you don't have a .htaccess file in your webroot that overrides php settings.


You may want to read these threads:

  • Can't get PHP to stop showing errors
  • php 7 ignores ini files, but claims to load
  • Trouble enabling display_error in php.ini

hints:

  1. What is "Loaded Configuration File" in php_info output? -> check that you edit the correct ini-file.
  2. check for multiple occurences of your setting in the same file.
  3. Gryphius´s hint is not bad either: Uncomment the setting! (remove the leading ";")
  4. Check permissions on the ini file. The web server and php-cgi/php-fpm need read access.
  5. php 5 and later: Do not only restart the web server, but also the php-fpm service before testing.

I found a very blatant error in my php.ini file which caused this very symptom, eg. some php.ini settings did not take effect..

As of php7.0, the # character is not a valid comment starter. Only ; is accepted. But still many editors, for example vim, show characters after "#" as comments so you may not recognise that a certain part of the php.ini file is not an ignorable comment.

In my case, the php.ini filed contained this:

# ""
max_input_vars = 3000

The max_input_vars = 3000 did not take effect because the previous line is not a comment. It has some side-effect which causes my next line to be ignored.

Changing it to

; ""
max_input_vars = 3000

solved the problem.


Follow this:

Create a file inside your webroot naming it whatever you want. I usually prefer x.php

 # vim x.php

The contents of the file should be this:

<?php
phpinfo();
?>

Now open this file in your browser like this:

http://server_ip/x.php

This will show you the location of the php.ini your apache is using. Edit that php.ini and it will work.