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

Cillian de Róiste cillian.deroiste at gmail.com
Wed May 13 12:21:33 CEST 2015


Hi Paul,

I've enabled it like this:
https://gitlab.com/goibhnix/configurations/blob/master/users/cillian-work.nix#L264

But I haven't used this configuration in a while so I'm not 100% sure
if it's still valid.

Cheers,
Cillian

2015-05-13 10:28 GMT+02:00 Paul Koerbitz <paul.koerbitz at gmail.com>:
> So I have found a workaround just after posting to this list: I am now
> using a php.ini file from my home directory and have $PHPRC set to
> this ini file. I've simply hardcoded the paths to xdebug in this
> php.ini file.
>
> This workaround works for me know, but I'm still interested if there
> is a more elegant solution.
>
> cheers
> Paul
>
> On Wed, May 13, 2015 at 9:52 AM, Paul Koerbitz <paul.koerbitz at gmail.com> wrote:
>> 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
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev



-- 
NixOS: The Purely Functional Linux Distribution
http://nixos.org


More information about the nix-dev mailing list