Giter Club home page Giter Club logo

php's Introduction

Maintained by: the Docker Community

This is the Git repo of the Docker "Official Image" for php (not to be confused with any official php image provided by php upstream). See the Docker Hub page for the full readme on how to use this Docker image and for information regarding contributing and issues.

The full image description on Docker Hub is generated/maintained over in the docker-library/docs repository, specifically in the php directory.

See a change merged here that doesn't show up on Docker Hub yet?

For more information about the full official images change lifecycle, see the "An image's source changed in Git, now what?" FAQ entry.

For outstanding php image PRs, check PRs with the "library/php" label on the official-images repository. For the current "source of truth" for php, see the library/php file in the official-images repository.


  • build status badge
  • build status badge
Build Status Badges (per-arch)
amd64 build status badge arm32v5 build status badge arm32v6 build status badge arm32v7 build status badge
arm64v8 build status badge i386 build status badge mips64le build status badge ppc64le build status badge
s390x build status badge put-shared build status badge

php's People

Contributors

andrerom avatar cdams avatar daghack avatar docker-library-bot avatar dunglas avatar greyxor avatar hfm avatar j0wi avatar jenserat avatar jnoordsij avatar laurentgoderre avatar lcobucci avatar leepa avatar marceloandrader avatar mattva01 avatar md5 avatar mikk150 avatar msierks-pcln avatar ncopa avatar nick-zh avatar patrickomeara avatar q0rban avatar rogeriopradoj avatar shouze avatar skyred avatar thajeztah avatar tianon avatar timwolla avatar xuhdev avatar yosifkit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

php's Issues

Better support/documentation for docker-php-ext-install?

I'm having trouble running docker-php-ext-install ldap - what are that module's dependencies?
Searching for ldap.h in the ubuntu packages website led me to install libldap2-dev but there are still outstanding issues; configure: error: Cannot find ldap libraries in /usr/lib.

The meta-problem: How do users know what the dependencies are?
The php image is from a fixed platform, and there are relatively few extensions.
An automatic mechanism to grab those dependencies and provide working config defaults, or even just some documentation for each extension, would go a long way towards ease-of-use.

Add README and CONTRIBUTING

When working on a PR for #28, I notice that the README that is used on the registry (https://registry.hub.docker.com/_/php/) is not included in the repository.

Reading the Guidelines for Creating and Documenting Official Repositories the following files are missing;

  • README-short.txt
  • logo.png
  • README.md

And while at it, perhaps a CONTRIBUTING.md

On a final note, the current description of the repository only refers to the php.net website ("Docker Official Image packaging for PHP https://php.net").

Perhaps a link to the registry could be added for convenience?

PHP Zip Archive Enabled Fail

I have wordpress with this php docker and runing into this issue:
PHP Version [5.6.3] Pass
Zip Archive Enabled Fail

Could anyone please show me how to enable zip support in this php container? docker-php-ext-install zip saying that I need to install zlib1g-dev but that package is not found within this debian build (apt-get install zlib1g-dev).
Thanks

ldap-sasl

I installed libldap2-dev & libsasl2-dev
RUN docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu --with-ldap-sasl=/usr/include/sasl/

configure: error: sasl.h not found!

but this file in this path exists

docker-php-ext-install intl fails

Hi Guys,

I have been trying to enable the intl extension and I have been running into troubles as it keeps failing.

I get:

checking for icu-config... no
checking for location of ICU headers and libraries... not found
configure: error: Unable to detect ICU prefix or no failed. Please verify ICU install prefix and make sure icu-config works.

I fixed this by running:
apt-get install libicu-dev

Rerunning the docker-php-ext-install intl then fails again with the following:

