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

前端 未结 4 764

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?

相关标签:
4条回答
  • 2020-11-29 06:05

    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
    0 讨论(0)
  • 2020-11-29 06:12

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

    • using php a module: you have to restart the server process
    • using php as cgi backend: you do not have to restart the server process
    • using php fastcgi: not sure, actually... (restarting is on the safe side, though)
    • using PHP-FPM: you have to restart the fpm server process to prevent inconsistencies
    0 讨论(0)
  • 2020-11-29 06:23

    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
    
    0 讨论(0)
  • 2020-11-29 06:28

    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
    
    0 讨论(0)
提交回复
热议问题