2

I'm used to restart Java Application Server (es.Tomcat) when there are memory/performance issues.

How do I "restart" PHP in similar cases? It's enough to restart the web server (Apache/Nginx)? It depends whether there is also an Application Server (es Zend )?

1
  • 1
    Determine root cause of performance issues before restarting a service. At least, top process monitoring can tell you which component is using memory or CPU. Jan 26 '17 at 2:58
2

It's enough to restart the web server

Closely, in my opinion:

  • Apache: Indeed.
  • Nginx: You'll need to verify the PHP-FPM too.

For instance,

# sudo systemctl restart nginx.service
# sudo systemctl restart php-fpm.service

As Silver's pointed out:

If PHP is integrated in your webserver you'll need to restart the webserver. If you run PHP with the FastCGI Process Manager (FPM), you'll need to restart the FPM service.

3
  • There are a lot of people running Apache2 + php-fpm, too - it's not like that option is limited to nginx .... :-)
    – s1lv3r
    Jan 25 '17 at 12:16
  • Well, I use to see Apache2 + Nginx (PHP-FPM) as reverse proxy at least. But, it has more combinations for sure. Because it's about FastCGI/CGI or whatever.
    – Hakuno
    Jan 25 '17 at 12:35
  • Exactly! That was indeed my point; maybe you should reword your answer that it says, if you run PHP with the FastCGI Process Manager (FPM), you'll need to restart the FPM service. If PHP is integrated in your webserver you'll need to restart the webserver. Saying "If you have Apache you'll need to restart Apache" is somewhat only half of the truth.
    – s1lv3r
    Jan 25 '17 at 12:44
-3

Just write a small bash script and restart all services :)

service restart apache;
service restart nginx;
service restart php-fpm;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.