Checking whether g++ accepts -g... no
checking how to run the C++ preprocessor... /lib/cpp
configure: error: in `/usr/src/php/ext/intl':
configure: error: C++ preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details

Is this a bug? The container doesn't appear to have the C++ compiler installed.
To fix i used:
apt-get install g++

Now the extension installs as expected.

I am using php:5.6-apache for reference.

Hope this helps.

Thanks,
Rob

Cannot connect to php-fpm from linked container

I was hoping to be able to use the php-fpm image in conjunction with the official nginx image to process php, but it didn't work as expected.

I tried to trace down the problem:

docker@boot2docker:~$ docker run -d --name php php:fpm
docker@boot2docker:~$ docker run -it --link php:php ubuntu bash
root@9441c2d294f3:/# apt-get update && apt-get install libfcgi0ldbl #cgi-fcgi utililty
root@9441c2d294f3:/# cgi-fcgi -bind -connect php:9000
Could not connect to php:9000

php-fpm

hello,
is there any possibility to get php-fpm build?
I want to use official nginx docker,
and I need stand alone fcgi to handle the PHP request.

Invalid argument for docker run and build

Getting the following errors when trying to run fpm

docker run -it --rm --name php56 -v "$PWD":/var/www/html php:5.6-fpm
FATA[0000] Error response from daemon: invalid argument

My current directory is called html and contains one file index.php

<?php
  phpinfo();
?>

Even using the example fpm Dockerfile example fails to build:

docker build -t customphp .
Sending build context to Docker daemon 2.048 kB
Sending build context to Docker daemon
Step 0 : FROM php:5.6-fpm
 ---> 8ed665fe37e5
Step 1 : RUN apt-get update && apt-get install -y         libfreetype6-dev         libjpeg62-turbo-dev         libmcrypt-dev         libpng12-dev     && docker-php-ext-install iconv mcrypt     && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/     && docker-php-ext-install gd
INFO[0000] invalid argument

My docker version is as follows:

hodor:fpm booyaa$ docker version
Client version: 1.5.0
Client API version: 1.17
Go version (client): go1.4.2
Git commit (client): a8a31ef
OS/Arch (client): darwin/amd64
Server version: 1.5.0
Server API version: 1.17
Go version (server): go1.4.1
Git commit (server): a8a31ef

I've tried issue the docker command on the docker-machine and through my local client with the same result. Created the docker host using docker-machine version 0.2.0 (48bea37) using the virtualbox driver (boot2docker).

Update: i've discovered the joys of the docker.log file in boot2docker and saw these error messages

time="2015-04-08T21:42:25Z" level="debug" msg="Calling POST /containers/create"
time="2015-04-08T21:42:25Z" level="info" msg="POST /v1.17/containers/create?name=php56"
time="2015-04-08T21:42:25Z" level="info" msg="+job create(php56)"
time="2015-04-08T21:42:25Z" level="error" msg="[warning]: couldn't run auplink before unmount: exit status 22"
invalid argument
time="2015-04-08T21:42:25Z" level="info" msg="-job create(php56) = ERR (1)"
time="2015-04-08T21:42:25Z" level="error" msg="Handler for POST /containers/create returned error: invalid argument"
time="2015-04-08T21:42:25Z" level="error" msg="HTTP Error: statusCode=500 invalid argument"

Missing dependency for bz2 ext

Installation of bz2 extension in inherited dockerfile throws error

RUN docker-php-ext-install bz2
configure: error: Please reinstall the BZip2 distribution

In order to fix it the following dependency needs to be installed

RUN apt-get update && apt-get install -y libbz2-dev

Apache CustomLog overriding

So I need to use a custom CustomLog (hah) in Apache, but if I simply add a separate conf to be included with the CustomLog, it will cause duplicate log entries to be made (this is intended by Apache). So it looks like to solve this, I would need to remove the CustomLog directive from apaceh2.conf, or create a VirtualHost. Both of which I'd really like to avoid.

Any tips for working around this, or is this something we can change in the image? Currently I'm aiming to replace the apache2.conf with a modified copy but that means having to try and keep it updated from upstream.

Install re2c and file ?

It seems that if I run docker-php-ext-install anything, re2c and file commands are always warned for their noneixstence. Perhaps it's better to install re2c and file in the Dockerfiles?

php.ini

Why is there any php.ini file?
Shouldn't we add one?

Add support for Composer

Composer is the de facto package manager for PHP. Nearly all (modern) libraries and frameworks rely on it. The current PHP images do not support it, because the openssl exension is missing. While Composer falls back to the git transport method (see second example below), this may not be available for all packages.

One-liner installation

The "recommended" install method, using a one-liner fails:

Dockerfile:

FROM php:5.5
RUN php -r "readfile('https://getcomposer.org/installer');" | php

Result:

Step 1 : RUN php -r "readfile('https://getcomposer.org/installer');" | php
 ---> Running in 21722cb03536

Warning: readfile(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in Command line code on line 1

Warning: readfile(https://getcomposer.org/installer): failed to open stream: No such file or directory in Command line code on line 1

Manual Installation

Adding it manually (download from https://getcomposer.org/composer.phar) works, but results in warnings. In this case installation proceeds, because git can be used to fetch the source, this may not work for all packages.

Dockerfile:

FROM php:5.5

# Create working dir
RUN mkdir /composer-test

# Manually add composer
ADD composer.phar /composer-test/composer.phar

# Try to install a package
WORKDIR /composer-test
RUN php composer.phar require monolog/monolog

Result:

Step 4 : RUN php composer.phar require monolog/monolog
 ---> Running in 58633ee9c005
Using version ~1.11 for monolog/monolog
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Installing psr/log (1.0.0)
Failed to download psr/log from dist: You must enable the openssl extension to download files via https
Now trying to download from source
  - Installing psr/log (1.0.0)
    Cloning fe0936ee26643249e916849d48e3a51d5f5e278b

  - Installing monolog/monolog (1.11.0)
Failed to download monolog/monolog from dist: You must enable the openssl extension to download files via https
Now trying to download from source
  - Installing monolog/monolog (1.11.0)
    Cloning ec3961874c43840e96da3a8a1ed20d8c73d7e5aa

Adding Apache modules?

The container has a lot of modules that are not enabled by default (I'm working with 5.4-apache so not sure about the others)

I think that because the main Dockerfile is calling CMD ["apache2", "-DFOREGROUND"] that I am unable to run any other CMDs later on (Still new to Docker).

I have the following in my Dockerfile trying to enable mod_rewrite for Apache but it appears that command is never firing as doing an ls on that directory does not show any changes.

FROM php:5.4-apache
ADD src/html /var/www/html
CMD ["cp", "/etc/apache2/mods-available/rewrite.load", "/etc/apache2/mods-enabled/"]

Is this just user error or does command order in the Dockerfile matter?

Apache2 log files are empty

I am running docker "php:5.6-apache" and I am looking for the Apache2 log files.

According to "/etc/apache2/sites-enabled/000-default.conf" the log files are defined:

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

I enabled the log levels "LogLevel info ssl:warn" and did "service apache2 reload".

Still the files are empty, despite loading html and php files via web browser.

/var/log/apache2/access.log
/var/log/apache2/error.log

Any ideas how to enable the logs?

Apache does not include conf-enabled, sites-enabled

apache2.conf misses include statements for conf-enabled and sites-enabled.

This is an issue if you install additional packages, that add files to those folders. Manually appending include statements to those solves the issue for the derived image.

Directly including them leads to errors because of unconfigured paths.

Either the image should not contain those folders at all or actually include them (and possibly strip everything enabled by default). The current state is really annoying and cost me quite some time debugging why the application is not loaded. Loading the conf files would definitely be preferred, as this would meet the expectations from an image derived from Debian.

Having a problem with 5.4 GPG key

During a standard build, using the Dockerfile in 5.4/apache I am getting the following error:
Step 12 : RUN gpg --keyserver pool.sks-keyservers.net --recv-keys F38252826ACD957EF380D39F2F7956BC5DA04B5D
---> Running in 2104b57cbaf4
gpg: directory /root/.gnupg' created gpg: new configuration file/root/.gnupg/gpg.conf' created
gpg: WARNING: options in /root/.gnupg/gpg.conf' are not yet active during this run gpg: keyring/root/.gnupg/secring.gpg' created
gpg: keyring `/root/.gnupg/pubring.gpg' created
gpg: requesting key 5DA04B5D from hkp server pool.sks-keyservers.net
?: pool.sks-keyservers.net: Host not found
gpgkeys: HTTP fetch error 7: couldn't connect: Success
gpg: no valid OpenPGP data found.
gpg: Total number processed: 0

