Debian php fpm restart

Debian php fpm restart

I am a new Linux and Unix system user. I want to reload or restart my PHP-fpm service. How do I restart PHP-fpm? How do you restart php7.0-fpm on Ubuntu Linux 16.04 LTS server?

PHP-FPM is nothing but a straightforward and robust FastCGI Process Manager for PHP. You can use it with Apache, Nginx, and other web servers. It includes many advanced features. Let us see how to stop or restart or reload PHP-FPM after you update php.ini file.

How do I edit php.ini or www.conf file?

To edit php-fpm config file:

$ sudo vi /etc/php/7.0/fpm/php-fpm.conf
$ sudo vi /etc/php/7.0/fpm/pool.d/www.conf

Once edited, save and close the file. Now you need to run command as per your Linux/Unix distro version after editing the file.

Start php-fpm on CentOS/RHEL 7

Reload php-fpm CentOS/RHEL 7

Restart php-fpm CentOS/RHEL 7

Start/stop/restart/reload php-fpm on CentOS/RHEL 6.x or older

Type the following command:

$ sudo service php-fpm start # $ sudo service php-fpm stop # $ sudo service php-fpm restart # $ sudo service php-fpm reload #

How to start/stop/restart/reload php5-fpm (php version 5.x) on Ubuntu/Debian Linux

$ sudo service php5-fpm start
$ sudo service php5-fpm stop
$ sudo service php5-fpm restart # $ sudo service php5-fpm reload #

OR if you are using systemd based distro such as Ubuntu Linux 16.04+ LTS or Debian Linux 8.x+:

$ sudo systemctl start php7.0-fpm.service
$ sudo systemctl stop php5-fpm.service
$ sudo systemctl restart php5-fpm.service # $ sudo systemctl reload php5-fpm.service #

How to start/stop/restart/reload php7.0-fpm (php version 7.x) on Ubuntu/Debian Linux

$ sudo service php7.0-fpmstart
$ sudo service php7.0-fpm stop
$ sudo service php7.0-fpm restart # $ sudo service php7.0-fpm reload #

OR if you are using systemd based distro such as Ubuntu Linux 16.04+ LTS or Debian Linux 8.x+:

$ sudo systemctl start php7.0-fpm.service
$ sudo systemctl stop php7.0-fpm.service
$ sudo systemctl restart php7.0-fpm.service # $ sudo systemctl reload php7.0-fpm.service #

How do you restart/reload php-fpm on Alpine Linux?

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

How do you restart/reload php-fpm on FreeBSD unix?

# /usr/local/etc/rc.d/php-fpm start # /usr/local/etc/rc.d/php-fpm stop # /usr/local/etc/rc.d/php-fpm reload # # /usr/local/etc/rc.d/php-fpm restart # 

OR use the service command:

# service php-fpm start # service php-fpm stop # service php-fpm restart # service php-fpm reload

Posted by: Vivek Gite
The author is the creator of nixCraft and a seasoned sysadmin and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on Twitter, Facebook, Google+.
SHARE THIS ON:

Источник

How to Restart PHP: A Step-by-Step Guide

If you’re working with PHP, you may find yourself needing to restart the PHP service from time to time. Perhaps you’ve made changes to a configuration file, or maybe you’re experiencing some issues with the PHP service that require a restart. Whatever the reason, restarting PHP is a simple process that can be done in […]

| Reader Disclosure Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission.

How to Restart PHP

If you’re working with PHP, you may find yourself needing to restart the PHP service from time to time. Perhaps you’ve made changes to a configuration file, or maybe you’re experiencing some issues with the PHP service that require a restart. Whatever the reason, restarting PHP is a simple process that can be done in just a few steps.

In this article, we’ll discuss how to restart PHP on various platforms, including Linux, Windows, and macOS. We’ll also provide some code examples and explain related concepts that may help you better understand the process.

What is PHP?

Before we dive into how to restart PHP, let’s first define what PHP is. PHP is a server-side scripting language that is used to create dynamic web pages. It is open-source and widely used, particularly in the development of content management systems (CMS) like WordPress, Joomla, and Drupal.

PHP can be run on various platforms, including Linux, Windows, and macOS. It is typically installed as a module for a web server, such as Apache or Nginx.

How to Restart PHP on Linux

On Linux, you can restart the PHP service using the command line. The exact command may vary depending on the Linux distribution you’re using, but in most cases, you can use the following command:

sudo service php-fpm restart

This command will restart the PHP-FPM service, which is the most common way of running PHP on Linux. If you’re using a different PHP service, such as mod_php or php-cgi, you’ll need to use a different command to restart it.

How to Restart PHP on Windows

On Windows, you can restart the PHP service using the Services Manager. Here’s how:

  1. Press the Windows key + R to open the Run dialog box.
  2. Type «services.msc» and press Enter.
  3. Scroll down to find the PHP service you want to restart (e.g. «PHP 7.4 FPM»).
  4. Right-click on the service and select «Restart».

Alternatively, you can use the command line to restart the PHP service on Windows. Open the Command Prompt and use the following command:

Replace with the name of the PHP service you want to restart.

How to Restart PHP on macOS

On macOS, you can restart the PHP service using the Terminal. Use the following command:

sudo launchctl stop sudo launchctl start

Replace with the name of the PHP service you want to restart. The most common PHP service on macOS is «php-fpm».

Code Examples

Here are some code examples that may require you to restart the PHP service:

1. Editing the php.ini File

If you’ve made changes to the php.ini file, you’ll need to restart the PHP service for the changes to take effect. Here’s an example of how to edit the php.ini file:

; Enable error reporting error_reporting = E_ALL ; Enable display of errors display_errors = On

