-
-
Save asbiin/749e88902d911ba4bfa74787a28d4a59 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| xdebugfile=xdebug-2.6.0alpha1.tgz | |
| phpversion=7.2 | |
| function update_ini() { | |
| if $(grep -q "$1" $inifile); then | |
| sudo sed -i "s/\($1\).*/\1=$2/" $inifile; | |
| else | |
| echo -e "\n$1=$2" | sudo tee -a $inifile; | |
| fi | |
| } | |
| function clean() { | |
| rm -f ~/$xdebugfile | |
| rm -rf ~/$xdebugdir | |
| } | |
| function download() { | |
| wget -q http://xdebug.org/files/$xdebugfile | |
| tar xzf $xdebugfile >/dev/null | |
| } | |
| function compile() { | |
| pushd $xdebugdir | |
| phpize$phpversion | |
| ./configure >/dev/null | |
| make > /dev/null | |
| sudo cp modules/xdebug.so $(php$phpversion -i | grep /usr/lib/php/ | cut -d' ' -f 3) | |
| popd | |
| } | |
| xdebugdir=$(basename -s .tgz $xdebugfile) | |
| inifile=/etc/php/$phpversion/mods-available/xdebug.ini | |
| clean | |
| download | |
| compile | |
| clean | |
| sudo phpenmod -v $phpversion xdebug | |
| if [ ! -f $inifile ]; then | |
| echo "xdebug.ini not found"; | |
| else | |
| update_ini zend_extension xdebug.so; | |
| update_ini xdebug.remote_enable 1; | |
| update_ini xdebug.remote_connect_back 1; | |
| update_ini xdebug.remote_port 9000; | |
| update_ini xdebug.max_nesting_level 250; | |
| update_ini xdebug.remote_autostart 1; | |
| update_ini xdebug.remote_host $(netstat -rn | grep "^0.0.0.0 " | cut -d " " -f10); | |
| fi | |
| sudo service php$phpversion-fpm restart | |
| php -v |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment