- Different ways to Restart PHP-FPM
- One Response to “Different ways to Restart PHP-FPM”
- Как перезагрузить службу php7.0-fpm / php5.0-fpm
- Как отредактировать файл php.ini или www.conf?
- Запустите php-fpm на CentOS / RHEL 7
- Остановить php-fpm CentOS / RHEL 7
- Перезагрузить php-fpm CentOS / RHEL 7
- Перезапустите php-fpm CentOS / RHEL 7
- Запуск / остановка / перезапуск / перезагрузка php-fpm на CentOS / RHEL 6.x или старше
- Как запустить / остановить / перезагрузить / перезапустить php5-fpm (версия php 5.x) на Ubuntu / Debian Linux
- Как запустить / остановить / перезагрузить php7.0-fpm (php version 7.x) на Ubuntu / Debian Linux
- Как перезапустить php-fpm в Alpine Linux ?
- Как перезапустить php-fpm во FreeBSD unix ?
- Похожие статьи:
- How to Restart PHP: A Step-by-Step Guide
- What is PHP?
- How to Restart PHP on Linux
- How to Restart PHP on Windows
- How to Restart PHP on macOS
- Code Examples
- 1. Editing the php.ini File
- 2. Installing a New PHP Extension
- Conclusion
- Alex Ivanovs
- Read also
Different ways to Restart PHP-FPM
We all are familiar with PHP-FPM (FastCGI Process Manager). It is an alternative PHP FastCGI implementation with some additional features. It helps to reduce CPU usage by increasing the server’s available RAM in order to cache PHP scripts in the memory. This method is used instead of starting up a separate PHP process for each and every PHP request. It is mainly used for busier sites with any sizes.
Features of PHP-FPM
1) Advanced process management with graceful stop/start.
2) Ability to start workers with different uid/gid/chroot/environment, listening on different ports and using different php.ini (replaces safe_mode).
3) Stdout and stderr logging.
4) Emergency restart in case of accidental opcode cache destruction.
5) Accelerated upload support.
6) “slowlog” – logging scripts (not just their names, but their PHP backtraces too, using ptrace and similar things to read remote process’ execute_data) that are executed unusually slow.
7) Fastcgi_finish_request() – special function to finish request and flush all data while continuing to do something time-consuming (video converting, stats processing etc.).
8) Dynamic/static child spawning.
9) Basic SAPI status info (similar to Apache mod_status).
10) Php.ini-based config file.
In certain cases, we need to restart the PHP-FPM service, we can perform a Php-fpm restart using the following two possible methods.
1) We can restart the PHP-FPM from WHM
2) Restart the PHP_FPM in command line from the server backend (SSH to the server as a root user)
Restart PHP-FPM from WHM
1) Login to your WHM interface.
2) Click on the option ‘Restart Services’.
3) Navigate to the option ‘PHP-FPM service for Apache’.
4) You will navigate to a screen which asks for confirmation to restart PHP-FPM, click on the button ‘Yes’ to restart PHP-FPM.
Restart PHP-FPM via SSH
1) SSH into your server as root user.
2) Use the following command to restart the PHP-FPM service.
If you need any further help, please do reach our support department.
One Response to “Different ways to Restart PHP-FPM”
php-cgi.exe closes after maximum request(default:500) and won’t start. What should I do for it. my system; Windows server 2016, Nginx web server, php8. nginx and php are installed in the same directory.
Как перезагрузить службу php7.0-fpm / php5.0-fpm
Я являюсь новым пользователем системы Linux и Unix. Я хочу перезагрузить или перезапустить службу PHP-fpm. Как перезапустить PHP-fpm? Как перезапустить php7.0-fpm на сервере Ubuntu Linux 16.04 LTS?
PHP-FPM — это простой и надежный менеджер процессов FastCGI для PHP. Вы можете использовать его с Apache, Nginx и другими веб-серверами. Он включает в себя множество дополнительных функций. Посмотрим, как остановить или перезапустить или перезагрузить PHP-FPM после обновления файла php.ini.
Как отредактировать файл php.ini или www.conf?
$ sudo vi /etc/php/7.0/fpm/php.ini
Чтобы отредактировать файл конфигурации php-fpm:
$ sudo vi /etc/php/7.0/fpm/php-fpm.conf $ sudo vi /etc/php/7.0/fpm/pool.d/www.conf
После редактирования сохраните и закройте файл. Теперь вам нужно запустить команду в соответствии с версией дистрибутива Linux / Unix после редактирования файла.
Запустите php-fpm на CentOS / RHEL 7
$ sudo systemctl start php-fpm
Остановить php-fpm CentOS / RHEL 7
$ sudo systemctl stop php-fpm
Перезагрузить php-fpm CentOS / RHEL 7
$ sudo systemctl reload php-fpm
Перезапустите php-fpm CentOS / RHEL 7
$ sudo systemctl restart php-fpm
Запуск / остановка / перезапуск / перезагрузка php-fpm на CentOS / RHEL 6.x или старше
Введите следующую команду:
$ sudo service php-fpm start #Как запустить / остановить / перезагрузить / перезапустить php5-fpm (версия php 5.x) на Ubuntu / Debian Linux
$ sudo service php5-fpm start $ sudo service php5-fpm stop $ sudo service php5-fpm restart #ИЛИ, если вы используете дистрибутив на основе systemd, такой как Ubuntu Linux 16.04+ LTS или Debian Linux 8.x +:
$ sudo systemctl start php7.0-fpm.service $ sudo systemctl stop php5-fpm.service $ sudo systemctl restart php5-fpm.service #Как запустить / остановить / перезагрузить php7.0-fpm (php version 7.x) на Ubuntu / Debian Linux
$ sudo service php7.0-fpmstart $ sudo service php7.0-fpm stop $ sudo service php7.0-fpm restart #ИЛИ, если вы используете дистрибутив на основе systemd, такой как Ubuntu Linux 16.04+ LTS или 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 #Как перезапустить php-fpm в Alpine Linux ?
# /etc/init.d/php-fpm start # /etc/init.d/php-fpm stop # /etc/init.d/php-fpm restart #Как перезапустить php-fpm во 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 #ИЛИ используйте служебную команду:
# service php-fpm start # service php-fpm stop # service php-fpm restart # service php-fpm reloadПохожие статьи:
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.
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:
- Press the Windows key + R to open the Run dialog box.
- Type "services.msc" and press Enter.
- Scroll down to find the PHP service you want to restart (e.g. "PHP 7.4 FPM").
- 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 startReplace 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