Linux / Unix: Restart PHP Service Command

I am a new Linux user. How do I restart php after editing php.ini file on Linux operating systems?

PHP is associated with either your web-server or external FastCGI process manager. In most cases you just need to restart web-server such as Apache / Nginx / Lighttpd depending on your system and software.

ADVERTISEMENTS

Restart PHP by restarting your web-server

Type the following command as per your web-server.

Restart Apache for php service

If you are using Apache web server type the following command to restart the php:
# /etc/init.d/apache2 restart
OR
# apache2ctl restart

See how to restart Apache Web Server on Ubuntu Linux for more information.

Restart Nginx for php service

If you are using Nginx web-server type the following command to restart nginx:
# /etc/init.d/nginx restart
OR
# service nginx restart
OR
# nginx -s reload

Restart Lighttpd for php service

If you are using Lighttpd web-server type the following command to restart lightpd:
# /etc/init.d/lighttpd restart
OR
# service lighttpd restart

Restart PHP-FAM Fastcgi for PHP service

If you are running php via PHP-FAM fastcgi manager, use any one of the following as per your version of Linux/Unix:
# /etc/init.d/php-fpm restart
OR php 5 fpm:
# /etc/init.d/php5-fpm restart
OR php 7 fpm:
# /etc/init.d/php7.0-fpm restart
OR
# service php-fpm restart
OR
# service php5-fpm restart
OR
# service php7.0-fpm restart
OR
# restart php-fpm
OR
# service php-fpm restart

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallCentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
2 comments… add one
  • f4b1 Apr 19, 2017 @ 14:58

    Thank you, I did not find how to do and I could find the solution thanks to your article !

    • anonymous May 6, 2017 @ 12:37

      How to do you should by going on ExAnExEx . com

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.