当我在 Eclipse 中调试 PHP 脚本时,它不会加载 mysql 扩展 [英] While I am debugging PHP Script in Eclipse, it doesn't load mysql extension

查看:27
本文介绍了当我在 Eclipse 中调试 PHP 脚本时,它不会加载 mysql 扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在 Ubuntu 10.10 上安装了 Eclipse 和 xDebug.
当我将一些 php 文件作为页面调试时,效果很好.
当我尝试将其作为脚本进行调试时,我给出了未加载 mysql 扩展的消息.
我为 PHP 可执行文件设置了以下选项:

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:

  • 可执行路径:/usr/bin/php
  • PHP ini 文件:/etc/php5/apache2/php.ini
  • SAPI 类型:CLI
  • PHP 调试器:XDebug

我编写了以下脚本:

测试.php
<代码>$ext = get_loaded_extensions();
打印_r($ext);
?>

当我输入命令行/usr/bin/php test.php
我给了 50 个加载的模块,包括 mysql 和 mysqli.
当我在 Eclipse 中将它作为一个页面进行调试时,我给出了相同的模块和 xdebug.
当我在 Eclipse 中将它作为一个页面进行调试时,我给出了 45 个模块,包括 xdebug,但没有加载 mysql 和 mysqli.

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.

推荐答案

今天在这个问题上挣扎了几个小时后,我决定手动 cat 一个单独的 .ini 文件中的所有信息,并开始使用 eclipse -clean 进行日食.类似以下脚本的内容应该可以解决问题:

after struggling with this issue for several hours today, I decided to manually cat all informations inside one single .ini file, and started eclipse with eclipse -clean. something like the following script should do the trick:

#!/bin/bash
mkdir /etc/php5/cli_eclipse
cat /etc/php5/cli/php.ini /etc/php5/conf.d/* > /etc/php5/cli_eclipse/php.ini

(您显然可以检查目录是否已经存在等,但此脚本仅用于说明目的.您需要使用超级用户帐户/sudo 来执行此操作).

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

window 下的 eclipse 中指向你的 php 运行时 ->偏好 ->PHP ->PHP Executables 到您创建的文件并使用 -clean 标志重新启动 eclipse 一次.pdt 应创建包含所有必要信息的临时php.ini".

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 中调试 PHP 脚本时,它不会加载 mysql 扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