Sign inSign up

lordius/alpine-php_fpm

By lordius

•Updated almost 8 years ago

PHP-FPM image based on Alpine. There are Postfix, Crontab, Drush and xDebug inside.

Image
1

4.2K

lordius/alpine-php_fpm repository overview

⁠PHP-FPM image for Docker Compose LAMP stack

PHP-7 FPM image based on the last Alpine Linux PHP packages(php-7..).

⁠Main Built features

  • Ansible
  • Git
  • MySQL-Client
  • PHP-FPM
  • PHP Memcached
  • PHP Redis
  • PHP PostgreSQL
  • PHP MongoDB
  • Xdebug
  • Uploadprogress
  • Imagemagick
  • Composer
  • Drush
  • POSIX
  • Patch
  • TAR
  • Wget
  • SSH
  • Rsync
  • Nano

⁠Include own configs

You could mount to /temp_configs_dir with your volume and use own configs. Variable USE_ONLY_CONFIGS - disable using the custom variables in the list below.

⁠How to run

The example command with enabled Cron, Sendmail and Xdebug:

docker run -v /hostDir:/var/www/localhost/htdocs -d -e CRONTAB_ENABLED="1" -e PHP_FPM_PORT="9000" -e PHP_SENDMAIL_PATH="/usr/sbin/sendmail -i -t" -e PHP_SENDMAIL_HOST="smtp.host" -e PHP_SENDMAIL_PORT="1025" -e PHP_XDEBUG_ENABLED="1" -e PHP_XDEBUG_PORT="9010" -e PHP_MEMORY_LIMIT="1024M" --name php-fpm lordius/alpine-php_fpm

⁠How to access terminal in container

Run a command:

docker exec -it php-fpm-container-name --user www-data ash

You will be in folder /var/www/localhost/htdocs.

Now, you could run inside container commands like, composer install, php -v etc.

⁠Environment Variables

VariableDefault ValueDescription
DRUSH_VERSION8.xGlobal Drupal Drush version
PHP_SHOW_ERRORS;php_flag[display_errors] = offLine php_flag[display_errors] in the /etc/php7/php-fpm.conf
PHP_FPM_PORTlisten = 8000Line listen in the /etc/php7/php-fpm.conf
PHP_MEMORY_LIMITmemory_limit = 256MLine memory_limit in the /etc/php7/php.ini
PHP_MAX_EXECUTION_TIMEmax_execution_time = 150Line max_execution_time in the /etc/php7/php.ini
PHP_MAX_FILE_UPLOADSmax_file_uploads = 20Line max_file_uploads in the /etc/php7/php.ini
PHP_MAX_INPUT_NESTING_LEVEL;max_input_nesting_level = 64Line max_input_nesting_level in the /etc/php7/php.ini
PHP_MAX_INPUT_TIMEmax_input_time = 60Line max_input_time in the /etc/php7/php.ini
PHP_MAX_INPUT_VARS; max_input_vars = 1000Line max_input_vars in the /etc/php7/php.ini
PHP_POST_MAX_SIZEpost_max_size = 512MLine post_max_size in the /etc/php7/php.ini
PHP_UPLOAD_MAX_FILESIZEupload_max_filesize = 512MLine upload_max_filesize in the /etc/php7/php.ini
PHP_ALLOW_URL_FOPENallow_url_fopen = OnLine allow_url_fopen in the /etc/php7/php.ini
PHP_ALWAYS_POPULATE_RAW_POST_DATAalways_populate_raw_post_data = -1Line always_populate_raw_post_data in the /etc/php7/php.ini
PHP_SHORT_OPEN_TAG0Line short_open_tag in the /etc/php7/php.ini
PHP_SENDMAIL_PATHsendmail_path = opensmtpdLine sendmail_path in the /etc/php7/php.ini
PHP_SENDMAIL_HOSTrelayhost = []:,myhostname =Lines relayhost, myhostname in the /etc/postfix/main.cf
PHP_SENDMAIL_PORTUsed as part for relayhost=host:portLine relayhost in the /etc/postfix/main.cf
CRONTAB_ENABLED0Runs commands: crontab /home/crontasks, /usr/sbin/crond -L 8
PHP_XDEBUG_ENABLED0Line zend_extension = xdebug.so in the /etc/php7/conf.d/xdebug.ini
PHP_XDEBUG_PORT9000Line xdebug.remote_port in the /etc/php7/conf.d/xdebug.ini

⁠How to use Cron

After enabling option CRONTAB_ENABLED="1", you need to mount file crontask.txt in the container file - /home/crontasks.txt, e.g:

docker run -v /hostDir:/var/www/localhost/htdocs -v crontasks.txt:/home/crontasks.txt -d -e PHP_FPM_PORT="9000" -e CRONTAB_ENABLED="1" --name php-fpm lordius/alpine-php_fpm

⁠How to use Xdebug

You need to run container with option PHP_XDEBUG_ENABLED=1 and provide value port for the option PHP_XDEBUG_PORT:

docker run -v /hostDir:/var/www/localhost/htdocs -d -e PHP_FPM_PORT="9000" -e PHP_XDEBUG_ENABLED="1" -e PHP_XDEBUG_PORT="9010" --name php-fpm lordius/alpine-php_fpm

⁠How to configure with Mail service

You need to listen to SMTP service that is linked inside containers:

docker run -v /hostDir:/var/www/localhost/htdocs -d -e PHP_FPM_PORT="9000" -e PHP_SENDMAIL_PATH="/usr/sbin/sendmail -i -t" -e PHP_SENDMAIL_HOST="smtp.host" -e PHP_SENDMAIL_PORT="1025" --name php-fpm lordius/alpine-php_fpm

⁠How to use Drush

After run container execute:

docker exec -it --user www-data --env COLUMNS=100 --env LINES=100 php-fpm-container-name ash

Inside container go to PHP file directory:

cd /var/www/html/localhost

You could check work with the command:

drush version

⁠Full LAMP stack

See Docker Compose LAMP⁠.

Tag summary

Content type

Image

Digest

Size

259.1 MB

Last updated

almost 8 years ago

docker pull lordius/alpine-php_fpm