I am spinning up the docker container on OSX using Vagrant 1.6.3 (ubuntu trusty64 image), if I use the image php:5.4-apache, i have no problems, but I want to modify the initial Dockerfile and build my own image.

I may be totally mis-remembering but I believe this worked a few days ago. If I run the gpg line on another VM (ubuntu 14.04) I get the following:
tom@tom-VB14dev:~$ gpg --keyserver pool.sks-keyservers.net --recv-keys F38252826ACD957EF380D39F2F7956BC5DA04B5D
gpg: directory /home/tom/.gnupg' created gpg: new configuration file/home/tom/.gnupg/gpg.conf' created
gpg: WARNING: options in /home/tom/.gnupg/gpg.conf' are not yet active during this run gpg: keyring/home/tom/.gnupg/secring.gpg' created
gpg: keyring `/home/tom/.gnupg/pubring.gpg' created
gpg: requesting key 5DA04B5D from hkp server pool.sks-keyservers.net
gpg: /home/tom/.gnupg/trustdb.gpg: trustdb created
gpg: key 5DA04B5D: public key "Stanislav Malyshev (PHP key) [email protected]" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg: imported: 1

PHP-FPM + nginx version

Since there's an Apache flavour available of the PHP Docker image, what's about a similar solution for PHP -FPM + nginx?

PS: I found no instructions for fpm at all - I can start the image, but I didn't manage it to get anything out of port 9000, not even an error.

Creating dummy-packages for PHP-extensions

Often PHP applications are also published as Debian packages or repositories, eg. Zabbix. When I put together a Dockerfile for the Zabbix PHP frontend (Dockerfile not published yet), I had the problem that this has dependenices registered for PHP and various PHP extensions.

This conflicts with PHP installed from source.

Any easy workaround was to generate dummy packages using the equivs package. I would propose to generally install a PHP dummy package, and maybe integrate automatic generation of equivs-packages in docker-php-ext-install.

I used these lines for generating the equiv-dummy:

# Create dummy package for php5 and libraries
COPY equivs-dummy /tmp/
RUN apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends equivs && \
    cd /tmp && \
    equivs-build equivs-dummy && \
    dpkg -i equivs-dummy*.deb && \
    apt-get purge -y --auto-remove equivs && \
    apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* 

With equivs-dummy containing:

Section: misc
Priority: optional
Standards-Version: 3.9.2
Provides: php5, php5-gd, php5-pgsql

Keeping equivs (for docker-php-ext-install) wouldn't hurt too much, it doesn't have too many dependencies not installed anyway. One could even consider pregenerating dummies for all extensions, then the script would just have to install them and equiv could be removed like I did.

I there is consent that this is a good idea, I would put together a patch for this.

PDO MySQL driver not found

I've been using the php:apache image before and had no problems with PDO and MySQL, but suddenly it fails with an exception "driver not found". This happened after the boot2docker vm had been removed and recreated, so a new image must have been downloaded.

I've seen docker-php-ext-install mentioned in other issues, and have tried to use that:

docker exec -it <container ID> docker-php-ext-install pdo pdo_mysql

That doesn't help.

docker-php-ext-install zip fails

It requires the zlib system package, a workaround is to add this to your Dockerfile

RUN apt-get update && \
    apt-get install -y \
        zlib1g-dev

Expose a different port in Apache image?

It isn't really necessary to use 80 as we can publish the port to any host port. Using port 80 however makes apache start as root, which is a security downgrade. How about changing it to 8080?

Installing APC fails

I've tried to install apc in a php:5.6-apache container through pecl install apc, but it failed with the following error:

creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
running: make
/bin/bash /tmp/pear/temp/pear-build-defaultuser4iYX0V/APC-3.1.13/libtool --mode=compile cc -D_GNU_SOURCE -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defau
ltuser4iYX0V/APC-3.1.13/include -I/tmp/pear/temp/pear-build-defaultuser4iYX0V/APC-3.1.13/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/l
ocal/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/APC/apc.c -o a
pc.lo
mkdir .libs
 cc -D_GNU_SOURCE -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuser4iYX0V/APC-3.1.13/include -I/tmp/pear/temp/pear-build-defaultuser4iYX0V/APC-3.1.1
3/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr
/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/APC/apc.c  -fPIC -DPIC -o .libs/apc.o
/tmp/pear/temp/APC/apc.c: In function 'apc_search_paths':
/tmp/pear/temp/APC/apc.c:352:55: warning: passing argument 2 of 'php_stream_locate_url_wrapper' from incompatible pointer type
     wrapper = php_stream_locate_url_wrapper(filename, &path_for_open, 0 TSRMLS_CC);
                                                       ^
In file included from /usr/local/include/php/main/php.h:398:0,
                 from /tmp/pear/temp/APC/apc.h:61,
                 from /tmp/pear/temp/APC/apc.c:34:
/usr/local/include/php/main/php_streams.h:549:28: note: expected 'const char **' but argument is of type 'char **'
 PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, const char **path_for_open, int options TSRMLS_DC);
                            ^
/tmp/pear/temp/APC/apc.c:416:20: warning: assignment discards 'const' qualifier from pointer target type
         exec_fname = zend_get_executed_filename(TSRMLS_C);
                    ^
/bin/bash /tmp/pear/temp/pear-build-defaultuser4iYX0V/APC-3.1.13/libtool --mode=compile cc -D_GNU_SOURCE -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defau
ltuser4iYX0V/APC-3.1.13/include -I/tmp/pear/temp/pear-build-defaultuser4iYX0V/APC-3.1.13/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/l
ocal/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/APC/php_apc.c 
-o php_apc.lo
 cc -D_GNU_SOURCE -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuser4iYX0V/APC-3.1.13/include -I/tmp/pear/temp/pear-build-defaultuser4iYX0V/APC-3.1.1
3/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr
/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/APC/php_apc.c  -fPIC -DPIC -o .libs/php_apc.o
/bin/bash /tmp/pear/temp/pear-build-defaultuser4iYX0V/APC-3.1.13/libtool --mode=compile cc -D_GNU_SOURCE -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defau
ltuser4iYX0V/APC-3.1.13/include -I/tmp/pear/temp/pear-build-defaultuser4iYX0V/APC-3.1.13/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/l
ocal/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/APC/apc_cache.
c -o apc_cache.lo
 cc -D_GNU_SOURCE -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuser4iYX0V/APC-3.1.13/include -I/tmp/pear/temp/pear-build-defaultuser4iYX0V/APC-3.1.1
3/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr
/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/APC/apc_cache.c  -fPIC -DPIC -o .libs/apc_cache.o
/tmp/pear/temp/APC/apc_cache.c: In function '_apc_cache_user_update':
/tmp/pear/temp/APC/apc_cache.c:818:63: error: 'IS_CONSTANT_INDEX' undeclared (first use in this function)
             switch(Z_TYPE_P((*slot)->value->data.user.val) & ~IS_CONSTANT_INDEX) {
                                                               ^
/tmp/pear/temp/APC/apc_cache.c:818:63: note: each undeclared identifier is reported only once for each function it appears in
/tmp/pear/temp/APC/apc_cache.c:820:22: error: 'IS_CONSTANT_ARRAY' undeclared (first use in this function)
                 case IS_CONSTANT_ARRAY:
                      ^
Makefile:186: recipe for target 'apc_cache.lo' failed
make: *** [apc_cache.lo] Error 1
ERROR: `make' failed

