当我在 Eclipse 中调试 PHP 脚本时,它不加载 mysql 扩展
我已经在 Ubuntu 10.10 上安装了 Eclipse 和 xDebug。
当我将某些 php 文件调试为页面时,效果很好。
当我尝试将其作为脚本进行调试时,我给出一条消息:mysql 扩展未加载。
我为 PHP 可执行文件设置了以下选项:
- 可执行文件路径:/usr/bin/php
- PHP ini 文件:/etc/php5/apache2/php.ini
- SAPI 类型:CLI
- PHP 调试器:XDebug
我编写了以下脚本:
test.php< br> <代码> $ext = get_loaded_extensions();
print_r($ext);
?>
当我输入命令行 /usr/bin/php test.php
我给出了 50 个加载的模块,包括 mysql 和 mysqli。
当我在 Eclipse 中将其作为页面进行调试时,我提供相同的模块和 xdebug。
当我在 Eclipse 中将其作为页面进行调试时,我给出了 45 个模块,包括 xdebug,但 mysql 和 mysqli 未加载。
I have installed Eclipse and xDebug on Ubuntu 10.10.
When I debug some php file as a page, that works fine.
When I try to debug it as a script, I give the message that mysql extension is not loaded.
I set the following options for PHP executable:
- Executable path: /usr/bin/php
- PHP ini file: /etc/php5/apache2/php.ini
- SAPI type: CLI
- PHP debugger: XDebug
I wrote the following script:
test.php<?php
$ext = get_loaded_extensions();
print_r($ext);
?>
When I put in command line /usr/bin/php test.php
I give 50 loaded modules include mysql and mysqli.
When I debug it as a page in Eclipse I give the same modules and xdebug.
When I debug it as a page in Eclipse I give 45 modules include xdebug, but mysql and mysqli are not loaded.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
今天在解决这个问题几个小时后,我决定手动
cat
单个.ini文件中的所有信息,并使用eclipse -clean
启动eclipse。像下面的脚本应该可以解决问题:(您显然可以检查目录是否已经存在等。但此脚本仅用于说明目的。您需要使用超级用户帐户/sudo 来执行此操作)。
将 php 运行时指向 eclipse 下的
window ->;偏好-> PHP-> PHP 可执行文件
添加到您创建的文件中,并使用-clean
标志重新启动 Eclipse。 pdt 应创建包含所有必要信息的临时“php.ini”。after struggling with this issue for several hours today, I decided to manually
cat
all informations inside one single .ini file, and started eclipse witheclipse -clean
. something like the following script should do the trick:(you could obviously check if the dir is already existing etc. but this script is here for illustrative purposes only. you'll need to use a superuser account/sudo to execute this).
point your php runtime in eclipse under
window -> preferences -> PHP -> PHP Executables
to your created file and restart eclipse once with the-clean
flag. pdt should create temporary "php.ini"s containing all necessary information.Eclipse PDT 团队决定引入 -n 选项来修复Bug #324073。因此,仅加载了 /tmp/zend_debug/... 中的 php.ini,并且尚未加载所有其他 INI 文件。
这是从 PDT 2.2.0 M201010110334 (2010/10/11) 开始引入的。
有关详细信息,请参阅以下链接:
The Eclipse PDT team decided to introduce the -n option to fix the Bug #324073. So only php.ini from /tmp/zend_debug/... has been loaded, and all additional INI files have not been loaded.
This has been introduced since PDT 2.2.0 M201010110334 (2010/10/11).
For more information, see the following links:
尝试调用此处描述的函数: http://php.net/ Manual/en/function.php-ini-loaded-file.php 并查看它是否返回完全相同的路径。
在 Ubuntu 和 Debian 上,php 配置被分成许多文件。查看 /etc/php5 (或类似路径)。
作为最后的手段,我会编写自己的配置并在 eclipse php run as 脚本配置中引用它,并确保配置包含并引用 mysql 扩展。
Try invoke the function described here: http://php.net/manual/en/function.php-ini-loaded-file.php and see if it returns exactly the same path.
On Ubuntu as well as on Debian the php configuration is split among many files. Look at the /etc/php5 (or similar path).
As last resort I would write my own config and reference it in the eclipse php run as script configuration and make sure the config includes and references the mysql extension.