diff --git a/.env b/.env index 57a73ac4..51a5a88e 100644 --- a/.env +++ b/.env @@ -6,6 +6,7 @@ PROJECT_NAME=my_php7_project PROJECT_BASE_URL=php.docker.localhost +#PROJECT_BASE_URL=localhost DB_NAME=php DB_USER=php @@ -105,3 +106,6 @@ RSYSLOG_TAG=latest WEBGRIND_TAG=1.5-1.9.5 OPENSMTPD_TAG=6.0-1.4.0 XHPROF_TAG=1.3.5 + +### XDEBUG +XDEBUG=noxdebug.ini diff --git a/.gitignore b/.gitignore index db98e973..967edc33 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .idea/ -.docker-sync/ \ No newline at end of file +.docker-sync/ +jisc-collections-symfony diff --git a/containers/centos-php/Dockerfile b/containers/centos-php/Dockerfile new file mode 100644 index 00000000..c6e12cfc --- /dev/null +++ b/containers/centos-php/Dockerfile @@ -0,0 +1,22 @@ +FROM miveo/centos-php-fpm:7.2 + + +RUN curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/mssql-release.repo +RUN yum update -y +RUN ACCEPT_EULA=Y yum install -y msodbcsql mssql-tools unixODBC-devel +ADD install_sqlsrv.sh /root/install_sqlsrv.sh +ADD xdebug.sh /root/xdebug.sh + +RUN /root/install_sqlsrv.sh + +COPY xdebug.sh /usr/local/bin/ +RUN ln -s usr/local/bin/xdebug.sh / # backwards compat +#ENTRYPOINT ["xdebug.sh"] +#CMD ["echo"] + + +# /opt/plesk/php/7.2/bin/pecl install pdo_sqlsrv +# echo "extension=pdo_sqlsrv.so" > /opt/plesk/php/7.2/etc/php.d/pdo_sqlsrv.ini +# /opt/plesk/php/7.2/bin/pecl install sqlsrv +# echo "extension=sqlsrv.so" > /opt/plesk/php/7.2/etc/php.d/sqlsrv.ini + diff --git a/containers/centos-php/additional-php.ini b/containers/centos-php/additional-php.ini new file mode 100644 index 00000000..6af2441d --- /dev/null +++ b/containers/centos-php/additional-php.ini @@ -0,0 +1 @@ +memory_limit = 12800M diff --git a/containers/centos-php/install_sqlsrv.sh b/containers/centos-php/install_sqlsrv.sh new file mode 100755 index 00000000..73159852 --- /dev/null +++ b/containers/centos-php/install_sqlsrv.sh @@ -0,0 +1,7 @@ + yum-config-manager --enable remi-php72 + yum install -y php72u-devel + yum install -y gcc + yum install -y gcc-c++ + yum install -y pecl + pecl install pdo_sqlsrv + echo "extension=pdo_sqlsrv.so" > /etc/php.d/30-pdo_sqlsrv.ini diff --git a/containers/centos-php/noxdebug.ini b/containers/centos-php/noxdebug.ini new file mode 100644 index 00000000..041acc56 --- /dev/null +++ b/containers/centos-php/noxdebug.ini @@ -0,0 +1,4 @@ +;xdebug.remote_enable=on +;xdebug.remote_autostart=off +;xdebug.remote_host=10.254.254.254 +;xdebug.remote_port=9000 diff --git a/containers/centos-php/xdebug.ini b/containers/centos-php/xdebug.ini new file mode 100644 index 00000000..8ee90f4d --- /dev/null +++ b/containers/centos-php/xdebug.ini @@ -0,0 +1,5 @@ +zend_extension=/usr/lib64/php/modules/xdebug.so +xdebug.remote_enable=on +xdebug.remote_autostart=off +xdebug.remote_host=10.254.254.254 +xdebug.remote_port=9000 diff --git a/containers/centos-php/xdebug.sh b/containers/centos-php/xdebug.sh new file mode 100755 index 00000000..708bc91d --- /dev/null +++ b/containers/centos-php/xdebug.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +set -e + +if [ "X$XDEBUG_REMOTE_PORT" = "X" ] ; then +XDEBUG_REMOTE_PORT=9000 +fi + +if [ "X$XDEBUG" = "X1" ] ; then + +echo "xdebug.remote_enable=on" > /etc/php.d/xdebug.ini +echo "xdebug.remote_autostart=off" >> /etc/php.d/xdebug.ini +echo "xdebug.remote_host=10.254.254.254" >> /etc/php.d/xdebug.ini +echo "xdebug.remote_port=$XDEBUG_REMOTE_PORT" >> /etc/php.d/xdebug.ini +fi diff --git a/docker-compose.yml b/docker-compose.yml index 53418221..09dc6c9f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -27,7 +27,8 @@ services: # - /path/to/postgres/data/on/host:/var/lib/postgresql/data # I want to manage volumes manually. php: - image: wodby/php:$PHP_TAG + #build: containers/centos-php + image: knesser/centos-php-fpm container_name: "${PROJECT_NAME}_php" environment: PHP_SENDMAIL_PATH: /usr/sbin/sendmail -t -i -S mailhog:1025 @@ -37,6 +38,7 @@ services: DB_NAME: $DB_NAME PHP_FPM_USER: wodby PHP_FPM_GROUP: wodby + XDEBUG: $XDEBUG ## Read instructions at https://wodby.com/stacks/php/docs/local/xdebug/ # PHP_XDEBUG: 1 # PHP_XDEBUG_DEFAULT_ENABLE: 1 @@ -46,7 +48,10 @@ services: # PHP_XDEBUG_REMOTE_HOST: 10.254.254.254 # macOS # PHP_XDEBUG_REMOTE_HOST: 10.0.75.1 # Windows volumes: - - ./:/var/www/html + - ./jisc-collections-symfony:/var/www/html + - ./containers/centos-php/$XDEBUG:/etc/php.d/xdebug.ini + - ./containers/centos-php/additional-php.ini:/etc/opt/remi/php72/php.d/additional-php.ini + - ./containers/centos-php/additional-php.ini:/etc/php.d/additional-php.ini ## For macOS users (https://wodby.com/stacks/php/docs/local/docker-for-mac/) # - ./:/var/www/html:cached # User-guided caching # - docker-sync:/var/www/html # Docker-sync @@ -65,7 +70,7 @@ services: NGINX_VHOST_PRESET: php NGINX_SERVER_ROOT: /var/www/html/public volumes: - - ./:/var/www/html + - ./jisc-collections-symfony:/var/www/html # Options for macOS users (https://wodby.com/stacks/php/docs/local/docker-for-mac/) # - ./:/var/www/html:cached # User-guided caching # - docker-sync:/var/www/html # Docker-sync