#!/bin/sh -x

apt-get update \
  && DEBIAN_FRONTEND=noninteractive apt-get install -y php-pear php7.4-dev

pecl config-set php_ini $PHP_INI_DIR/php.ini
pear config-set php_ini $PHP_INI_DIR/php.ini

pecl install xdebug-beta

echo xdebug.remote_enable=1 >> $PHP_INI_DIR/conf.d/xdebug.ini; \
echo xdebug.remote_autostart=0 >> $PHP_INI_DIR/conf.d/xdebug.ini; \
echo xdebug.remote_port=9000 >> $PHP_INI_DIR/conf.d/xdebug.ini; \
echo xdebug.remote_connect_back=0 >> $PHP_INI_DIR/conf.d/xdebug.ini; \
echo xdebug.remote_host=host.docker.internal >> $PHP_INI_DIR/conf.d/xdebug.ini; \
echo xdebug.idekey=PHPSTORM >> $PHP_INI_DIR/conf.d/xdebug.ini; \
echo xdebug.remote_log=/var/log/xdebug.log >> $PHP_INI_DIR/conf.d/xdebug.ini;

apt-get purge php-pear php7.4-dev

/build/cleanup.sh

#!/bin/sh -x

apt-get update && apt-get install php-pear

pecl install xdebug-beta && docker-php-ext-enable xdebug

echo xdebug.remote_enable=1 >> $PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini; \
echo xdebug.remote_autostart=0 >> $PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini; \
echo xdebug.remote_port=9000 >> $PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini; \
echo xdebug.remote_connect_back=0 >> $PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini; \
echo xdebug.remote_host=host.docker.internal >> $PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini; \
echo xdebug.idekey=PHPSTORM >> $PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini; \
echo xdebug.remote_log=/var/log/xdebug.log >> $PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini;
--- 
+++ 
@@ -1,21 +1,13 @@
 #!/bin/sh -x
 
-apt-get update \
-  && DEBIAN_FRONTEND=noninteractive apt-get install -y php-pear php7.4-dev
+apt-get update && apt-get install php-pear
 
-pecl config-set php_ini $PHP_INI_DIR/php.ini
-pear config-set php_ini $PHP_INI_DIR/php.ini
+pecl install xdebug-beta && docker-php-ext-enable xdebug
 
-pecl install xdebug-beta
-
-echo xdebug.remote_enable=1 >> $PHP_INI_DIR/conf.d/xdebug.ini; \
-echo xdebug.remote_autostart=0 >> $PHP_INI_DIR/conf.d/xdebug.ini; \
-echo xdebug.remote_port=9000 >> $PHP_INI_DIR/conf.d/xdebug.ini; \
-echo xdebug.remote_connect_back=0 >> $PHP_INI_DIR/conf.d/xdebug.ini; \
-echo xdebug.remote_host=host.docker.internal >> $PHP_INI_DIR/conf.d/xdebug.ini; \
-echo xdebug.idekey=PHPSTORM >> $PHP_INI_DIR/conf.d/xdebug.ini; \
-echo xdebug.remote_log=/var/log/xdebug.log >> $PHP_INI_DIR/conf.d/xdebug.ini;
-
-apt-get purge php-pear php7.4-dev
-
-/build/cleanup.sh
+echo xdebug.remote_enable=1 >> $PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini; \
+echo xdebug.remote_autostart=0 >> $PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini; \
+echo xdebug.remote_port=9000 >> $PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini; \
+echo xdebug.remote_connect_back=0 >> $PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini; \
+echo xdebug.remote_host=host.docker.internal >> $PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini; \
+echo xdebug.idekey=PHPSTORM >> $PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini; \
+echo xdebug.remote_log=/var/log/xdebug.log >> $PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini;
Update Xdebug installation script no to use docker-php-ext-enable script
