PHPUnit 无法识别 cURL 扩展 - 无法安装 selenium 测试 [英] PHPUnit not recognizing cURL extension -- can't install selenium test

查看:29
本文介绍了PHPUnit 无法识别 cURL 扩展 - 无法安装 selenium 测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在运行 WAMPserver 的 Windows 7 机器上,我正在尝试为 PEAR 安装 Selenium 扩展.但是,每当我尝试安装它时,都会被告知它需要已经启用的 PHP 扩展curl":

pear install phpunit/PHPUnit_Selenium

包pear.phpunit.de/PHPUnit_Selenium"依赖pear.phpunit.de/PHPUnit"没有发布phpunit/PHPUnit_Selenium 需要 PHP 扩展curl"没有找到有效的包安装失败

所以我去检查我的 php.ini 文件,看看它是否已启用.果然来了:

extension=php_apc.dll;扩展=php_bz2.dll扩展=php_curl.dll;扩展=php_dba.dll;扩展=php_exif.dll

这个网站上,有人告诉我试试这个:

<块引用>

  1. 如果您收到未找到有效软件包安装失败"的错误,请运行以下命令 pear upgrade-all

但是当我运行那个命令时,它只是告诉我Nothing to upgrade-all.

在搜索了我的具体错误后,我发现了一个 PHP 错误提及

<块引用>

curl"php 扩展需要加载到 php 本身作为扩展名.

运行这个命令

php -me

如果curl"没有被列为 [PHP 模块] 之一,它不会工作.

而且我不完全确定如何在 Windows 上将此作为扩展加载到 php 本身".是否有捷径可寻?或者让 PEAR 相信我确实安装了这个?

编辑

为了记录,我的 curl 扩展 被 PHP 注意到了(来自 php_info()):

已启用 cURL 支持cURL 信息 7.20.0

解决方案

在大多数情况下,我会说这来自 php 配置问题.

检查这一点的最简单方法是使用 php -i 并查看 curl 扩展是否显示在输出中.如果没有,则命令行 php.ini 有问题.可能是它使用了错误的 php.ini 文件.php --ini 可以用来检查这个


但可能存在由于某种原因不想或无法启用 curl 扩展的情况,因此我将其作为答案:

如果需要 phpunit 的 selenium 模块,有一种方法可以跳过安装这个包,因为它是一个可选的依赖项.

pear install --onlyreqdeps phpunit/phpunit

不应安装 Selenium.

并且以防万一总是要尝试一件事:

pear install --force --alldeps phpunit/phpunit


要告诉 pear 注意 curl 扩展名不被识别有:

pear install --force phpunit/PHPUnit_Selenium

如果有一些问题只是 pear 没有选择扩展,但正常的脚本是,这可能会起作用.

I'm on a Windows 7 machine running a WAMPserver and I'm trying to install the Selenium extension for PEAR. However, whenever I try to install it, I'm told that it requires the already-enabled PHP extension "curl":

pear install phpunit/PHPUnit_Selenium

Package "pear.phpunit.de/PHPUnit_Selenium" dependency "pear.phpunit.de/PHPUnit" has no releases
phpunit/PHPUnit_Selenium requires PHP extension "curl"
No valid packages found
install failed

So I go to check my php.ini file to see if it's enabled. Sure enough, there it is:

extension=php_apc.dll
;extension=php_bz2.dll
extension=php_curl.dll
;extension=php_dba.dll
;extension=php_exif.dll

On this website, I was told to try this:

  1. If you are getting an error as "No valid packages found Install failed" then run the following command pear upgrade-all

But when I run that command, it just tells me Nothing to upgrade-all.

After searching for my specific error, I found a PHP bug that mentions

The "curl" php extension needs to be loaded into php itself as an extension.

run this command

php -me

If "curl" is not listed as one of the [PHP Modules] it is not going to work.

And I'm not entirely sure how to load this "into php itself as an extension" on Windows. Is there an easy way to do this? Or to get PEAR to believe that I do have this installed?

EDIT

For the record, my curl extension is noticed by PHP (from php_info()):

cURL support    enabled
cURL Information    7.20.0

解决方案

In most cases I'd say that this comes from a php configuration issue.

The easiest way to check for this is to use php -i and see if the curl extension shows up in the output. If it doesn't there is something wrong with the command line php. Chances are it's using the wrong php.ini file. php --ini can be used to check this


But there might be a case where one doesn't want to or can't enable the curl extension for some reason so I'll take that as an answer:

If you don't need the selenium module for phpunit there is a way of skipping the install of this package as it is an optional dependency.

pear install --onlyreqdeps phpunit/phpunit 

should not install Selenium.

And just in case there is always one thing to try:

pear install --force --alldeps phpunit/phpunit


To tell pear to note care about the curl extension not being recognised there is:

pear install --force phpunit/PHPUnit_Selenium

which might work if there is some issue that just pear is not picking the extension up but normal scripts are.

这篇关于PHPUnit 无法识别 cURL 扩展 - 无法安装 selenium 测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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