Phpunit require_once () error

I recently installed phpunit on my server through the pear installer.

When I go to run the test, I get the following error:

PHP Warning: require_once (PHPUnit / Util / Filter.php): Could not open stream: such file or directory in / usr / bin / phpunit on line 44

PHP Fatal error: require_once (): Error opening PHPUnit / Util / Filter.php (include_path = '.: / Usr / bin / php') in / usr / bin / phpunit on line 44

After doing some searching, I tried to make some changes to the include_path in the php.ini file on the server. But it did nothing.

Any idea what could be causing this?

+78
php installation phpunit php-ini filepath
06 Oct '09 at 23:43
source share
17 answers

UPDATE: as of 2013 and Ubuntu 12.04 these two commands should be enough:

sudo pear config-set auto_discover 1 sudo pear install pear.phpunit.de/PHPUnit 

Below is an older answer. This is a known issue, although almost a year and a half has passed. Read about it here.

Code coverage must be installed for phpunit to work correctly

What you need to do is described here:

setting code coverage through PEAR

Basically, you need to type (using sudo if you don't have permissions if this phpunit is already installed):

 pear channel-discover pear.phpunit.de pear channel-discover components.ez.no pear install phpunit/PHP_CodeCoverage 
+123
May 09 '11 at 16:26
source share

I had this problem in OS X. It was fixed using the following commands, which force me to reinstall all php dependencies, including a couple of packages from other channels that have not yet been configured:

 sudo pear channel-discover pear.symfony-project.com sudo pear channel-discover components.ez.no sudo pear install --alldeps phpunit/PHPUnit 
+34
Apr 25 2018-11-11T00:
source share

https://bugs.launchpad.net/ubuntu/+source/phpunit/+bug/701544

and specifically this comment for ubuntu 11.04 and maybe for some others too

although I took the steps as recommended above, I did not get it to work, but after I updated the pear from 1.9.1 to 1.9.2, it works fine, just do it

speshu @ speshu-laptop: ~ $ sudo pear upgrade 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 web-based installer) PEAR: Optional feature gtkinstaller available (PEAR PHP-GTK-based installer) PEAR: Optional feature gtk2installer available (PEAR PHP-GTK2-based installer) PEAR: To install optional features use "pear install pear/PEAR#featurename" 
+13
May 23 '11 at 6:46 am
source share

If this is your first time using PEAR, you may not have configured the enable path. Take a look at the appropriate section in the PEAR manual .

+8
Oct 07 '09 at 0:39
source share

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 
+4
May 18 '11 at 4:22
source share

(include_path = ': / usr / bin / php')

Are you sure you added it to include_path?

It can also help if we see your ini file and include_path fragment in it ...

+2
06 Oct '09 at 23:45
source share

I found him!

It looks like PEAR installed PHPUnit in / usr / share / pear. Not sure why, but where is it. It must be a (mt) thing.

Anyway, I'm all set up. Thanks for the help.

+2
07 Oct '09 at 1:10
source share

This also happens if you have an outdated or incomplete installation of PHPUnit. Remember that after configuring PEAR, you must add the PHPUnit.de channel to get the updated package.

+2
Feb 06 2018-10-06T00
source share

In my case, I solved it by adding /usr/share/php/PEAR to include_path .

I am using Ubuntu 10.04.2.

+2
Feb 23 '11 at 18:32
source share

If you have problems accessing the components, try a different method.

  • Set pear

     sudo apt-get install php-pear 
  • Install phpunit with a pear.

     pear config-set auto_discover 1 pear install pear.phpunit.de/PHPUnit 
  • Install phpunit / Selenium, but first you need to install the curl module

     sudo apt-get install php5-curl pear install phpunit/PHPUnit_Selenium 
+1
Apr 30 '12 at 15:07
source share

I had the same problem. Netbeans reported that the phpunit version was too old (which was not). Running the phpunit script showed directly specified messages.

I decided to add this:

 include_path=".:/usr/share/php" 

In /etc/php5/cli/php.ini

Please note that the php.ini file is the one used for the php CLI command (not for php.ini used for apache!

0
Aug 01 2018-11-11T00:
source share

My initial problem was that I could not get the php command line version (yum install php or yum install php-cli) to upgrade to => php5.2.7. I am stuck in version 5.1

I already compiled php 5.3.3 for use with apache. So I set up a symlink from / usr / bin / php (the default for the command line) to my compiled version in / var / php 5 / bin / php to get the php 5.3.3 command line message

Then I redid the installation steps of the pear for phpunit

But I still need material to cover the code when I launched phpunit.

So, I was hunting for code coverage in / var / php 5 / lib / php / PHP / CodeCoverage and added that to the include path in php.ini include_path = ": / var / php5 / Library / PHP /"

Be sure to add it to the include path without / PHP, because phpunit starts with PHP / (error reporting), which is looking for Code Coverage. Could not open the window "PHP / CodeCoverage / Filter.php"

0
Oct 19 '11 at 19:54
source share

I had this problem. I designed the zend framework site. Finally, I manage to solve this problem by uninstalling the zend installation and removing / commenting out the path to include php.ini in the bath files in apache and cli. To develop a site with zend, we do not need to install zend. When ordering, we can copy the library to the folder of our site

0
May 04 '12 at 6:19 06:19
source share

Did it help me to share the test in several batches?

0
Dec 27 '12 at 8:19
source share

You can solve this problem by overriding 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

0
Jan 04 '13 at 19:50
source share

Ubuntu 12.04:

 sudo pear channel-discover pear.symfony.com sudo pear install --alldeps phpunit/PHPUnit 
0
Sep 19 '13 at
source share

I had the same problem with Windows 8. Like the top answer, I needed to run a command prompt, however, be sure to run cmd.exe as an administrator . Then two teams

 pear config-set auto_discover 1 pear install pear.phpunit.de/PHPUnit 
0
Sep 11 '14 at 14:01
source share



All Articles