Basic php image with composer installed and xdebug installed but disabled.
library/php is great, but not enough. Almost every php project uses composer, as it became standard to create php packages. And we often use xdebug while develop. So it includes latest composer and latest xdebug available at moment of build.
Use environment variable to alter php.ini settings:
Composer is built-in. Just use it as usual composer ... inside container
Variables to setup Composer:
Xdebug is installed, but disabled.
To enable xdebug in cli just php -dzend_extension=xdebug.so or setup your IDE interpreter.
To enable xdebug in fpm use php-fpm -d zend_extension=xdebug.so command to start container.
To enable profiling add -d xdebug.profiler_enable=On and -d xdebug.auto_trace=1 to enable tracing.
Profiling and tracing files are stored at /tmp
Variables to setup Xdebug:
docker run --rm \
-e PHP_INI_SESSION_USE_COOKIES=0 \
-e PHP_INI_XDEBUG_REMOTE_HOST=host.docker.internal \
antonmarin/php:7.4-alpine-cli \
php -dzend_extension=xdebug.so -i
docker run --rm antonmarin/php:7.4-alpine-cli composer show --platform
services:
php:
image: antonmarin/php:7.4-alpine-fpm
environment:
PHP_INI_SESSION_USE_COOKIES: 0
PHP_INI_XDEBUG_REMOTE_HOST: {{YOUR_IP_ADDRESS}}
PHP_IDE_CONFIG: serverName={{YOUR_APPLICATION_NAME}}
command:
- php-fpm
- -d
- zend_extension=xdebug.so
PHPStorm section "Debugger extension" for example.
Content type
Image
Digest
sha256:43a341bcb…
Size
214.6 MB
Last updated
almost 2 years ago
docker pull antonmarin/php:8.1-alpine-fpm