So what is the correct way to get APC in your PHP container?

fpm image: possible to run as non-root user?

The fpm image still invoke the master fpm process as root, which I don't see much necessity. Is it possible to run the master process as nonroot?

docker top shows there is a root process:

root                1764                679                 0                   May04               ?                   00:00:02            php-fpm: master process (/usr/local/etc/php-fpm.con

Environment variables ignored by php-fpm

If you use the php-fpm variant, environment variables (e.g. for linked docker hosts) are not available in your $_ENV var in your PHP scripts. This is a problem as usually docker containers are configured via environment variables (following the 12 factor principles). While this is rather a PHP problem, I still think that the official php-fpm image should provide a workaround for this, as otherwhise it's pretty much useless.

For php-fpm all environment variables have to be listed in the php-fpm.conf like:

[www]
env[MY_ENV_VAR_1] = 'value1'
env[MY_ENV_VAR_2] = 'value2'

So I suggest to create a wrapper script to first add all variables from env to the configuration, before actually starting php.

No preferable way to install custom extension that is not mentioned in default list.

1st problem: docker-php-ext-* does not provide a way to install extension package from pecl (for example i need to install ext-mongo which cause me to make some tricks with Dockerfile to succeed)
2nd problem: custom source extensions (e.g. phalcon) that has to be compiled from scratch and exposed to runnin php daemon (fpm, apache).

Is there any instructions to make it right and simple? For any of cases.

Thanks.

Images are kinda huge, aren't they?

Maybe it's not a big deal, but still. ~800Mb for apache-php? Well, that's a lot in comparison with other images that weights ~250 Mb in average. I guess it's because of build tools that are used to compile php from source. Anyway, I wonder if anything can be done with it?

Re-enable mysql in php5.4

Hi guys, I love docker and I'm transitioning our company to using docker for everyone's dev environment.

A year ago, all I had to do was pull the mysql:latest and php5.4-apache images, and DONE. our site was up and running on a local developer's machine.

As of Nov 10, it's broken. I understand that all extensions were removed, but please consider that the standard php5.4 lamp stack has always included mysql. We need it for a legacy app we maintain.

Now it seems we can't just pull an off the shelf image, like we used to pull an off the shelf LAMP stack, to run. IMHO mysql mysqli and mysql pdo should be included always, especially in php5.4 where that was THE standard at the time, so anyone still using 5.4 is probably doing it because of mysql.

Anyways, I don't think individuals should have to maintain and build dockerfiles just to add extensions that everybody always had in php5.4. In 5.6+ I fully support it because nowadays it's not a given that you're using a mysql database.

So I just wanted to let you know that update broke our company's nice docker off-the-shelf solution. But if you all still agree that even in php5.4 mysql should not be included, please provide us the new way, as I was not able to find any documentation of specifically enabling mysql, mysqli, and pdo with the new ext-install script.

So before it broke, this is what our company did to go from a folder with the website in it to a full running website:

sudo docker run --name kcity-mysql -e MYSQL_ROOT_PASSWORD=password123 -e MYSQL_USER=knowledgecity -e MYSQL_PASSWORD=password123 -e MYSQL_DATABASE=test -d mysql

sudo docker run -it --link kcity-mysql:mysql -v "$(pwd)":/tmp/import --rm mysql sh -c 'exec mysql -h$MYSQL_PORT_3306_TCP_ADDR -P$MYSQL_PORT_3306_TCP_PORT -uroot -p < /tmp/import/sample_data.sql'

sudo docker run -d -p 80:80 --name kcity-web -v "$(pwd)":/var/www/html --link kcity-mysql:mysql  php:5.4-apache

We just hired some new developers and they're like "why make things complicated by using docker?" since we weren't able to get their dev environment set up with 3 commands like we did before the November change.

Thanks for your help

Install extra php extension

Hi!

I see that php is built with specific extensions enabled. What would be correct way of installing extra extension?

In this case I'm interested in intl extension.

Do I need to clone github project with my custom php options or there is a better way?

More modules

As #6 and #7 help highlight, we really don't have a good solution to accessing the wide array of modules and extensions included with PHP.

My own personal best idea so far is to just compile everything we can as part of the base image, which does feel properly in the "spirit of PHP", but also seems like a pretty hacky solution. If we can't come up with anything better (or if we get someone from upstream PHP validating that as a properly "OK" solution), then we should run with that, but I'd like to at least leave it open for discussion first for a little while in case someone's got a better idea. ๐Ÿ˜„

Run php:fpm as non-root

Unlike the php:apache image where Apache drops root privileges to www-data before running any PHP code, the php:fpm image is still running as root.

Since it doesn't actually need root privileges, it would probably be best if php:fpm ran PHP code as a non-root user. In the case of php:fpm, it seems like it should work fine to use a USER fpm without pulling in gosu or anything like that.

Can't copy HTML to the document root

I'm new to docker. Running images from the registry works just fine. I'm trying to copy a simple html file into the webroot. My Dockerfilelooks like this:

FROM php:5.6-apache

COPY index.html /var/www/html/
COPY config/php.ini /usr/local/etc/php/

Unfortunately this does not work. The php.ini gets copied in, but the var/www/html dir remains empty.
Am I missing something?

missing ZIP extension causes double download in composer

I'm wary of php enought not to know wheter this is #8 but the ZIP extension seems missing.

I'm using composer and it fetches stuff like

  • Installing phpunit/phpunit (3.7.31)
    Downloading: 100%
    Failed to download phpunit/phpunit from dist: Could not decompress the archive, enable the PHP zip extension.
    A php.ini file does not exist. You will have to create one.
    Now trying to download from source
    • Installing phpunit/phpunit (3.7.31)
      Cloning d24e9877331039582497052cc3c4d9f465b88210

Guessing from execution times it does download twice.

How to change the UID of the Apache process?

On php:apache, we are trying to change the UID of the Apache process, so that it can access files owned by another uid than 33/www-data (because we're sharing some files with another container).

I tried:

  • setting ENV APACHE_RUN_USER 1000
  • editing /etc/apache2/envvars
  • running Apache with -D APACHE_RUN_USER=1000

Noworkie :(

@tianon told me:

15:57 <tianon> you want -u SOME-UID and probably have to sed the conf file
15:57 <tianon> can you file an issue?
15:57 <tianon> and say I sent you?

Old PID not allow container to restart

I am using docker image php:5.3.29-apache on Ubuntu 14.04.1 ( docker 1.3.2)

The Docker Container created from this image is not able to start when it is not exited cleanly.

So, I have to remove the below file manually.

sudo rm /var/lib/docker/aufs/diff/"CONTAINER ID"/run/apache2/apache2.pid

Similar problem was observed when created my own image for Nagios Monitor. I tried to clean up using command
"/usr/sbin/apache2 -D FOREGROUND -k restart"
in supervised

SIGWINCH issue

When making a derived image from php:5.6-apache, when the server starts, at the slightest movement it stops, and gives me this message:

[Wed Jan 21 20:24:05.736731 2015] [mpm_prefork:notice] [pid 1] AH00170: caught SIGWINCH, shutting down gracefully

It happens when I resize the window, or on docker attach, rendering it inaccessible.

Send logs to stderr and stdout

Hi I am using the below to redirect logs to stderr and stdout but with no success.

RUN ln -sf /dev/stdout /var/log/fpm-access.log &&
ln -sf /dev/stdout /var/log/php5-fpm.log

Are you aware of the change that needs to be done in order to do this and benefit from docker logs command?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.