+ php src container fully refactored and lightweight
* on host system container also refactored, some env options moved from .env to docker-compose example * dnsmasq now is separate service file + php 8.3 support * xdebug launch also refactored and lightweight * tested and worked python environment with pyenv (on today without supervisor) * database container and appropriate gui applications for management database systems moved into separate service files + build src php container helper - remove unnecessary docker compose file version directive - remove minio thing from the host php services * use redis-local.conf from example and lightweight main redis conf file
This commit is contained in:
@ -1,9 +0,0 @@
|
||||
; Load igbinary extension
|
||||
;extension=igbinary.so
|
||||
|
||||
; Use igbinary as session serializer
|
||||
session.serialize_handler=igbinary
|
||||
|
||||
; Enable or disable compacting of duplicate strings
|
||||
; The default is On.
|
||||
igbinary.compact_strings=On
|
93
dockerfiles/php-fpm/php.base.Dockerfile
Normal file
93
dockerfiles/php-fpm/php.base.Dockerfile
Normal file
@ -0,0 +1,93 @@
|
||||
USER root
|
||||
|
||||
###########################################################################
|
||||
# Set custom timezone if needed
|
||||
###########################################################################
|
||||
|
||||
ARG CUSTOM_TZ=Etc/UTC
|
||||
|
||||
RUN if [ ${CUSTOM_TZ} -ne $(cat /etc/timezone) ]; then \
|
||||
ln -snf /usr/share/zoneinfo/$CUSTOM_TZ /etc/localtime && \
|
||||
echo $CUSTOM_TZ > /etc/timezone \
|
||||
;fi
|
||||
|
||||
###########################################################################
|
||||
# Set additional locale if needed:
|
||||
###########################################################################
|
||||
|
||||
ARG CUSTOM_LOCALE=en_US.UTF-8
|
||||
|
||||
RUN if [ ${CUSTOM_LOCALE} -ne 'en_US.UTF-8' ]; then \
|
||||
locale-gen ${CUSTOM_LOCALE} \
|
||||
;fi
|
||||
|
||||
###########################################################################
|
||||
# Pear Mail and Mail_Mime:
|
||||
###########################################################################
|
||||
|
||||
USER root
|
||||
|
||||
ARG INSTALL_PEAR_MAIL=false
|
||||
|
||||
RUN if [ ${INSTALL_PEAR_MAIL} = true ]; then \
|
||||
pear install Mail && pear install Mail_Mime \
|
||||
;fi
|
||||
|
||||
###########################################################################
|
||||
# Libreoffice
|
||||
###########################################################################
|
||||
|
||||
USER root
|
||||
|
||||
ARG INSTALL_LIBREOFFICE=false
|
||||
|
||||
RUN if [ ${INSTALL_LIBREOFFICE} = true ]; then \
|
||||
apt update -qq && \
|
||||
apt-get install libreoffice-nogui -qq --no-install-recommends \
|
||||
;fi
|
||||
|
||||
###########################################################################
|
||||
# НУЦ:
|
||||
###########################################################################
|
||||
|
||||
USER root
|
||||
|
||||
ARG INSTALL_NUC_CERTS=false
|
||||
|
||||
RUN if [ ${INSTALL_NUC_CERTS} = true ]; then \
|
||||
mkdir /usr/local/share/ca-certificates/extra && \
|
||||
cd /usr/local/share/ca-certificates/extra && \
|
||||
curl -O https://gu-st.ru/content/lending/russian_trusted_root_ca_pem.crt && \
|
||||
curl -O https://gu-st.ru/content/lending/russian_trusted_sub_ca_pem.crt && \
|
||||
update-ca-certificates \
|
||||
;fi
|
||||
|
||||
###########################################################################
|
||||
# Tune opts:
|
||||
###########################################################################
|
||||
|
||||
USER root
|
||||
|
||||
ARG PHP_OPT_MEMORY_LIMIT=256M
|
||||
RUN sed -i "s/^memory_limit = .*/memory_limit = $PHP_OPT_MEMORY_LIMIT/g" "$PHP_INI_DIR/php.ini"
|
||||
|
||||
ARG PHP_OPT_POST_MAX_SIZE=300M
|
||||
RUN sed -i "s/^post_max_size = .*/post_max_size = $PHP_OPT_POST_MAX_SIZE/g" "$PHP_INI_DIR/php.ini"
|
||||
|
||||
ARG PHP_OPT_UPLOAD_MAX_FILESIZE=100M
|
||||
RUN sed -i "s/^upload_max_filesize = .*/upload_max_filesize = $PHP_OPT_UPLOAD_MAX_FILESIZE/g" "$PHP_INI_DIR/php.ini"
|
||||
|
||||
ARG PHP_OPT_MAX_EXECUTION_TIME=600
|
||||
RUN sed -i "s/^max_execution_time = .*/max_execution_time = $PHP_OPT_MAX_EXECUTION_TIME/g" "$PHP_INI_DIR/php.ini"
|
||||
|
||||
ARG PHP_OPT_SHORT_OPEN_TAG=Off
|
||||
RUN sed -i "s/^short_open_tag = .*/short_open_tag = $PHP_OPT_SHORT_OPEN_TAG/g" "$PHP_INI_DIR/php.ini"
|
||||
|
||||
###########################################################################
|
||||
# Cleanup
|
||||
###########################################################################
|
||||
|
||||
USER root
|
||||
|
||||
# Clean up
|
||||
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
@ -1,43 +0,0 @@
|
||||
FROM dimti/php:5.6
|
||||
|
||||
###########################################################################
|
||||
# Pear Mail and Mail_Mime:
|
||||
###########################################################################
|
||||
|
||||
ARG INSTALL_PEAR_MAIL=false
|
||||
|
||||
RUN if [ ${INSTALL_PEAR_MAIL} = true ]; then \
|
||||
pear install Mail && pear install Mail_Mime \
|
||||
;fi
|
||||
|
||||
###########################################################################
|
||||
# xDebug (termporary):
|
||||
###########################################################################
|
||||
|
||||
# Copy xdebug configuration for remote debugging
|
||||
COPY ./xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
|
||||
|
||||
###########################################################################
|
||||
# Permission denied on /tmp folder:
|
||||
###########################################################################
|
||||
|
||||
RUN chmod 1777 /tmp
|
||||
|
||||
###########################################################################
|
||||
# Tune opts:
|
||||
###########################################################################
|
||||
|
||||
ARG PHP_OPT_SHORT_OPEN_TAG=Off
|
||||
RUN sed -i "s/^short_open_tag = .*/short_open_tag = $PHP_OPT_SHORT_OPEN_TAG/g" "$PHP_INI_DIR/php.ini"
|
||||
|
||||
ARG PHP_OPT_MAX_EXECUTION_TIME=600
|
||||
RUN sed -i "s/^max_execution_time = .*/max_execution_time = $PHP_OPT_MAX_EXECUTION_TIME/g" "$PHP_INI_DIR/php.ini"
|
||||
|
||||
ARG PHP_OPT_MEMORY_LIMIT=256M
|
||||
RUN sed -i "s/^memory_limit = .*/memory_limit = $PHP_OPT_MEMORY_LIMIT/g" "$PHP_INI_DIR/php.ini"
|
||||
|
||||
ARG PHP_OPT_POST_MAX_SIZE=48M
|
||||
RUN sed -i "s/^post_max_size = .*/post_max_size = $PHP_OPT_POST_MAX_SIZE/g" "$PHP_INI_DIR/php.ini"
|
||||
|
||||
ARG PHP_OPT_UPLOAD_MAX_FILESIZE=16M
|
||||
RUN sed -i "s/^upload_max_filesize = .*/upload_max_filesize = $PHP_OPT_UPLOAD_MAX_FILESIZE/g" "$PHP_INI_DIR/php.ini"
|
@ -1,62 +1,7 @@
|
||||
# syntax = edrevo/dockerfile-plus
|
||||
FROM dimti/php:7.4
|
||||
|
||||
###########################################################################
|
||||
# Redis and igbinary:
|
||||
###########################################################################
|
||||
ARG PHP_VERSION=7.4
|
||||
ENV PHP_VERSION ${PHP_VERSION}
|
||||
|
||||
ARG INSTALL_REDIS=false
|
||||
|
||||
COPY ./igbinary.ini /usr/local/etc/php/conf.d/igbinary.ini
|
||||
|
||||
RUN if [ ${INSTALL_REDIS} = true ]; then \
|
||||
pecl install -a igbinary \
|
||||
&& docker-php-ext-enable igbinary \
|
||||
&& printf "yes\n" | pecl install redis \
|
||||
&& docker-php-ext-enable redis \
|
||||
;fi
|
||||
|
||||
###########################################################################
|
||||
# Pear Mail and Mail_Mime:
|
||||
###########################################################################
|
||||
|
||||
ARG INSTALL_PEAR_MAIL=false
|
||||
|
||||
RUN if [ ${INSTALL_PEAR_MAIL} = true ]; then \
|
||||
pear install Mail && pear install Mail_Mime \
|
||||
;fi
|
||||
|
||||
###########################################################################
|
||||
# xDebug (termporary):
|
||||
###########################################################################
|
||||
|
||||
# Copy xdebug configuration for remote debugging
|
||||
COPY ./xdebug2/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
|
||||
|
||||
###########################################################################
|
||||
# НУЦ:
|
||||
###########################################################################
|
||||
|
||||
RUN mkdir /usr/local/share/ca-certificates/extra && \
|
||||
cd /usr/local/share/ca-certificates/extra && \
|
||||
curl -O https://gu-st.ru/content/lending/russian_trusted_root_ca_pem.crt && \
|
||||
curl -O https://gu-st.ru/content/lending/russian_trusted_sub_ca_pem.crt && \
|
||||
update-ca-certificates
|
||||
|
||||
###########################################################################
|
||||
# Tune opts:
|
||||
###########################################################################
|
||||
|
||||
ARG PHP_OPT_SHORT_OPEN_TAG=Off
|
||||
RUN sed -i "s/^short_open_tag = .*/short_open_tag = $PHP_OPT_SHORT_OPEN_TAG/g" "$PHP_INI_DIR/php.ini"
|
||||
|
||||
ARG PHP_OPT_MAX_EXECUTION_TIME=600
|
||||
RUN sed -i "s/^max_execution_time = .*/max_execution_time = $PHP_OPT_MAX_EXECUTION_TIME/g" "$PHP_INI_DIR/php.ini"
|
||||
|
||||
ARG PHP_OPT_MEMORY_LIMIT=256M
|
||||
RUN sed -i "s/^memory_limit = .*/memory_limit = $PHP_OPT_MEMORY_LIMIT/g" "$PHP_INI_DIR/php.ini"
|
||||
|
||||
ARG PHP_OPT_POST_MAX_SIZE=48M
|
||||
RUN sed -i "s/^post_max_size = .*/post_max_size = $PHP_OPT_POST_MAX_SIZE/g" "$PHP_INI_DIR/php.ini"
|
||||
|
||||
ARG PHP_OPT_UPLOAD_MAX_FILESIZE=16M
|
||||
RUN sed -i "s/^upload_max_filesize = .*/upload_max_filesize = $PHP_OPT_UPLOAD_MAX_FILESIZE/g" "$PHP_INI_DIR/php.ini"
|
||||
INCLUDE+ ./php.base.Dockerfile
|
||||
|
@ -1,66 +1,7 @@
|
||||
# syntax = edrevo/dockerfile-plus
|
||||
FROM dimti/php:8.1
|
||||
|
||||
###########################################################################
|
||||
# Redis and igbinary:
|
||||
###########################################################################
|
||||
ARG PHP_VERSION=8.1
|
||||
ENV PHP_VERSION ${PHP_VERSION}
|
||||
|
||||
ARG INSTALL_REDIS=false
|
||||
|
||||
COPY ./igbinary.ini /usr/local/etc/php/conf.d/igbinary.ini
|
||||
|
||||
RUN if [ ${INSTALL_REDIS} = true ]; then \
|
||||
pecl install -a igbinary \
|
||||
&& docker-php-ext-enable igbinary \
|
||||
&& printf "yes\n" | pecl install redis \
|
||||
&& docker-php-ext-enable redis \
|
||||
;fi
|
||||
|
||||
###########################################################################
|
||||
# Pear Mail and Mail_Mime:
|
||||
###########################################################################
|
||||
|
||||
ARG INSTALL_PEAR_MAIL=false
|
||||
|
||||
RUN if [ ${INSTALL_PEAR_MAIL} = true ]; then \
|
||||
pear install Mail && pear install Mail_Mime \
|
||||
;fi
|
||||
|
||||
###########################################################################
|
||||
# xDebug (termporary):
|
||||
###########################################################################
|
||||
|
||||
# Copy xdebug configuration for remote debugging
|
||||
COPY ./xdebug3/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
|
||||
|
||||
###########################################################################
|
||||
# Libreoffice
|
||||
###########################################################################
|
||||
|
||||
ARG INSTALL_LIBREOFFICE=false
|
||||
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN if [ ${INSTALL_LIBREOFFICE} = true ]; then \
|
||||
apt-get update \
|
||||
&& apt-get install -y libreoffice-nogui --no-install-recommends \
|
||||
&& apt-get clean \
|
||||
;fi
|
||||
|
||||
###########################################################################
|
||||
# Tune opts:
|
||||
###########################################################################
|
||||
|
||||
ARG PHP_OPT_SHORT_OPEN_TAG=Off
|
||||
RUN sed -i "s/^short_open_tag = .*/short_open_tag = $PHP_OPT_SHORT_OPEN_TAG/g" "$PHP_INI_DIR/php.ini"
|
||||
|
||||
ARG PHP_OPT_MAX_EXECUTION_TIME=600
|
||||
RUN sed -i "s/^max_execution_time = .*/max_execution_time = $PHP_OPT_MAX_EXECUTION_TIME/g" "$PHP_INI_DIR/php.ini"
|
||||
|
||||
ARG PHP_OPT_MEMORY_LIMIT=256M
|
||||
RUN sed -i "s/^memory_limit = .*/memory_limit = $PHP_OPT_MEMORY_LIMIT/g" "$PHP_INI_DIR/php.ini"
|
||||
|
||||
ARG PHP_OPT_POST_MAX_SIZE=48M
|
||||
RUN sed -i "s/^post_max_size = .*/post_max_size = $PHP_OPT_POST_MAX_SIZE/g" "$PHP_INI_DIR/php.ini"
|
||||
|
||||
ARG PHP_OPT_UPLOAD_MAX_FILESIZE=16M
|
||||
RUN sed -i "s/^upload_max_filesize = .*/upload_max_filesize = $PHP_OPT_UPLOAD_MAX_FILESIZE/g" "$PHP_INI_DIR/php.ini"
|
||||
INCLUDE+ ./php.base.Dockerfile
|
||||
|
@ -1,58 +1,7 @@
|
||||
# syntax = edrevo/dockerfile-plus
|
||||
FROM dimti/php:8.2
|
||||
|
||||
###########################################################################
|
||||
# Redis and igbinary:
|
||||
###########################################################################
|
||||
ARG PHP_VERSION=8.2
|
||||
ENV PHP_VERSION ${PHP_VERSION}
|
||||
|
||||
ARG INSTALL_REDIS=false
|
||||
|
||||
COPY ./igbinary.ini /usr/local/etc/php/conf.d/igbinary.ini
|
||||
|
||||
RUN if [ ${INSTALL_REDIS} = true ]; then \
|
||||
pecl install -a igbinary \
|
||||
&& docker-php-ext-enable igbinary \
|
||||
&& printf "yes\n" | pecl install redis \
|
||||
&& docker-php-ext-enable redis \
|
||||
;fi
|
||||
|
||||
###########################################################################
|
||||
# Pear Mail and Mail_Mime:
|
||||
###########################################################################
|
||||
|
||||
ARG INSTALL_PEAR_MAIL=false
|
||||
|
||||
RUN if [ ${INSTALL_PEAR_MAIL} = true ]; then \
|
||||
pear install Mail && pear install Mail_Mime \
|
||||
;fi
|
||||
|
||||
###########################################################################
|
||||
# xDebug (termporary):
|
||||
###########################################################################
|
||||
|
||||
# Copy xdebug configuration for remote debugging
|
||||
COPY ./xdebug3/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
|
||||
|
||||
###########################################################################
|
||||
# Tune opts:
|
||||
###########################################################################
|
||||
|
||||
ARG PHP_OPT_SHORT_OPEN_TAG=Off
|
||||
RUN sed -i "s/^short_open_tag = .*/short_open_tag = $PHP_OPT_SHORT_OPEN_TAG/g" "$PHP_INI_DIR/php.ini"
|
||||
|
||||
ARG PHP_OPT_MAX_EXECUTION_TIME=600
|
||||
RUN sed -i "s/^max_execution_time = .*/max_execution_time = $PHP_OPT_MAX_EXECUTION_TIME/g" "$PHP_INI_DIR/php.ini"
|
||||
|
||||
ARG PHP_OPT_MEMORY_LIMIT=256M
|
||||
RUN sed -i "s/^memory_limit = .*/memory_limit = $PHP_OPT_MEMORY_LIMIT/g" "$PHP_INI_DIR/php.ini"
|
||||
|
||||
ARG PHP_OPT_POST_MAX_SIZE=48M
|
||||
RUN sed -i "s/^post_max_size = .*/post_max_size = $PHP_OPT_POST_MAX_SIZE/g" "$PHP_INI_DIR/php.ini"
|
||||
|
||||
ARG PHP_OPT_UPLOAD_MAX_FILESIZE=16M
|
||||
RUN sed -i "s/^upload_max_filesize = .*/upload_max_filesize = $PHP_OPT_UPLOAD_MAX_FILESIZE/g" "$PHP_INI_DIR/php.ini"
|
||||
|
||||
###########################################################################
|
||||
# Libreoffice:
|
||||
###########################################################################
|
||||
|
||||
RUN apt-get update && apt-get install -y libreoffice-nogui --no-install-recommends && apt-get clean
|
||||
INCLUDE+ ./php.base.Dockerfile
|
||||
|
7
dockerfiles/php-fpm/php83.Dockerfile
Normal file
7
dockerfiles/php-fpm/php83.Dockerfile
Normal file
@ -0,0 +1,7 @@
|
||||
# syntax = edrevo/dockerfile-plus
|
||||
FROM dimti/php:8.3
|
||||
|
||||
ARG PHP_VERSION=8.3
|
||||
ENV PHP_VERSION ${PHP_VERSION}
|
||||
|
||||
INCLUDE+ ./php.base.Dockerfile
|
@ -1,26 +0,0 @@
|
||||
; NOTE: The actual xdebug.so extention is NOT SET HERE but rather (/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini)
|
||||
|
||||
;xdebug.remote_host=dockerhost
|
||||
xdebug.remote_connect_back=1
|
||||
xdebug.remote_port=9000
|
||||
xdebug.idekey=PHPSTORM
|
||||
|
||||
xdebug.remote_autostart=1
|
||||
xdebug.remote_enable=1
|
||||
xdebug.cli_color=0
|
||||
xdebug.profiler_enable=1
|
||||
xdebug.profiler_enable_trigger=1
|
||||
xdebug.profiler_output_dir=/tmp/profiler
|
||||
|
||||
xdebug.remote_handler=dbgp
|
||||
xdebug.remote_mode=req
|
||||
|
||||
xdebug.var_display_max_children=-1
|
||||
xdebug.var_display_max_data=-1
|
||||
xdebug.var_display_max_depth=-1
|
||||
|
||||
xdebug.trace_enable_trigger=1
|
||||
xdebug.trace_output_dir=/tmp/trace
|
||||
xdebug.trace_output_name="trace.%t"
|
||||
|
||||
xdebug.show_exception_trace=1
|
@ -1,87 +0,0 @@
|
||||
#! /bin/bash
|
||||
|
||||
# NOTE: At the moment, this has only been confirmed to work with PHP 7
|
||||
|
||||
PHP_VERSION=$2 # Without dot
|
||||
WITH_PROFILER=$3
|
||||
|
||||
# Grab full name of php-fpm container
|
||||
PHP_FPM_CONTAINER=$(docker ps | grep php${PHP_VERSION} | awk '{print $1}')
|
||||
|
||||
if [[ -z "${PHP_FPM_CONTAINER}" ]]; then
|
||||
echo "Unable to find php fpm container: php${PHP_VERSION}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -z "${WITH_PROFILER}" ]]; then
|
||||
echo "With profiler option".
|
||||
fi
|
||||
|
||||
xdebug_status ()
|
||||
{
|
||||
echo 'xDebug status'
|
||||
|
||||
docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v'
|
||||
}
|
||||
|
||||
|
||||
xdebug_start ()
|
||||
{
|
||||
echo 'Start xDebug2'
|
||||
|
||||
# And uncomment line with xdebug extension, thus enabling it
|
||||
ON_CMD="sed -i 's/^;zend_extension=/zend_extension=/g' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini"
|
||||
REMOTE_AUTOSTART_CMD="sed -i 's/^xdebug.remote_autostart=0/xdebug.remote_autostart=1/g' /usr/local/etc/php/conf.d/xdebug.ini"
|
||||
REMOTE_ENABLE_CMD="sed -i 's/^xdebug.remote_enable=0/xdebug.remote_enable=1/g' /usr/local/etc/php/conf.d/xdebug.ini"
|
||||
PROFILER_ENABLE_CDM="sed -i 's/^xdebug.profiler_enable=0/xdebug.profiler_enable=1/g' /usr/local/etc/php/conf.d/xdebug.ini"
|
||||
|
||||
docker exec -it $PHP_FPM_CONTAINER bash -c "${ON_CMD}"
|
||||
docker exec -it $PHP_FPM_CONTAINER bash -c "${REMOTE_AUTOSTART_CMD}"
|
||||
docker exec -it $PHP_FPM_CONTAINER bash -c "${REMOTE_ENABLE_CMD}"
|
||||
if [[ ! -z "${WITH_PROFILER}" ]]; then
|
||||
docker exec -it $PHP_FPM_CONTAINER bash -c "${PROFILER_ENABLE_CDM}"
|
||||
fi
|
||||
docker restart $PHP_FPM_CONTAINER
|
||||
docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v'
|
||||
}
|
||||
|
||||
|
||||
xdebug_stop ()
|
||||
{
|
||||
echo 'Stop xDebug2'
|
||||
|
||||
# Comment out xdebug extension line
|
||||
OFF_CMD="sed -i 's/^zend_extension=/;zend_extension=/g' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini"
|
||||
REMOTE_AUTOSTART_CMD="sed -i 's/^xdebug.remote_autostart=1/xdebug.remote_autostart=0/g' /usr/local/etc/php/conf.d/xdebug.ini"
|
||||
REMOTE_ENABLE_CMD="sed -i 's/^xdebug.remote_enable=1/xdebug.remote_enable=0/g' /usr/local/etc/php/conf.d/xdebug.ini"
|
||||
PROFILER_DISABLE_CMD="sed -i 's/^xdebug.profiler_enable=1/xdebug.profiler_enable=0/g' /usr/local/etc/php/conf.d/xdebug.ini"
|
||||
|
||||
docker exec -it $PHP_FPM_CONTAINER bash -c "${OFF_CMD}"
|
||||
docker exec -it $PHP_FPM_CONTAINER bash -c "${REMOTE_AUTOSTART_CMD}"
|
||||
docker exec -it $PHP_FPM_CONTAINER bash -c "${REMOTE_ENABLE_CMD}"
|
||||
docker exec -it $PHP_FPM_CONTAINER bash -c "${PROFILER_DISABLE_CMD}"
|
||||
# docker-compose restart php-fpm
|
||||
docker restart $PHP_FPM_CONTAINER
|
||||
docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v'
|
||||
}
|
||||
|
||||
|
||||
case $1 in
|
||||
stop|STOP)
|
||||
xdebug_stop
|
||||
;;
|
||||
start|START)
|
||||
xdebug_start
|
||||
;;
|
||||
status|STATUS)
|
||||
xdebug_status
|
||||
;;
|
||||
*)
|
||||
echo "xDebug [Stop | Start | Status] in the ${PHP_FPM_CONTAINER} container."
|
||||
echo "xDebug must have already been installed."
|
||||
echo "Usage:"
|
||||
echo " .php-fpm/xdebug.sh 73|74 stop|start|status"
|
||||
|
||||
esac
|
||||
|
||||
exit 1
|
@ -1,4 +0,0 @@
|
||||
xdebug.mode=off
|
||||
xdebug.discover_client_host=1
|
||||
xdebug.start_with_request=yes
|
||||
xdebug.output_dir=/tmp/profiler
|
@ -1,84 +0,0 @@
|
||||
#! /bin/bash
|
||||
|
||||
# NOTE: At the moment, this has only been confirmed to work with PHP 7
|
||||
|
||||
PHP_VERSION=$2 # Without dot
|
||||
WITH_PROFILER=$3
|
||||
|
||||
# Grab full name of php-fpm container
|
||||
PHP_FPM_CONTAINER=$(docker ps | grep php${PHP_VERSION} | awk '{print $1}')
|
||||
|
||||
if [[ -z "${PHP_FPM_CONTAINER}" ]]; then
|
||||
echo "Unable to find php fpm container: php${PHP_VERSION}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -z "${WITH_PROFILER}" ]]; then
|
||||
echo "With profiler option".
|
||||
fi
|
||||
|
||||
xdebug_status ()
|
||||
{
|
||||
echo 'xDebug status'
|
||||
|
||||
docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v'
|
||||
}
|
||||
|
||||
|
||||
xdebug_start ()
|
||||
{
|
||||
echo 'Start xDebug3'
|
||||
|
||||
# And uncomment line with xdebug extension, thus enabling it
|
||||
ON_CMD="sed -i 's/^;zend_extension=/zend_extension=/g' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini"
|
||||
|
||||
if [[ -n "${WITH_PROFILER}" ]]; then
|
||||
XDEBUG_MODE='profile'
|
||||
else
|
||||
XDEBUG_MODE='debug'
|
||||
fi
|
||||
|
||||
MODE_DEBUG_CMD="sed -i 's/^xdebug.mode.*/xdebug.mode=${XDEBUG_MODE}/g' /usr/local/etc/php/conf.d/xdebug.ini"
|
||||
|
||||
docker exec -it $PHP_FPM_CONTAINER bash -c "${ON_CMD}"
|
||||
docker exec -it $PHP_FPM_CONTAINER bash -c "${MODE_DEBUG_CMD}"
|
||||
docker restart $PHP_FPM_CONTAINER
|
||||
docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v'
|
||||
}
|
||||
|
||||
|
||||
xdebug_stop ()
|
||||
{
|
||||
echo 'Stop xDebug3'
|
||||
|
||||
# Comment out xdebug extension line
|
||||
OFF_CMD="sed -i 's/^zend_extension=/;zend_extension=/g' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini"
|
||||
MODE_OFF_CMD="sed -i 's/^xdebug.mode.*/xdebug.mode=off/g' /usr/local/etc/php/conf.d/xdebug.ini"
|
||||
|
||||
docker exec -it $PHP_FPM_CONTAINER bash -c "${OFF_CMD}"
|
||||
docker exec -it $PHP_FPM_CONTAINER bash -c "${MODE_OFF_CMD}"
|
||||
# docker-compose restart php-fpm
|
||||
docker restart $PHP_FPM_CONTAINER
|
||||
docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v'
|
||||
}
|
||||
|
||||
|
||||
case $1 in
|
||||
stop|STOP)
|
||||
xdebug_stop
|
||||
;;
|
||||
start|START)
|
||||
xdebug_start
|
||||
;;
|
||||
status|STATUS)
|
||||
xdebug_status
|
||||
;;
|
||||
*)
|
||||
echo "xDebug [Stop | Start | Status] in the ${PHP_FPM_CONTAINER} container."
|
||||
echo "xDebug must have already been installed."
|
||||
echo "Usage:"
|
||||
echo " .php-fpm/xdebug.sh 73|74 stop|start|status"
|
||||
|
||||
esac
|
||||
|
||||
exit 1
|
Reference in New Issue
Block a user