Wednesday, September 27, 2023
 Popular · Latest · Hot · Upcoming
rated 0 times [  351] [ 0]  / answers: 1 / hits: 904243  / 2 Years ago, thu, november 18, 2021, 3:55:05

I am currently trying to locate the correct php.ini file to edit it and restart apache so the changes will take place and I'm stumped.

I have found three different php.ini files (no idea why there are three)
this is how I found the files

$ sudo find / -name php.ini

I also did....

$ sudo php -i | grep 'Configuration File'
Configuration File (php.ini) Path => /etc/php5/cli
Loaded Configuration File => /etc/php5/cli/php.ini

I changed all of them (just to be sure) to the settings I wanted.

I restarted apache using

sudo service apache2 restart

The results...

* Restarting web server apache2

I reloaded the page and it showed that the php.ini file was not updated.

I know this because I used

echo ini_get('post_max_size');

Which was supposed to be changed to 20M but was still only 2M

I tried rebooting my computer thinking maybe that would stop the apache server and reload the php.ini file with the correct setting, but alas that attempt also failed.

Is there any chance there could be another php.ini file that could be interfering?

More From » apache2


The three files you have there are each meant for different uses.

/etc/php/5.6/cli/php.ini is for the CLI PHP program, which you found by running php on the terminal.

/etc/php/5.6/cgi/php.ini is for the php-cgi system which isn't specifically used in this setup.

/etc/php/5.6/apache2/php.ini is for the PHP plugin used by Apache. This is the one you need to edit for changes to be applied for your Apache setup which utilizes the in-built PHP module to Apache.

/etc/php/5.6/fpm/php.ini is for the php5-fpm processor, which is a fastcgi-compatible 'wrapper' for PHP processing (such as to hand off from NGINX to php5-fpm) and runs as a standalone process on the system (unlike the Apache PHP plugin)

For versions of Ubuntu lower than 16.04, /etc/php/5.6/,/etc/php/7.0/,/etc/php/7.1/, and so on, are replaced by /etc/php5/ and so on. Otherwise, these paths remain accurate. Adapt this accordingly for your environment, replacing the 5.6 or number with the actual version folder that exists on your environment.

[#29062] Friday, November 19, 2021, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.

Total Points: 500
Total Questions: 104
Total Answers: 92

Location: Virgin Islands (U.S.)
Member since Fri, May 7, 2021
2 Years ago
inaterested questions
Fri, Aug 12, 22, 21:24, 1 Year ago
Wed, Apr 27, 22, 17:14, 1 Year ago
Tue, Oct 26, 21, 20:41, 2 Years ago