Bootstrap FreeKB - PHP - php.ini on Docker
PHP - php.ini on Docker

Updated:   |  PHP articles

This assumes you have pulled down the PHP FPM image from https://hub.docker.com/_/php, and that you have the PHP FPM container up and running.

There are 2 php.ini in the container.

/usr/local/etc/php/php.ini-development
/usr/local/etc/php/php.ini-production

 

By default, neither of these php.ini files are used, due to the files having -development and -production. To use these files, you will need to rename one of the files to be just php.ini. The docker cp command can be used to copy one of the php.ini files from the container to your Docker host.

docker cp php-fpm:/usr/local/etc/php/php.ini-development .

 

Rename the file to be php.ini.

mv php.ini-development php.ini

 

Place the php.ini at a reasonable location on your Docker host.

/usr/local/docker/php/php.ini

 

Stop and remove the PHP FPM container.

sudo docker stop php-fpm
sudo docker rm php-fpm

 

Create a new PHP FPM container, using the --volume option to mount the php.ini file on your Docker host to /usr/local/etc/php/php.ini in the container.

docker run 
--detach
--name php-fpm
--publish 9000:9000
--volume /usr/local/docker/php/php.ini:/usr/local/etc/php/php.ini
--restart unless-stopped
php:fpm

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 0dba3a in the box below so that we can be sure you are a human.