You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
#! /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 workspace container WORKSPACE_CONTAINER=$(docker ps | grep workspace${PHP_VERSION} | awk '{print $1}')
if [[ -z "${WORKSPACE_CONTAINER}" ]]; then echo "Unable to find workspace container: workspace${PHP_VERSION}" exit 1 fi
if [[ ! -z "${WITH_PROFILER}" ]]; then echo "With profiler option". fi
xdebug_status () { echo 'xDebug status'
docker exec -it $WORKSPACE_CONTAINER bash -c 'php -v' }
xdebug_start () { echo 'Start xDebug'
# And uncomment line with xdebug extension, thus enabling it ON_CMD='sed -i "s/^;zend_extension=/zend_extension=/g" /etc/php/$PHP_VERSION/cli/conf.d/20-xdebug.ini'
docker exec -it $WORKSPACE_CONTAINER bash -c "${ON_CMD}" docker exec -it $WORKSPACE_CONTAINER bash -c 'php -v'
echo 'In cli use this for resolve hostname for debugger in your IDE:' echo 'export PHP_IDE_CONFIG="serverName=loc.mydomain.ru"' }
xdebug_stop () { echo 'Stop xDebug'
# Comment out xdebug extension line OFF_CMD='sed -i "s/^zend_extension=/;zend_extension=/g" /etc/php/$PHP_VERSION/cli/conf.d/20-xdebug.ini'
docker exec -it $WORKSPACE_CONTAINER bash -c "${OFF_CMD}" docker exec -it $WORKSPACE_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 ${WORKSPACE_CONTAINER} container." echo "xDebug must have already been installed." echo "Usage:" echo " .php-fpm/xdebug stop|start|status"
esac
exit 1
|