Skip to content

Instantly share code, notes, and snippets.

@Arkanius
Forked from rahilwazir/php7-fpm_xdebug_nginx.md
Created April 22, 2017 05:10
Show Gist options
  • Save Arkanius/c64661f129b6b9c91c1c929e0353e4fa to your computer and use it in GitHub Desktop.
Save Arkanius/c64661f129b6b9c91c1c929e0353e4fa to your computer and use it in GitHub Desktop.
Quick guide to setup Nginx with PHP7-FPM and XDebug

PHP7

  • Ubuntu 16.04+
$ sudo add-apt-repository ppa:ondrej/php
$ sudo apt update
$ sudo apt install nginx php7.1-fpm php7.1-cli php7.1-common php7.1-json php7.1-opcache php7.1-mysql php7.1-phpdbg php7.1-mbstring php7.1-gd php7.1-imap php7.1-ldap php7.1-pgsql php7.1-pspell php7.1-recode php7.1-soap php7.1-tidy php7.1-dev php7.1-intl php7.1-gd php7.1-curl php7.1-zip php7.1-xml php7.1-xdebug
  • Centos 7.x / Fedora 25.x
$ sudo su
$ rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
$ rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
$ yum/dnf install nginx php71w-fpm php71w-cli php71w-common php71w-json php71w-opcache php71w-mysql php71w-phpdbg php71w-mbstring php71w-gd php71w-imap php71w-ldap php71w-pgsql php71w-pspell php71w-recode php71w-soap php71w-tidy php71w-devel php71w-intl php71w-gd php71w-curl php71w-zip php71w-xml php71w-pecl-xdebug

Change PHP socket to

/var/run/php/php7.1-fpm.sock

Paste the following to /etc/php/7.1/mods-available/xdebug.ini:

zend_extension=xdebug.so # If not already

xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.var_display_max_depth = -1
xdebug.var_display_max_children = -1
xdebug.var_display_max_data = -1
xdebug.idekey = "PHPSTORM"

All done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment