Skip to content

php.ini production ready? #488

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
JoelLinn opened this issue Apr 27, 2020 · 4 comments
Closed

php.ini production ready? #488

JoelLinn opened this issue Apr 27, 2020 · 4 comments

Comments

@JoelLinn
Copy link

The php image provides a php-production.ini which is not used here.
This images itself overwrites some php configuration values.

Is the out of box php config of this image considered "production ready" (sure there is always things one will need to change) concerning security and best practices?

@wglambert
Copy link

The info about the php.ini is in the php docs https://github.com/docker-library/docs/tree/master/php#configuration

So users can make a Dockerfile to pick a php.ini

$ docker build -t wordpress:test - << EOF
FROM wordpress
RUN mv /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini
EOF
Sending build context to Docker daemon  2.048kB
Step 1/2 : FROM wordpress
 ---> 1ab4107e168c
Step 2/2 : RUN mv /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini
 ---> Running in 5c2806c0c621
Removing intermediate container 5c2806c0c621
 ---> bf695bb956c9
Successfully built bf695bb956c9
Successfully tagged wordpress:test

$ docker-compose up -d
Creating network "root_default" with the default driver
Creating volume "root_db" with default driver
Creating volume "root_wordpress" with default driver
Creating root_db_1        ... done
Creating root_wordpress_1 ... done

$ docker exec root_wordpress_1 php -i | grep -i php.ini
Configuration File (php.ini) Path => /usr/local/etc/php
Loaded Configuration File => /usr/local/etc/php/php.ini
PHP_INI_DIR => /usr/local/etc/php
$_SERVER['PHP_INI_DIR'] => /usr/local/etc/php

@JoelLinn
Copy link
Author

Thanks, I think there should be a note added to the documentation of this image, I suspect many users don't do this.

@rafa-suagu
Copy link

rafa-suagu commented May 3, 2020

I think that this should be managed by an environment variable to avoid DockerFile creation.

Maybe PHP_FILE or PHP_ENV ? Something like NODE_ENV

Do you accept PR?

@tianon
Copy link
Member

tianon commented May 4, 2020

That was discussed in docker-library/php#873 (we're not in favor of the complexity it brings -- in Node, NODE_ENV is a standard thing provided by the tooling, and we don't want to be the ones creating a precedence for that in the PHP community, especially since "production" is going to look a little different for every user and these two files are examples that come directly from PHP upstream -- if they had strong opinions on users using one or the other, I think they would've expressed that in the default values instead).

@JoelLinn JoelLinn closed this as completed May 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants