phpunit require_once () 오류
최근에 pear 설치 프로그램을 통해 서버에 phpunit을 설치했습니다.
테스트를 실행하면 다음과 같은 오류가 발생합니다.
PHP 경고 : require_once (PHPUnit / Util / Filter.php) : 스트림을 열지 못했습니다. 44 행의 / usr / bin / phpunit에 해당 파일 또는 디렉토리가 없습니다.
PHP 치명적 오류 : require_once () : 44 행의 / usr / bin / phpunit에서 필수 'PHPUnit / Util / Filter.php'(include_path = '. : / usr / bin / php') 열기 실패
몇 가지 검색을 수행 한 후 서버의 php.ini 파일에있는 include_path를 수정 해 보았습니다. 그러나 그것은 아무 일도하지 않았습니다.
원인이 무엇인지 아십니까?
업데이트 : 2013 년 11 월 및 Ubuntu 12.04부터 다음 두 명령으로 충분합니다.
sudo pear config-set auto_discover 1
sudo pear install pear.phpunit.de/PHPUnit
다음은 이전 답변입니다. 거의 1 년 반이 지났지 만 알려진 문제입니다. 여기에서 읽어보세요
phpunit이 제대로 작동하려면 코드 커버리지가 설치되어 있어야합니다.
여기에서 수행해야하는 작업을 다룹니다.
기본적으로 다음을 입력해야합니다 (권한이없는 경우 sudo를 사용하여 phpunit이 이미 설치되어 있음).
pear channel-discover pear.phpunit.de
pear channel-discover components.ez.no
pear install phpunit/PHP_CodeCoverage
OS X에서이 문제가 발생했습니다. 아직 구성되지 않은 다른 채널의 패키지 몇 개를 포함하는 모든 PHP 종속성을 다시 설치하도록 강제하는 다음 명령으로 문제를 해결했습니다.
sudo pear channel-discover pear.symfony-project.com
sudo pear channel-discover components.ez.no
sudo pear install --alldeps phpunit/PHPUnit
https://bugs.launchpad.net/ubuntu/+source/phpunit/+bug/701544
그리고 특히 우분투 11.04에 대한이 주석이며 다른 사람들에게도 될 수 있습니다.
위에서 권장 한대로 단계를 수행했지만 작동하지 않았지만 배를 1.9.1에서 1.9.2로 업그레이드 한 후에는 완벽하게 작동합니다.
speshu @ speshu-laptop : ~ $ sudo pear 업그레이드 배
downloading PEAR-1.9.2.tgz ...
Starting to download PEAR-1.9.2.tgz (295,120 bytes)
.....................................................done: 295,120 bytes
upgrade ok: channel://pear.php.net/PEAR-1.9.2
PEAR: Optional feature webinstaller available (PEAR's web-based installer)
PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer)
PEAR: Optional feature gtk2installer available (PEAR's PHP-GTK2-based installer)
PEAR: To install optional features use "pear install pear/PEAR#featurename"
PEAR를 처음 사용하는 경우 포함 경로를 오른쪽으로 구성하지 않았을 수 있습니다. PEAR 매뉴얼 의 해당 섹션을 살펴보십시오 .
https://github.com/sebastianbergmann/php-code-coverage
sb@ubuntu ~ % pear channel-discover pear.phpunit.de
Adding Channel "pear.phpunit.de" succeeded
Discovery of channel "pear.phpunit.de" succeeded
sb@ubuntu ~ % pear channel-discover components.ez.no
Adding Channel "components.ez.no" succeeded
Discovery of channel "components.ez.no" succeeded
sb@vmware ~ % pear install phpunit/PHP_CodeCoverage
downloading PHP_CodeCoverage-0.9.0.tgz ...
Starting to download PHP_CodeCoverage-0.9.0.tgz (108,376 bytes)
.........................done: 108,376 bytes
install ok: channel://pear.phpunit.de/PHP_CodeCoverage-0.9.0
(include_path = '. : / usr / bin / php')
당신이 있습니까 장해야 당신이의 include_path에 추가?
ini 파일과 include_path 스 니펫을 본 경우에도 도움이 될 수 있습니다.
찾았어요!
PEAR가 / usr / share / pear에 PHPUnit을 설치 한 것 같습니다. 이유는 확실하지 않지만 그것이있는 곳입니다. (mt) 물건이어야합니다.
어쨌든, 나는 모두 준비되었습니다. 도와 주셔서 감사합니다.
이것은 오래되거나 불완전한 PHPUnit 설치가있는 경우에도 발생합니다. PEAR를 설정 한 후 최신 패키지를 얻으려면 PHPUnit.de 채널 을 추가해야 합니다.
In my case, I solved it by adding /usr/share/php/PEAR
to the include_path
.
I'm using Ubuntu 10.04.2.
If you have problems with accessing components try another way.
Install pear
sudo apt-get install php-pear
Install
phpunit
by using pear.pear config-set auto_discover 1 pear install pear.phpunit.de/PHPUnit
Install
phpunit
/Selenium, but first you need to installcurl
modulesudo apt-get install php5-curl pear install phpunit/PHPUnit_Selenium
I was having the same problem. Netbeans was reporting that the phpunit version was too old (which it wasn't). Running the phpunit script directly showed the above messages.
I solved it adding:
include_path=".:/usr/share/php"
To /etc/php5/cli/php.ini
Please NOTE that the php.ini file is the one for php CLI (command) not the php.ini used for apache!
My original problem was I could not get the command line version of php (yum install php or yum install php-cli) to upgrade to => php5.2.7 I was stuck on 5.1 version
I had already compiled php 5.3.3 for use with apache. So I setup a symbolic link from /usr/bin/php (the command line default) to my compiled version in /var/php5/bin/php to get the command line php reporting 5.3.3
Then I refollowed the pear install steps for phpunit
But it still needed the code coverage stuff when I ran phpunit.
So I hunted code coverage down under /var/php5/lib/php/PHP/CodeCoverage and added that to the include path in php.ini include_path=".:/var/php5/lib/php/"
Make sure to add it to the include path without /PHP because phpunit starts at PHP/ (notice caps) looking for Code Coverage Failed opening required 'PHP/CodeCoverage/Filter.php'
I had this problem . I was developing a zend framework site. Finally I manage to solve it by removing the zend installation and removing/commenting the include path in bath php.ini files in apache and cli. To develop site with zend we don't need to have zend installed. Insted we can copy the library to our site folder
For me dividing test's in multiple batches helped.
You can solve this issue by redefining the environment variables in PEAR. This is how I solved the problem and I used Ubuntu 12.10
http://rkrants.blogspot.in/2013/01/installing-phpunitpear-in-ubuntu-1210.html
In short it defines the paths and then reinstalls phpunit
Ubuntu 12.04:
sudo pear channel-discover pear.symfony.com
sudo pear install --alldeps phpunit/PHPUnit
I had the same issue with Windows 8 Similar to the top answer, I needed to start the command line, however make sure to run cmd.exe as administrator. Then the two commands
pear config-set auto_discover 1
pear install pear.phpunit.de/PHPUnit
참고URL : https://stackoverflow.com/questions/1528717/phpunit-require-once-error
'your programing' 카테고리의 다른 글
리디렉션없이 HTML 양식을 제출하는 방법은 무엇입니까? (0) | 2020.10.11 |
---|---|
Haskell의 도트 연산자 : 더 많은 설명이 필요합니다. (0) | 2020.10.11 |
PostgreSQL 인덱스 사용 분석 (0) | 2020.10.11 |
PHP를 사용하는 [최소-최대] 범위의 난수 (0) | 2020.10.11 |
C ++에서 포인터 삭제 (0) | 2020.10.11 |