[Nix-dev] How to build PHP with xdebug support

Paul Koerbitz paul.koerbitz at gmail.com
Wed May 13 09:52:14 CEST 2015


Hi there,

I am struggeling a bit trying to install PHP so that it supports
xdebug. I can install both php and xdebug, but I don't understand how
I can teach PHP about the xdebug extension.

I have tried to override the PHP deriviation (by placing my own
modified deriviation under ~/.nixpkgs/php/) and modifying it's install
phase as follows:

```
  installPhase = ''
    unset installPhase; installPhase;
    cp php.ini-production $iniFile

    # Now Let's build xdebug if flag has been given
    # TODO I think there are better paths than the given below
    PATH=$PATH:$out/bin
    tar xfz $xdebug_src;
    cd xdebug*
    phpize
    ./configure --prefix=$out
    make
    ensureDir $out/lib; cp modules/xdebug.so $out/lib
    cat >> $out/etc/php.ini << EOF
    zend_extension="$out/lib/xdebug.so"
    zend_extension_ts="$out/lib/xdebug.so"
    zend_extension_debug="$out/lib/xdebug.so"
    xdebug.remote_enable=true
    xdebug.remote_host=127.0.0.1
    xdebug.remote_port=9000
    xdebug.remote_handler=dbgp
    xdebug.profiler_enable=0
    xdebug.profiler_output_dir="/tmp/xdebug"
    xdebug.remote_mode=req
    max_execution_time = 300
    date.timezone = UTC
  EOF
  '';
```

(I have stolen this from
https://github.com/jimpick/nixos-upstream-svn-nixpkgs/blob/master/pkgs/development/interpreters/php_configurable/default.nix)

However, the xdebug build included in the install phase breaks for
some reason I haven't figured out yet.

Is this a reasonable avenue to pursue or is there a simple better way
to get xdebug-enabled php on nixos?

thank you
Paul


More information about the nix-dev mailing list