2. Installing a New PHP Extension

If you’ve installed a new PHP extension, you’ll need to restart the PHP service for the extension to be loaded. Here’s an example of how to install the «gd» extension and restart the PHP service on Linux:

sudo apt-get install php7.4-gd sudo service php-fpm restart

Conclusion

Restarting PHP is a simple process that can be done in just a few steps. Whether you’re working on Linux, Windows, or macOS, you can restart the PHP service using the command line or Services Manager. Remember to restart the PHP service whenever you make changes to the configuration files or install new extensions.

Alex Ivanovs

Alex is a full-stack developer with more than 15 years of experience. After many years of threading the self-taught path, he discovered a natural passion for writing. His past work includes helping build the Huffington Post Code column and working with publishers such as Entrepreneur, TheNextWeb, and many prominent tech startups.

Read also

Источник

php fpm restart nginx ubuntu enable status page, monitor etc

How to check fpm configuration file errors before restart

root@localhost:~# php-fpm7.4 -t
[30-Jul-2021 17:05:34] NOTICE: configuration file /etc/php/7.4/fpm/php-fpm.conf test is successful

php fpm config test for syntax errors

root@murali:~# php-fpm8.1 -t
[18-Jul-2023 04:29:08] NOTICE: configuration file /etc/php/8.1/fpm/php-fpm.conf test is successful

How restart Php fpm ubuntu Debian

systemctl restart php7.4-fpm

systemctl reload php7.4-fpm

How to Enable and Monitor PHP-FPM Status in Nginx

#1 edit the pho-fpm conf file

#2 edit nginx default conf add this code

#3 restart reload nginx

#4 check status page

pool: www process manager: dynamic start time: 02/Apr/2021:19:16:20 +0000 start since: 1588836 accepted conn: 189149 listen queue: 0 max listen queue: 19 listen queue len: 65536 idle processes: 15 active processes: 1 total processes: 16 max active processes: 31 max children reached: 0 slow requests: 0
pool: www process manager: dynamic start time: 02/Apr/2021:19:16:20 +0000 start since: 1589136 accepted conn: 189184 listen queue: 0 max listen queue: 19 listen queue len: 65536 idle processes: 15 active processes: 1 total processes: 16 max active processes: 31 max children reached: 0 slow requests: 0 ************************ pid: 28970 state: Idle start time: 17/Apr/2021:05:04:18 +0000 start since: 344258 requests: 2510 request duration: 108062 request method: POST request URI: /wp-admin/admin-ajax.php content length: 6490 user: - script: /var/www/html/raazkumar.com/wp-admin/admin-ajax.php last request cpu: 74.03 last request memory: 2097152 ************************ pid: 28874 state: Idle start time: 17/Apr/2021:04:51:08 +0000 start since: 345048 requests: 2541 request duration: 114807 request method: GET request URI: /index.php content length: 0 user: - script: /var/www/html/raju/index.php last request cpu: 60.97 last request memory: 2097152 ************************ pid: 2205 state: Idle start time: 20/Apr/2021:11:57:32 +0000 start since: 60264 requests: 425 request duration: 355489 request method: POST request URI: /wp-cron.php?doing_wp_cron=1618980078.5080909729003906250000 content length: 0 user: - script: /var/www/html/sarkariresultz.in/wp-cron.php last request cpu: 61.89 last request memory: 12582912 ************************ pid: 28951 state: Idle start time: 17/Apr/2021:05:03:05 +0000 start since: 344331 requests: 2522 request duration: 130015 request method: POST request URI: /wp-admin/admin-ajax.php content length: 67 user: - script: /var/www/html/raazkumar.com/wp-admin/admin-ajax.php last request cpu: 69.22 last request memory: 2097152 ************************ pid: 28964 state: Idle start time: 17/Apr/2021:05:04:16 +0000 start since: 344260 requests: 2512 request duration: 384968 request method: GET request URI: /index.php content length: 0 user: - script: /var/www/html/sarkariresultz.in/index.php last request cpu: 77.93 last request memory: 31457280 ************************ pid: 28975 state: Idle start time: 17/Apr/2021:05:04:23 +0000 start since: 344253 requests: 2502 request duration: 5912 request method: GET request URI: /index.php content length: 0 user: - script: /var/www/html/jojowealth.com/index.php last request cpu: 169.15 last request memory: 2097152 ************************ pid: 28859 state: Running start time: 17/Apr/2021:04:50:59 +0000 start since: 345057 requests: 2540 request duration: 3227 request method: GET request URI: /status?full content length: 0 user: - script: - last request cpu: 0.00 last request memory: 0

php fpm status page html

#5 understanding php-fpm status page report

pool www
process manager dynamic
start time 14/Jul/2020:16:12:35 +0000
start since 43224 // number of seconds since the process has started.
accepted conn 3384 // accepted request from nginx
listen queue current ques
max listen queue maximum queue still server start requests in the queue of pending connections
listen queue len maximum length 65536 .. sysctl conf has to modify
idle processes 2
active processes 1
total processes 3
max active processes 3 // max active processes still the server started
max children reached 0 // how many times its reached max process increase (php fpm pool configuration)
slow requests 0 // you have enable first also available at /var/log/phpslow

request duration – in microseconds (1000th of milli second)
request method – GET, POST,
request URI – request URI with the query string.
content length – content length of the request (only with POST).
user – user (PHP_AUTH_USER) (or ‘-‘ if not set).
script – main script called (or ‘-‘ if not set).
last request cpu%cpu the last request consumed (note that it’s always 0 if the process is not in Idle state).
last request memory – max amount of memory the last request consumed

Источник

Читайте также:  Xml processing with python
Оцените статью