Eclipse and Xdebug does not parse additional ini files in /etc/php5/conf.d
I have setup Eclipse 3.6.2 on Ubuntu 11.4 for AMD64 and Xdebug.
Eclipse was installed with zip download from eclipse.org. PHP and Xdebug were setup with apt-get.
When I run the PHP script in the shell they will use the /etc/php5/php.ini
file and parse additional ini files in /etc/php5/conf.d/
.
When I run in Eclipse (run mode or debug mode) it will only parse php.ini
and no additional i开发者_如何转开发ni files.
Basically, all extensions, are not loaded.
It is an intentional bug.
PDT executes php with "-n" option always. It makes additional ini files unavailable.
see https://bugs.eclipse.org/bugs/show_bug.cgi?id=339547
also https://bugs.eclipse.org/bugs/show_bug.cgi?id=347618
BTW, you'll be able to add a shell script which trims "-n" option as PHP Executable.(Preferences>PHP>PHP Executables)
For example,
#!/bin/sh if [ $1 = "-n" ]; then shift; fi /usr/bin/php $*
The answer @atlanto gives as a work around did and does still work, but recent version of Eclipse (I'm on Neon) has a fix that may work for you if you don't mind using the php.ini
and conf.d
set by default for the php executable.
The failing to load additional files only happens now if you put in an explicit php.ini
file when defining a PHP executable. Leave this blank and check the box Use system default php.ini configurate
.
Now if you use the location/php.ini that was specified as default when the executable was built, it will respect scanning of conf.d
directories.
Here's how to check if your php
has scanning conf.d
enable and where the approriate default location is:
php -i "(command-line 'phpinfo()')" | grep "Configure Command"
You should see something like:
Configure Command => './configure' '--prefix=/usr/local/Cellar/php5/5.6.29_5'
'--localstatedir=/usr/local/var' '--sysconfdir=/usr/local/etc/php/5.6'
'--with-config-file-path=/usr/local/etc/php/5.6'
'--with-config-file-scan-dir=/usr/local/etc/php/5.6/conf.d'
'--mandir=/usr/local/Cellar/php56/5.6.29_5/share/man'
... and so on...
The items that matter are:
with-config-file-path
: this where it will look for yourphp.ini
filewith-config-file-scan-dir
: this is theconf.d
that will be scanned
If you still wish to choose a different in location than the default for the executable your options are:
- Inline the module directives from and file in
conf.d
into your alternatephp.ini
- Rebuild php and set the above options to your new location as default
- Use the wrapper script @atlanto indicates
精彩评论