Php: How to reload php.ini in php-fpm without restarting container

Created on 28 Mar 2017  路  1Comment  路  Source: docker-library/php

How can I reload php.ini from files that were edited after the container was started? Solution posted on stack overflow is quite ugly because we lose the feature that container goes down along with php-fpm.

Most helpful comment

@Dublerq php-fpm is a process manager which supports the USER2 signal, which is used to reload the config file.

From inside the container:

kill -USR2 1

Outside:

docker exec -it <mycontainer> kill -USR2 1

Complete example:

docker run -d --name test123 php:7.1-fpm-alpine
docker exec -it test123 ps aux
docker exec -it test123 kill -USR2 1
docker exec -it test123 ps aux

>All comments

@Dublerq php-fpm is a process manager which supports the USER2 signal, which is used to reload the config file.

From inside the container:

kill -USR2 1

Outside:

docker exec -it <mycontainer> kill -USR2 1

Complete example:

docker run -d --name test123 php:7.1-fpm-alpine
docker exec -it test123 ps aux
docker exec -it test123 kill -USR2 1
docker exec -it test123 ps aux
Was this page helpful?
0 / 5 - 0 ratings

Related issues

schmunk42 picture schmunk42  路  37Comments

mahnunchik picture mahnunchik  路  21Comments

mathroc picture mathroc  路  26Comments

robbydooo picture robbydooo  路  50Comments

ephrin picture ephrin  路  25Comments