thecodingmachine / docker-images-php Goto Github PK
View Code? Open in Web Editor NEWA set of PHP Docker images
License: MIT License
A set of PHP Docker images
License: MIT License
On Windows, the remote_host detection does not seem to work.
Some tools are preventing the "entrypoint" from being executed.
For instance:
It could be great if we could avoid depending on the entrypoint. For instance by hooking on the "php" cli, the FPM program or the Apache program...
Thanks for sharing this. I wanted to try this out for a project but I am having problems getting cron jobs working.
When I set CRON_COMMAND
and CRON_SCHEDULE
I expect the command to be executed as define by the schedule.
When these commands are set the /etc/cron.d/generated_crontab
file seems to be generated as expected but as far as I can tell the command is not executed.
I cannot tell why. Some form of logging might be helpful if possible.
docker-compose.yml
file:version: '3'
services:
my_app:
image: thecodingmachine/php:7.2-v1-apache
environment:
CRON_SCHEDULE: '* * * * *'
CRON_COMMAND: 'php -r "echo time();"'
docker-compose up
22:42 $ docker-compose up
Creating network "tmp_default" with the default driver
Creating tmp_my_app_1 ... done
Attaching to tmp_my_app_1
my_app_1 | [Fri Apr 27 20:42:16.690672 2018] [mpm_prefork:notice] [pid 8] AH00163: Apache/2.4.25 (Debian) PHP/7.2.4 configured -- resuming normal operations
my_app_1 | [Fri Apr 27 20:42:16.690749 2018] [core:notice] [pid 8] AH00094: Command line: 'apache2 -D FOREGROUND'
docker-compose exec my_app cat /etc/cron.d/generated_crontab
. Output seems sensible enough* * * * * root (php -r "echo time();") | sed -e 's/^/[Cron] /' > /proc/7/fd/1 2>/proc/7/fd/2
php:7.2-v1-apache
and php:7.2-v1-cli
I was expecting to see mysql-client on the fat image since mysql is the default database extension.
Unable to make cli mysql database connections.
apt-get install mysql-client
You probably have a reason for not including mysql-client. But I wanted to ask anyway. I have no problem adding this to my own sub-image. But maybe you are open to installing it on the fat base images.
In the documentation in almost all examples of building slim images the extension "pdo" is used - an example:
ARG PHP_EXTENSIONS="apcu mysqli opcache pdo pdo_mysql redis zip soap"
directly under "Compiling extensions in the slim image".
But "pdo" is not a valid extension when trying to build the container - this is my output (for php 7.2 slim cli, the same with slim fpm):
Building container
Step 1/16 : ARG PHP_EXTENSIONS="opcache pdo pdo_mysql zip"
Step 2/16 : FROM thecodingmachine/php:7.2-v2-slim-cli
# Executing 7 build triggers
---> Using cache
---> Running in 548c6d0e99cd
Removing intermediate container 548c6d0e99cd
---> Running in ca7979a4a321
*** Installing extensions ***
The following extension(s) is not supported: pdo
Supported extensions: amqp, apcu, ast, bcmath, blackfire, bz2, calendar, dba, ds, enchant, ev, event, exif, gd, gettext, gmp, gnupg, igbinary, imagick, imap, intl, ldap, mailparse, mcrypt, memcached, mongodb, mysqli, opcache, pcntl, pcov, pdo_dblib, pdo_mysql, pdo_pgsql, pgsql, pspell, redis, shmop, snmp, soap, sockets, swoole, sysvmsg, sysvsem, sysvshm, tidy, wddx, weakref, xdebug, xmlrpc, xsl, yaml, zip
I suspect this is just a documentation error, but it is in all the examples and in the list of valid extensions, so it is likely people will stumble over it, as I did.
Hi
I am using
version: '3'
services:
my_app:
image: thecodingmachine/php:7.3-v2-apache-node10
environment:
# Enable the PostgreSQL extension
PHP_EXTENSION_PGSQL: 1
# Disable the Mysqli extension (otherwise it is enabled by default)
PHP_EXTENSION_MYSQLI: 0
#APACHE_DOCUMENT_ROOT: /var/www/html
ports:
- "2080:80"
volumes:
- /media/var/www/html:/var/www/html
However I cant seem to be able to acces any of the webapps under /media/var/www/html
I am not sure what I am missing here.
"GET /webapp/ HTTP/1.1" 404 506 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0
I am using Docker on Debian Buster x64
thanks
Your issue may already be reported!
Please search on the issue tracker before creating one.
Redis module should be loading by default
Redis module does not load
php -m
This code should work
$this->gpg = new \gnupg();
It produces this error Class 'gnupg' not found
working on it, see https://github.com/kermorgant/docker-images-php/blob/7.2-v1/Dockerfile.cli
When using the CLI images, it is implied that you should set a CMD (and this is shown in the one CLI example via command line), but it would help if at least one docker compose example and/or Dockerfile example showed this explicitely - it could be a CLI example running phpunit, which would be a common use case.
I tried setting up an ENTRYPOINT instead of a CMD, which overwrote the ENTRYPOINT of the image and lead to unexpected results (like php.ini settings not being set up), so a warning not to use ENTRYPOINT in a Dockerfile might also help, as most docker tutorials advise on using ENTRYPOINT instead of CMD, or using both together for executable containers.
I use the image thecodingmachine/php:7.2-v2-apache (the 7.3 is not on docker hub), and I want to add a custom extension in php. I have a .so, but how can I add automatically in the extension directory and enable it ?
I found the extension directory but the name is /usr/local/lib/php/extensions/no-debug-non-zts-20170718/ and I don't know how can I automatically get it.
Is it possible to add easily a custom .so extension ?
There is no default command for PHP CLI. This leads to weird error message when called with no commands.
$ docker run thecodingmachine/php:7.2-v1-cli
usage: sudo -h | -K | -k | -V
usage: sudo -v [-AknS] [-g group] [-h host] [-p prompt] [-u user]
usage: sudo -l [-AknS] [-g group] [-h host] [-p prompt] [-U user] [-u user]
[command]
usage: sudo [-AbEHknPS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p
prompt] [-u user] [VAR=value] [-i|-s] [<command>]
usage: sudo -e [-AknS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p
prompt] [-u user] file ...
TODO: add a default command (maybe "php -a" ?)
Using this Dockerfile
:
FROM thecodingmachine/php:7.2-v2-apache-node10 AS builder
COPY --chown=docker:docker sources/web .
ENV APP_ENV=prod \
APACHE_DOCUMENT_ROOT=/public
RUN composer install &&\
yarn install &&\
yarn build
ARG PHP_EXTENSIONS="apcu mysqli opcache pdo pdo_mysql zip soap"
FROM thecodingmachine/php:7.2-v2-slim-apache
ENV APP_ENV=prod \
APACHE_DOCUMENT_ROOT=/public
COPY --from=builder /var/www/html .
No errors, but the process says:
*** Installing extensions ***
array(0) {
}
No extensions installed in ONBUILD hook.
`
``
It is a quite common need to add a Github access token to Composer.
It could be interesting to have an environment variable that does this automatically.
GITHUB_ACCESS_TOKEN: foobar
This might be automatically registered on startup. See: https://github.com/composer/composer/blob/master/doc/articles/troubleshooting.md#api-rate-limit-and-oauth-tokens
STDOUT not working for the cron. > /proc/1/fd/1 2>/proc/1/fd/2
in file generate_cron.php
Hi there!
When I use the fpm version, the php-fpm process does not start and the container shutdown without any errors but with the output of sudo usages. In scripts that run automatically when the container starts, there are no commands to run the php-fpm process. Also, there is no launch of the php-fpm process in the Dockerfile.fpm file. I fixed it but your Dockerfile.fpm is not correct.
user@host:~ $ docker run -p 9000:9000 -v /home/user/code:/var/www/html thecodingmachine/php:7.2-v1-fpm
usage: sudo -h | -K | -k | -V
usage: sudo -v [-AknS] [-g group] [-h host] [-p prompt] [-u user]
usage: sudo -l [-AknS] [-g group] [-h host] [-p prompt] [-U user] [-u user]
[command]
usage: sudo [-AbEHknPS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p
prompt] [-u user] [VAR=value] [-i|-s] [<command>]
usage: sudo -e [-AknS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p
prompt] [-u user] file ...
user@host:~ $
That would be awesome if Blackfire was preinstalled in the Docker images. That would allow to profile PHP scripts very easily.
To make that happen the following needs to be done in the Docker images:
Users not using Blackfire should not be impacted because the extension will not do anything. (it could also be possible to make the extension opt-in through an environment variable, that would be even cleaner)
Users using Blackfire will need to:
PHP Curl requests to HTTPS URLs should succeed
Requests are failing
Looks like it's something to do with cacert.pem not being found
https://docs.bolt.cm/3.6/howto/curl-ca-certificates
thecodingmachine/php:7.2-v2-fpm
SSL certificate problem: unable to get local issuer certificate
when the curl request fails.Docker 18.09.5 is on Linux Mint 19
If I copy a custom php.ini files in my container, its seems that it is not taken into consideration.
COPY php.ini /usr/local/etc/php/php.ini
XDebug extension is enabled
XDebug extension is not enabled
Use this docker-compose.yml:
version: '3.3'
services:
php:
image: thecodingmachine/php:7.2-v2-apache
ports:
- "8080:80"
volumes:
- ./:/var/www/html
environment:
PHP_EXTENSION_XDEBUG: 1
PHP_INI_XDEBUG__REMOTE_ENABLE: 1
PHP_INI_XDEBUG__REMOTE_AUTOSTART: 1
When using image for Drupal I expect to see the PECL uploadprogress library on the image.
Not present. Drupal status report page mentions it not being enabled.
RUN git clone https://github.com/php/pecl-php-uploadprogress/ /usr/src/php/ext/uploadprogress/ \
&& docker-php-ext-configure uploadprogress \
&& docker-php-ext-install uploadprogress \
&& rm -rf /usr/src/php/ext/uploadprogress
This is really dependent on whether your project requires the uploadprogress library. Just thought I'd share with you my work.
How can I install image magick into this for use with PHP?
Maybe something like this?
RUN apt-get update && apt-get install -y \
libmagickwand-dev --no-install-recommends \
&& pecl install imagick-beta \
&& docker-php-ext-enable imagick \
# Clean Up \
&& rm -rf /var/lib/apt/lists/*
Version: thecodingmachine/php:7.2-v1-apache-node10
Or should I do it as a start-up command or make my own dockerfile that inherits from yours?
To test if loaded a php file like this should output available formats.
<?php
if(extension_loaded('imagick')) {
$imagick = new Imagick();
print_r($imagick->queryFormats());
}
else {
echo 'ImageMagick is not available.';
}
The environment variable way
STARTUP_COMMAND_1: "sudo apt-get update && sudo apt-get install -y php-imagick"
Gives me this error.
E: Package 'php-imagick' has no installation candidate
I've enabled the exif extension using PHP_EXTENTION_EXIF: 1
and phpinfo() confirms that it is enabled. However, when I call exif_read_data()
I get the following error: Call to undefined function exif_read_data()
.
I've recreated the error on two separate machines. I've even gone as far as to run the code on a XAMPP stack to ensure my code works. I've been able to turn on other extensions--this one is the first time I've had trouble with this.
Running docker on Windows 10. Using the php:7.2-v2-apache-node10 image.
In a CI environment, if a project runs:
sudo composer install
all custom PHP settings are lost (!)
This is because "sudo" loses all environment variables and because "composer" actually points to a script that will first regenerate php.ini conf (because we need to generate conf for "composer install" if run inside a Docker build where conf has not been generated yet)
We need to find a way to make sure the conf is regenerated when composer is called ONLY if we are in a Dockerfile and not when we are in a container running.
CRON_COMMAND_1: id; id
CRON_USER_1: docker
There are 2 "id" commands run. They should both execute as the "docker" user.
First id is executed by "docker", second by "root".
This is because the command executed is:
/bin/sh -c sudo -E -u docker id; id
I noticed that Imagick extension cannot be enabled (it is not on the list of available extensions) when slim container is used. Can that be fixed somehow?
Fat image works fine with this extension
First off, I want to say this is by far the best docker environment I've ever seen around. Super dynamic, easy to use and very extensive. I was just wondering if you would consider adding a dev image that includes the Cloud9 IDE. If this was a possibility then I could trow out my PC forever:
I can understand you might not want to add C9 to your dev images. But if anyone of the team is interested in it, I'd love to work together to create a sub-image with them.
Let me know if there's any team members that are into exploring the idea. If there's absolutely no interest you can close this issue and I'll explore it myself.
Here's an installation example of C9 (it does add +/- 400 MB to the image):
FROM thecodingmachine/php:7.2-v2-cli-node10
USER root
RUN buildDeps='make build-essential g++ gcc python2.7' && softDeps="tmux locales" \
&& apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y $buildDeps $softDeps --no-install-recommends \
&& locale-gen en_US.UTF-8 \
&& localedef -f UTF-8 -i en_US en_US.UTF-8
user docker
RUN git clone --depth 1 https://github.com/c9/core.git /home/docker/cloud9
WORKDIR /home/docker/cloud9
RUN git pull origin master\
&& NO_PULL=1 scripts/install-sdk.sh \
&& git reset --hard
USER root
RUN apt-get purge -y --auto-remove $buildDeps \
&& apt-get autoremove -y \
&& apt-get autoclean -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
USER root
RUN npm cache clean --force
USER docker
EXPOSE 8080
WORKDIR /var/www/html
CMD /usr/bin/node /home/docker/cloud9/server.js -l 0.0.0.0 -p 8080 -w /var/www/html -a :
Best regards,
Alex
There are issues using STARTUP_COMMAND in docker-compose.yml file (tested on Ubuntu 17.10).
With STARTUP_COMMAND_1: composer install
:
sudo: no tty present and no askpass program specified
php_apache_node exited with code 1
With STARTUP_COMMAND_1: npm install
:
Error: EACCES: permission denied, mkdir '/home/docker/.npm'
Solution : my directory containing the docker-compose.yml file was owned by www-data:www-data.
Changing owning of the directory to ${USER} solved the issues.
Hello,
When enabling the memcached PHP extension, I get the following error:
PHP Warning: PHP Startup: Unable to load dynamic library 'memcached.so' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20170718/memcached.so (libmemcached.so.11: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20170718/memcached.so.so (/usr/local/lib/php/extensions/no-debug-non-zts-20170718/memcached.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
My service:
front:
image: thecodingmachine/php:7.2-v1-apache-node8
working_dir: /var/www/html/front
labels:
- traefik.enable=true
- traefik.backend=front
- traefik.frontend.rule=Host:foo.localhost
environment:
APACHE_DOCUMENT_ROOT: front/
PHP_INI_MEMORY_LIMIT: 1g
PHP_EXTENSION_XDEBUG: 1
PHP_EXTENSION_BCMATH: 1
PHP_EXTENSION_INTL: 1
PHP_EXTENSION_GD: 1
PHP_EXTENSION_MEMCACHED: 1
STARTUP_COMMAND_1: composer install
STARTUP_COMMAND_2: yarn install
STARTUP_COMMAND_3: gulp js less css
env_file:
- .env
volumes:
- .:/var/www/html:rw
When I add PHP_EXTENSION_INTL=1
to my bitbucket pipelines env variables, I expect the intl
extension to be loaded.
Currently, it is not loaded. When I run echo $PHP_EXTENSION_INTL
, it outputs 1
.
I think bitbucket only injects the user configured env variables after it has booted the container.
When an error occurs in STARTUP_COMMAND_XXX, the container does still start.
It would be a better practice to halt the container if any startup command returns an error. Otherwise, the error might go unnoticed.
See readme.md
See title ๐
Dockerhub tags: https://hub.docker.com/r/thecodingmachine/php/tags/
I'd like to use the php:7.2-v1-cli using php's internal web-server
Session files (like /usr/src/app/var/sessions/dev/sess_b769a9b5b9f1f3e2b57b739f5788aca9
) are owned by root, triggering errors
services:
php:
command: php bin/console server:run 0.0.0.0:8000
ports:
- "8000:8000"
image: thecodingmachine/php:7.2-v1-cli
volumes:
- .:/usr/src/app
environment:
PHP_INI_MEMORY_LIMIT: -1
PHP_EXTENSION_GNUPG: 1
docker-compose up php
http://127.0.0.1:8000
The error should happen immediatly
Warning: SessionHandler::read(): open(/usr/src/app/var/sessions/dev/sess_b769a9b5b9f1f3e2b57b739f5788aca9, O_RDWR) failed: Permission denied (13)
I've been using php-cli with php's internal web server like this until now and thought I'd give your image a try using the same approach. Ironically, it was the permission "black magic" that motivated my switch :-)
OS : archlinux
docker 18.06.1-ce
Hi, I created the following startup.sh
file, but I get an error when running the container: sudo: source: command not found
I am using php 7.1, fat, apache. I'm trying to start the sshd service. Could you help me out?
#!/bin/bash
# start ssh server
service ssh start
https://unix.stackexchange.com/questions/202332/sudo-source-command-not-found/202334
I expect that my configuration of a container:
php-cli:
image: 'thecodingmachine/php:7.2-v1-cli'
volumes:
- './:/usr/src/app:delegated'
environment:
PHP_EXTENSION_AMQP: 1
is correct and creates a container with amqp extension enabled.
I'm running docker-compose up
with the config above.
and see
php-cli_1 | PHP Warning: PHP Startup: Unable to load dynamic library 'amqp.so' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20170718/amqp.so (librabbitmq.so.4: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20170718/amqp.so.so (/usr/local/lib/php/extensions/no-debug-non-zts-20170718/amqp.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
php-cli_1 | time="2018-10-20T21:19:29Z" level=info msg="read crontab: /tmp/generated_crontab"
php-cli_1 | time="2018-10-20T21:19:29Z" level=fatal msg="bad crontab line: Warning: PHP Startup: Unable to load dynamic library 'amqp.so' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20170718/amqp.so (librabbitmq.so.4: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20170718/amqp.so.so (/usr/local/lib/php/extensions/no-debug-non-zts-20170718/amqp.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0"
php-cli_1 | PHP Warning: PHP Startup: Unable to load dynamic library 'amqp.so' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20170718/amqp.so (librabbitmq.so.4: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20170718/amqp.so.so (/usr/local/lib/php/extensions/no-debug-non-zts-20170718/amqp.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
php-cli_1 | bash: line 2: syntax error near unexpected token `('
php-cli_1 | bash: line 2: `Warning: PHP Startup: Unable to load dynamic library 'amqp.so' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20170718/amqp.so (librabbitmq.so.4: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20170718/amqp.so.so (/usr/local/lib/php/extensions/no-debug-non-zts-20170718/amqp.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0'
and non-working container.
Hi, great job ๐
I want to set PHP_EXTENSIONS
variable dynamically in my Dockerfile.
ONBUILD ENV PHP_EXTENSIONS=$(cat /var/www/html/exts.txt)
But Docker doesn't allow it. Can you please help me to do it?
My php container that connects to redis (with password)
api:
image: thecodingmachine/php:7.1-v1-apache
...
environment:
...
PHP_INI_SESSION__SAVE_HANDLER: redis
PHP_INI_SESSION__SAVE_PATH: "tcp://redis:6379?auth=123"
When I try to access redis session store, I get the following error :
session_start(): open(tcp://redis:6379?auth/sess_p6rqfk7phj43d477k37d3iecb4, O_RDWR) failed: No such file or directory
It seems that the the variable has been stripped after the equal sign.
FROM thecodingmachine/php:7.1-v1-cli
ENV PHP_EXTENSION_GD=1
RUN composer install
If the composer.lock contains a package that requires "gd" to be enabled, "gd" will not be yet available (because it is enabled at container startup time only).
We should overwrite "composer" executable to make sure we enable the extensions before composer startup.
Hi there !
It seems that the "black magic" used for permissions has some "dark effects" ๐.
When I execute a command whithin the container, the files generated from it belong to root and not to the docker user.
For instance, I have an Angular application in an app folder mapped into /var/www/html. If i run npm install
from the host, the owner will be the docker user as expected. But, if I run the command from the container (with the docker user), it will generate a node_modules folder that belongs to root !
Otherwise, it's a hell of a docker image ๐
When I get inside the php-fpm container, my volume mounted in /var/www/html should be owned by "docker" user.
It's owned by "root" user instead.
Executing a chown docker:docker /var/www/html
doesn't work, neither from the Dockerfile, nor from inside the container itself.
Here is my Dockerfile :
FROM thecodingmachine/php:7.2-v2-fpm
COPY ["./conf/log.conf", "/usr/local/etc/php-fpm.d/zz-log.conf"]
USER root
# pre-req
RUN apt-get update
RUN apt-get install --no-install-recommends -y \
zip \
locales \
libicu-dev \
apt-transport-https \
libpng-dev \
libzip-dev \
libxml2-dev \
libpng-dev
RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
RUN locale-gen
# ssl 1.0.0
RUN echo 'deb http://httpredir.debian.org/debian jessie main contrib non-free' >> /etc/apt/sources.list.d/jessie.list \
&& echo 'deb-src http://httpredir.debian.org/debian jessie main contrib non-free' >> /etc/apt/sources.list.d/jessie.list \
&& echo 'deb http://security.debian.org/ jessie/updates main contrib non-free' >> /etc/apt/sources.list.d/jessie.list \
&& echo 'deb-src http://security.debian.org/ jessie/updates main contrib non-free' >> /etc/apt/sources.list.d/jessie.list \
&& apt-get update
RUN apt-get install libssl1.0.0
# sqlsrv pre-req
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& curl https://packages.microsoft.com/config/debian/8/prod.list > /etc/apt/sources.list.d/mssql-release.list \
&& apt-get update
RUN ACCEPT_EULA=Y apt-get install -y \
unixodbc \
unixodbc-dev \
libgss3 \
odbcinst \
msodbcsql \
msodbcsql17 \
mssql-tools
RUN echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
RUN echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
# install php ext
RUN pecl install sqlsrv pdo_sqlsrv
RUN docker-php-ext-enable sqlsrv pdo_sqlsrv
# spring cleaning
RUN apt-get clean
RUN rm -rf /var/lib/apt/lists/*
USER docker
WORKDIR /var/www/html
And the "php" service in my docker-compose.yml :
php:
build:
context: .
dockerfile: dockerfile-php
container_name: php
env_file:
- .env
environment:
PHP_EXTENSION_INTL: 1
PHP_EXTENSION_GD: 1
PHP_EXTENSION_XDEBUG: $DEBUG
STARTUP_COMMAND_1: composer install
volumes:
- ./code/backend:/var/www/html
networks:
- net
Also, I'm working on Windows 10 (Professionnal), with Docker for Windows (Linux containers).
Crons seems to be triggered at the UTC date (because the default timezone for the container is UTC, whatever the timezone of the host).
We should probably document this and provide guidance on how to set the timezone in a container.
When the user is not root the cron isn't executed.
I try to create a file with this:
echo "oui">/var/www/html/test.txt
This work for root and not for other user.
When enabling the Xdebug extension with PHP_EXTENSION_XDEBUG=1
, the Xdebug remote host should be set automatically.
The variable xdebug.remote_host
is empty
More a workaround, but we are able to temporary fix this by using PHP_INI_XDEBUG__REMOTE_HOST=ip/docker.for.mac.localhost
PHP_EXTENSION_XDEBUG=1
php -i
in the containerI think that APACHE_DOCUMENT_ROOT
should be allowed to be set outside of /var/www/html
. Since regular Apache configuration allows it.
Currently you can only set a subfolder of /var/www/html
:
https://github.com/thecodingmachine/docker-images-php/blob/v2/Dockerfile.7.2.slim.apache#L77-L80
The solution would be to set the default to /var/www/html
and if the variable is set override the entirety of the default instead. Problem is that I don't see a way that keeps backward compatibility without introducing a secondary variable.
The reason for me requesting this is because on my development environment I'm using Docker in Docker setup to control my environment from inside. When using docker-compose you'd want to have the path be the exact same as on your host system. This allows you to docker-compose ps your docker system.
In cron configuration, I try to apply php -v but php is not found by default.
ZipArchive::setEncryptionName should have been available since PHP 7.2. However, I get the error Call to undefined method ZipArchive::setEncryptionName()
when using the function.
When checking out phpinfo
, I see that libzip
version 1.1.2 is used. Research indicates that this must be increased to version 1.2.0.
ZipArchive::setEncryptionName()
should be defined.
ZipArchive::setEncryptionName()
is not defined.
Update libzip
to version 1.2.0 or newer.
$zip = new ZipArchive();
if ($zip->open('test.zip', ZipArchive::CREATE) === TRUE) {
$zip->setPassword('secret');
$zip->addFile('text.txt');
$zip->setEncryptionName('text.txt', ZipArchive::EM_AES_256);
$zip->close();
echo "Ok\n";
} else {
echo "KO\n";
}
A common need for test containers is to be protected by HTTP Basic authentication.
We could add support for a simple environment variable that enables configuring .htpasswd file.
The 'host' command use to define xdebug configuration doesn't exists in the image.
So, ```DOCKER_HOST_INTERNAL=`host -t A host.docker.internal | awk '/has address/ { print $4 }'```` can't be proceed.
docker run -it --rm -e PHP_INI_MAX_EXECUTION_TIME=60 thecodingmachine/php:7.1-v2-cli php -r "phpinfo();" | grep max
max_execution_time => 60 => 60
max_execution_time => 0 => 0
I don't know why is it like that. Any ideas:
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.1 LTS
Release: 18.04
Codename: bionic
Hi,
Ive been struggling with this for a while now, I cant understand what Iam doing wrong.
Im using Dockerfile.7.3.slim.fpm with this structure:
/php-slim/Dockerfile
/php-slim/extensions
/php-slim/utils
And ive added ARG PHP_EXTENSION at the top of the Dockerfile:
ARG PHP_EXTENSIONS="gettext apcu opcache pdo pdo_mysql zip soap intl"
ARG INSTALL_CRON=1
FROM php:7.3-fpm-stretch
None of the extensions gets compiled/installed when i build. If I add this manually below line 16:
RUN cd /usr/local/lib/thecodingmachine-php/extensions/current/gettext && ./install.sh
RUN cd /usr/local/lib/thecodingmachine-php/extensions/current/intl && ./install.sh
Those (two) extensions gets installed & compiled as intended. What am I doing wrong? Ive cleaned my cache, downloaded the image from scratch and gets same result each time. Using Dockerfile.7.3.fpm (fat) as Dockerfile works with the extensions.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.