Skip to content

Instantly share code, notes, and snippets.

@xaoc-303
Last active April 7, 2021 17:15
Show Gist options
  • Select an option

  • Save xaoc-303/7fadd13dfe2cc0337884f594ca4255b2 to your computer and use it in GitHub Desktop.

Select an option

Save xaoc-303/7fadd13dfe2cc0337884f594ca4255b2 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
echo "------------------------------"
echo "PHP 7.3 Xdebug"
echo "------------------------------"
sudo apt -y install php7.3-dev php-pear
sudo pecl channel-update pecl.php.net ; pecl clear-cache
sudo pecl install xdebug
php --ini
sudo cat <<EOF > 20-xdebug.ini
[xdebug]
;zend_extension="/usr/local/opt/php@7.3/pecl/20170718/xdebug.so"
zend_extension="xdebug.so"
xdebug.remote_autostart=1
xdebug.default_enable=1
xdebug.remote_port=9001
xdebug.remote_host=127.0.0.1
xdebug.remote_connect_back=1
xdebug.remote_enable=1
xdebug.idekey=PHPSTORM
xdebug.extended_info=1
;xdebug.remote_handler="dbgp"
EOF
sudo mv 20-xdebug.ini /etc/php/7.3/cli/conf.d
sudo cp /etc/php/7.3/cli/conf.d/20-xdebug.ini /etc/php/7.3/fpm/conf.d/20-xdebug.ini
php -m | grep 'xdebug'
sudo service php7.3-fpm restart
echo "PHPStorm > Settings > PHP > Debug > DBGp Proxy"
echo " IDE Key: PHPSTORM"
echo " Port: 9001"
echo "PHPStorm > Settings > PHP > Debug > Xdebug"
echo " Debug port: 9001"
echo " Can accept external connections: true"
echo " Force break at first line when no path mapping specified: false"
echo " Force break at first line when a script is outside the project: false"
# install extension chrome "Xdebug helper"
# options -> IDE key -> "PHPSTORM"
# click button "Debug"
echo "PHPStorm > Settings > PHP > Servers > Add"
echo " Host: api.pilki.loc"
echo " Port: 8000"
echo " Debugger: Xdebug"
echo "PHPStorm > Run/Debug Configurations"
echo " Add > PHP Remote Debug"
echo " Name: debug8000"
echo " Filter debug connection by IDE key: true"
echo " Server: api.pilki.loc"
echo " IDE key: PHPSTORM"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment