How to Restart PHP in Linux / Unix

If you are a relatively new Linux user and you manage a server with PHP, it is important that you know that after editing the php.ini file , you must restart the PHP service.

PHp is associated with your web server or with your external FastCGI process manager. In most cases, after editing the php.ini file , you only need to restart your server, which is probably Apache, Nginx or Lighttpd, depending on what you have installed on your operating system. In this way you can apply the new saved configuration .

We will see how to restart PHP, for which, you must restart your web server. Depending on your web server, you must execute one of the following commands:

Restart Apache to restart PHP

If you use Apache, type the following command:

# /etc/init.d/apache2 restart

Or also:

# apache2ctl restart

Or also, with the service command:

# service apache2 restart

If you use CentOS, the server will have the name of httpd instead of Apache2:

# service httpd restart

Restart Nginx to restart PHP

If you use the Nginx web server, type the following command to restart it:

# /etc/init.d/nginx restart

You can also use the service command:

# service nginx restart

Or also this command:

# nginx -s reload

Restart Lighttpd to restart PHP

If you use the Lighttpd web server, type the following command to restart it:

# /etc/init.d/lighttpd restart

Or also:

# service lighttpd restart

Restart PHP-FAM FastCGI to restart PHP

If you use PHP from the PHP-FAM fastcgi manager , use one of the following commands. Depending on your version of Linux, it may be one or the other:

# /etc/init.d/php-fpm restart

For PHP5 you can also run:

# /etc/init.d/php5-fpm restart

Or also:

# service php-fpm restart

Or also:

# service php5-fpm restart

And finally you can also try:

# restart php-fpm

Donations/Tips for Technibuzz.com
Do you find my tutorials useful? Please consider supporting my website. It is hard to keep the site running when so many people block ads. Donating money to Technibuzz is easy!

The tutorials here on Technibuzz.com are provided free of charge. If you wish to make a small contribution, you can choose one of the following options:

  1. BTC (Bitcoin) Address: 1BfQdqBs4sVBUijX4m8jTri51ET2w1FmrH
  2. ETH (Ethereum) Address: 0x498e0bf35d20b1ed80dbe9cd7437808adc5e603f
  3. XMR (Monero) Address:
    87MX19uzcEjgbzsBqU1dEpBnHd86TthwuMEQMZ17E3wN71VZf4qDYPi7GVTEMMeJtyira9cUZvUkLDMwTeNaxEsLLrPj8Jg
  4. Paypal: cybersecurity@technibuzz.com

Leave a Reply

Your email address will not be published. Required fields are marked *