Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

From where is my php.ini being loaded in php Docker container?

Tags:

php

docker

ini

I am running this Docker instance of a linux debian:jessie with php 5.6.

This is part of my phpinfo :

enter image description here

As we can see the php.ini should be located at

/usr/local/etc/php

And this is what I have inside /usr/local/etc/

enter image description here

But there is no php.ini inside it.

I the other hand, I have the php.ini inside

enter image description here

So, from where exactly is my php.ini being loaded?

We dont even have a php process running but the php seems to be ok - being displayed phpinfo in the screen.

enter image description here

like image 200
IgorAlves Avatar asked Nov 13 '17 19:11

IgorAlves


People also ask

Where is PHP ini located in docker?

docker/base/config_files/php. ini.

Where is PHP ini located?

ini file is the default configuration file for running applications that require PHP. It is used to control variables such as upload sizes, file timeouts, and resource limits. This file is located on your server in the /public_html folder.

Where are Dockerfiles located?

The storage location of Docker images and containersUbuntu: /var/lib/docker/ Fedora: /var/lib/docker/ Debian: /var/lib/docker/ Windows: C:\ProgramData\DockerDesktop.


1 Answers

A little late to the party but since question is still relevant today, let me add a short answer:

Official php:7 images get their settings from /usr/local/etc/php folder.

# First log into the running container
$ docker exec -it «container_name» /bin/bash

# List folder content
$ ls /usr/local/etc/php

# Which outputs following line
conf.d  php.ini-development  php.ini-production

If needed, modifying settings via conf.d folder seems better alternative, since xdebug uses it. For example, you can change upload size by adding uploads.ini to conf.d folder with the following content:

file_uploads = On
memory_limit = 64M
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 600

Complete list of ini directives can be found at https://www.php.net/manual/en/ini.core.php

like image 169
snnsnn Avatar answered Sep 20 '22 00:09

snnsnn