A utility for rapidly deploying Docker for PHP apps.
Watch the installation video: https://youtu.be/xZxaJcsbrWU
Includes:
- PHP v7.0-7.4 + 8.0
- Nginx
- Redis
- PostgreSQL v12.2
- MariaDB v10.5
- Super fast, completely automated installation. (Great for testing multiple versions on CIs)
- The BIG difference between www.phpdocker.io and Dockerize PHP is that Dockerize PHP provides all of the client utilities, where phpdocker.io provides NONE of them.
Out of the box, you have per-project binaries:
- php
- mysql
- mysqldump
- psql
- pg_dump
- createdb
- dropdb
- redis
- redis-cli
- Watch the Installation HOWTO video.
composer require phpexperts/dockerize
vendor/phpexperts/dockerize/install.php
docker-compose up -d
git clone https://github.com/phpexpertsinc/docker-php-stack.git
cd docker-php-stack
bin/php install.php
docker-compose up -d
Don't forget to edit your docker-compose.yml!
In order to dockerize your existing PHP project, do the following:
Ensure that your profile PATH includes ./bin
and that it takes priority over any other directory that may include a php executable:
PATH=./bin:$PATH
To control the containers, use docker-compose
.
# Downloads the images, creates and launches the containers.
docker-compose up -d
# View the logs
docker-compose logs -ft
# Stop the containers
docker-compose stop
That's it! You now have the latest LEPP (Linux, Nginx, PostgreSQL, PHP) stack or the latest LEMP (Linux, Nginx, MariaDB, PHP) stack.
It is possible to control what UID the initial process (usually PHP) and/or PHP-FPM processes run as. The bin/php
file already does this for the initial process.
This is important if you are mounting a volumes into the container, as the the UID of the initial process or PHP-FPM will likely need to match the volume to be able to read and/or write to it.
To set the UID for the PHP-FPM process, you should set the PHP_FPM_USER_ID
environmental variable on the container. e.g:
docker run -e PHP_FPM_USER_ID=1000 phpexperts/php:7 php-fpm5.6
You can modify certain php.ini directives by setting environmental variables within the container. The following is a list of environmental variables and the php.ini directives that they correspond to:
environmental variable | php.ini directives |
---|---|
PHP_POST_MAX_SIZE |
post_max_size |
PHP_UPLOAD_MAX_FILESIZE |
upload_max_filesize |
e.g. the following will start a PHP container with the post_max_size
to 30 Megabytes:
docker run -e PHP_POST_MAX_SIZE=30M phpexperts/php:7
Docker Hub:
PHP Experts, Inc., is my consultation company. It's a small company of a half dozen highly skilled Full Stack PHP devs, including myself, whom I place at 1099 positions at other corporations. We fill both long-term positions and, for crazy devs like me, short-term. If you ever wanted to work on a different project/company every few months or even weeks, anywhere in the continental U.S., Europe, or South East Asia, it's fantastic.
Since 2015, I have set up branches in Las Vegas, Houston, the UK, Dublin, Costa Rica, Colombia, India, and the Philippines. If someone has a work auth in any of those places, we can place you almost anywhere you want. I travel 50% of the time out of choice. All over the world.
Plus, no taxes if you spend 6+ months (or a year, if you're American) out of your country.