Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do I need to restart Apache after changing the php.ini file?

Tags:

php

apache

If I make a change to a setting in the php.ini file - do I need to restart Apache in order for it to take effect?

like image 218
simbro Avatar asked Oct 15 '12 09:10

simbro


People also ask

Do you need to restart Apache?

No, you will not need to restart Apache. You will need to "hard refresh" your web page to see the changes. Simply go to your site and load the page that should be affected. Hit Ctrl + F5 to refresh everything (some computers require the F Lock to be on before you can use F5).

What is the purpose of PHP ini file?

The php. ini file is the default configuration file for running applications that require PHP. It is used to control variables such as upload sizes, file timeouts, and resource limits. php.


4 Answers

Depends, actually. Depends on how you use php inside that webserver:

  • using php as module inside the http server: you have to restart the http server process
  • using php as cgi backend: you do not have to restart the http server process or anything else
  • using php fastcgi: you have to restart the fastcgi daemon, not the http server
  • using php-fpm: you have to restart the fpm server process, not the http server process
like image 165
arkascha Avatar answered Oct 04 '22 05:10

arkascha


On Debian 8 I had to restart PHP-FPM (and Apache) The above answers are correct, but here are the commands so you won't have to googling them.

Restart Apache :

/etc/init.d/apache2 restart

Restart php5-fpm :

sudo service php5-fpm restart
like image 41
Kaizoku Gambare Avatar answered Oct 04 '22 06:10

Kaizoku Gambare


That depends on the SAPI you're using. If you're using PHP as an Apache module for example, you need to restart apache so that the php.ini values take effect.

If you're using FCGI, you need to restart the FCGI daemon for the PHP script that you want to see the values changed. Compare with

  • Trouble changing upload_max_filesize on nginx
like image 27
hakre Avatar answered Oct 04 '22 05:10

hakre


It depends on what OS and version you are running.

I am running Apache/2.4.29 under Ubuntu.

PHP Version 7.2.24.

I restart apache with the following command and the restart is needed after modifying the php.ini file:

sudo service apache2 restart
like image 38
lcompare Avatar answered Oct 04 '22 05:10

lcompare