LAMP Docker (with some small tools that help development)
This docker setup has been tested with Magento 2, WordPress and Symfony 2 -> Symfony 4
docker
and docker compose
properlycd
into the that.env
: define docker env variabledclamp.env
: define PHP versions and servicesdocker-compose.yml
: Docker compose file
./dclamp
./dclamp config
and ./dclamp generate
separately.*.*.localhost
(optional)
openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
-keyout ./httpd/certs/x.x.localhost.key \
-out ./httpd/certs/x.x.localhost.crt \
-subj "/C=XX/ST=State/L=City/O=Company/OU=CompanySectionName/CN=*.*.localhost"
docker compose up -d
localhost/info.php
to check if it’s running properlyroot:1@localhost:3306
or root:1@mariadb:3306
index.php
is located at ./public_html/project-dir/public-dir/index.php
,http://public-dir.project-dir73.localhost
to run your application with PHP 7.3,http://public-dir.project-dir74.localhost
(PHP 7.4)/etc/hosts/
because by default, all .localhost sites will be redirected to 127.0.0.1:
# Redirect all localhost sites to 127.0.0.1
address=/localhost/127.0.0.1
./httpd/conf/vhosts/
docker restart httpd
or
docker compose exec php73 /bin/bash
docker compose exec php{xx} /bin/bash
php ...
php
by xdebug
php bin/console
to xdebug bin/console
docker compose exec...
into container, runor shortcut
toggle-php-mod xdebug
toggle-php-mod xd
docker compose exec...
into container, runor shortcut
toggle-php-mod opcache
toggle-php-mod op