Eclipse 和 Xdebug 不会解析 /etc/php5/conf.d 中的其他 ini 文件

发布于 2024-11-13 22:06:23 字数 496 浏览 5 评论 0原文

我已经在 Ubuntu 11.4 上为 AMD64 和 Xdebug 设置了 Eclipse 3.6.2。

Eclipse 是通过从 eclipse.org 下载的 zip 文件安装的。 PHP 和 Xdebug 是使用 apt-get 设置的。

当我在 shell 中运行 PHP 脚本时,它们将使用 /etc/php5/php.ini 文件并解析 /etc/php5/conf.d/ 中的其他 ini 文件>。

当我在 Eclipse 中运行(运行模式或调试模式)时,它只会解析 php.ini 而不会解析其他 ini 文件。

基本上,所有扩展都没有加载。

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 ini files.

Basically, all extensions, are not loaded.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

终陌 2024-11-20 22:06:23

这是一个故意的错误。
PDT 始终使用“-n”选项执行 php。它使其他 ini 文件不可用。
请参阅 https://bugs.eclipse.org/bugs/show_bug.cgi?id= 339547
还有 https://bugs.eclipse.org/bugs/show_bug.cgi?id= 347618

顺便说一句,您将能够添加一个 shell 脚本,将“-n”选项修剪为 PHP 可执行文件。(首选项>PHP>PHP可执行文件)
例如,

#!/bin/sh
if [ $1 = "-n" ]; then
  shift;
fi
/usr/bin/php $*

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 $*
月隐月明月朦胧 2024-11-20 22:06:23

@atlanto 给出的答案作为解决方法确实并且仍然有效,但是最新版本的 Eclipse(我在 Neon 上)有一个修复程序,如果您不介意使用 php.ini< /code> 和 conf.d 默认为 php 可执行文件设置。

仅当您在定义 PHP 可执行文件时放入显式 php.ini 文件时,才会出现加载其他文件失败的情况。 将此留空选中此框 使用系统默认 php.ini 配置

,如果您使用在构建可执行文件时指定为默认值的 location/php.ini,它将尊重 conf.d 目录的扫描。

以下是如何检查您的 php 是否启用了扫描 conf.d 以及适当的默认位置在哪里:

    php -i "(command-line 'phpinfo()')" | grep "Configure Command"

您应该看到类似以下内容:

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...

重要的项目是:

  • with-config-file-path:它将在此处查找您的 php.ini 文件
  • with-config-file-scan-dir:这是 将扫描 conf.d

如果您仍然愿意, 要选择与可执行文件的默认位置不同的位置,您的选项是:

  • conf.d 中的模块指令和文件内联到备用 php.ini
  • 重新构建 php 并将上述选项设置为默认的新位置
  • 使用包装器脚本 @atlanto 指示

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.

enter image description here

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 your php.ini file
  • with-config-file-scan-dir: this is the conf.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 alternate php.ini
  • Rebuild php and set the above options to your new location as default
  • Use the wrapper script @atlanto indicates
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文