Using php.ini as config instead of php-cli.ini

Answered

I have a php.ini and a php-cli.ini config file. The only difference between them is that php.ini contains xdebug and php-cli.ini doesn't. This is so that xdebug doesn't impact when running cli commands such as using Composer.

However, I can't find the possiblity to use php.ini as the interpreter in Intellij IDEA. It loads php-cli.ini as default when it exists and thus states that debugger is not installed. Is there a way to fix this? Thanks!

2 comments
Comment actions Permalink

Hi there,

PhpStorm (as well as PHP plugin for IntelliJ IDEA) does not provide functionality that would allow you to specify what config file to use when you setting up PHP Interpreter in IDE -- it uses what PHP itself decides to use.

https://youtrack.jetbrains.com/issue/WI-10454 -- this ticket is to support -c parameter  --- watch it (star/vote/comment) to get notified on any progress.

----

Right now, using latest stable 2016.2.1 version, you can have your PHP Interpreter to not to use xdebug .. and provide the path to xdebug extension in a separate field so it will be used by IDE only when you choose to debug some stuff (when IDE launches PHP interpreter directly of course (CLI script/PHPUnit test/etc) -- it will do nothing for browser-based debug, for example, as PHP is controlled by actual web server (or runs as separate service)).

https://www.jetbrains.com/help/phpstorm/2016.2/configuring-xdebug.html?search=interpreter#on_demand_mode

With the above setup in place it's perfectly fine to have "no debugger installed" message as it will be loaded via -d parameter on demand only.

----

This "on demand" approach also helps when you use CodeSniffer integration and it takes time to check all the rules. With xdebug active by default it quite possible that it may time out when launched from IDE in background but still works fine when launched manually in terminal. With "on demand" (no xdebug enabled) such integration works much faster when launched by IDE.

2
Comment actions Permalink

Great, that fixed it for me. Thank you for your help and detailed explanation!

0

Please sign in to leave a comment.