Fatal error with - pear install pear.phpunit.de/PHPUnit - php

I followed this post but it did not help
I am executing following shell commands on a Remote CI system (Fedora) to install php tools:
wget http://pear.php.net/go-pear.phar
php go-pear.phar
pear config-set auto_discover 1
pear install pear.phpunit.de/PHPUnit
On execution of php unit command I encounter following exception -
pear install pear.phpunit.de/PHPUnit
PHP Fatal error: Call to undefined method PEAR::raiseErro() in /usr/share/pear/PEAR/REST.php on line 165
PHP Stack trace:
PHP 1. {main}() /usr/share/pear/pearcmd.php:0
PHP 2. PEAR_Command_Common->run() /usr/share/pear/pearcmd.php:305
PHP 3. PEAR_Command_Install->doInstall() /usr/share/pear/PEAR/Command/Common.php:271
PHP 4. PEAR_Downloader->download() /usr/share/pear/PEAR/Command/Install.php:661
PHP 5. PEAR_Downloader_Package->initialize() /usr/share/pear/PEAR/Downloader.php:279
PHP 6. PEAR_Downloader_Package->_fromString() /usr/share/pear/PEAR/Downloader/Package.php:190
PHP 7. PEAR_Downloader->_getPackageDownloadUrl() /usr/share/pear/PEAR/Downloader/Package.php:1713
PHP 8. PEAR_REST_13->getDownloadURL() /usr/share/pear/PEAR/Downloader.php:850
PHP 9. PEAR_REST->retrieveData() /usr/share/pear/PEAR/REST/13.php:68
Finished: FAILURE
Are there any more commands I need to add?

You need to update your PEAR. Here is a bug report showing the same error http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=619307 and the solution is to get the updated PEAR version.

What the pear installer is trying to tell you is that there was an error when trying to install the package.
It fails because the pear version that is used is buggy :/
Yes you installed the "current/right" pear package from the php site with the commands shown so that leaves three options:
a) Some permission issue with access to /tmp/ or some other pear config-show folder that doesn't get properly reported.
Maybe throwing in a sudo might help if you can do that?
b) You still have another pear version running alongside or you didn't install pear system-wide or something related to that issue.
Try to run pear upgrade pear and see if that helps. pear version should produce 1.9.4.
c) It's failing because it can't connect to the server it wants to pull the files from and it then fails trying to report the error.
Maybe run wget pear.phpunit.de just to see if that works to check or if your firewall blocks that.
Those are the only two options I currently see to solve your issue with pear without more debugging. Should that not suffice you can find help on freenodeIrc in #phpunit or in the stackoverflow php chat.
All php-qa-tools can be run from a git checkout but it is, usually, considerably(!) more hassle to get that to run.

Related

PHP installation configure: error: Cannot find php_pdo_driver.h

So I have already installed Apache2 and Mysql on Linux Mint (the same as Ubuntu), Now I am trying to install PHP on Apache but I get a very strange error message :
configure: error: Cannot find php_pdo_driver.h.
I did some search on the Internet and I found out that these files were not embedded before in PHP, but they are now. I even checked for it myself in the PHP source folders and I found that specific file. Can anyone tell me what's the problem and how to solve it ?
actually PDO is included on PHP core.
You must install the PHP and MySQL bundled packages.
Use sudo apt-get install php5-mysql
you should check your php version, you must have php version 5 to load PDO.

How do I solve this PHP-PEAR error / install PEAR on Fedora?

I'm trying to save an old, failing web-server setup consisting of Fedora, PHP, PEAR, and Oracle.
With some difficulty (I'm very new to all four), I've been able to set up something similar on a newer system. I used Fedora 19, PHP 5.5.4 (with Apache 2.4.6), and Oracle 11g.
That just leaves PEAR.
Now, from what I understand, PEAR is some PHP code, like a library, which PHP Web Applications can use to save time from having to code them again - database connection, for example.
But I don't know what to do with it, or even how to get it. Copy paste from my old system? Download using the CLI using yum? Are there packages I need to be aware of, or is it just a one download-one install thing?
For instance, a basic PHP webpage with the following code:
<?php
phpinfo();
?>
works fine on the new server setup, so I'm assured that everything else is working. But when I try to load the PHP files from the other server, it returns an Internal Server Error. I checked the error_log files under /etc/httpd/logs, and most of the errors appear as below:
PHP Fatal error: require_once(): Failed opening required 'MDB2.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/hrweb/includes/functions.php on line 4
EDIT:
According to the PEAR Website, PEAR is included upon the installation of PHP, though not all modules / packages are there. Typing in the command pear in the CLI does confirm it is installed, though it does not help the issue.
I got the MDB2 package via pear install MDB2, though apparently, MDB2_Driver_oci8 is required. Whenever I try to download that, I get the following:
"MDB2_Driver_oci8" version "1.4.1" does not have REST XML available
In addition to this, I also tried to download OLE, which gets me the following:
No releases available for package "pear.php.net/OLE"
This was also previously the error of trying to download MDB2_Driver_oci8.
Thanks.
You have to install the (surprise!) MDB2 package to get MDB2.php:
$ pear install mdb2
and the adapter of your choice:
$ pear install mdb2_driver_mysql-beta
Then make sure the PEAR php directory is in your include path - see the PEAR manual.
"MDB2_Driver_oci8" version "1.4.1" does not have REST XML available
try to install the beta version:
$ pear install mdb2_driver_oci8-beta
No releases available for package "pear.php.net/OLE"
You're trying to install the stable version, but OLE does not have any stable version (yet): http://pear.php.net/package/OLE/download
Append either -alpha or -beta after OLE:
$ pear install OLE-beta

I want to link xampp 1.7.7 to the php CLI

i'm working with ubuntu 11.10 as root on my local machine, i've installed xampp 1.7.7 and i'm a newbie to ubuntu,
while following a tutorial on sitepoint(http://www.sitepoint.com/getting-started-with-pear/) on how to install pear to use PhpUnit, i didnt notice it then, but it seems that i installed or used an existing php version 5.3.6 in CL to do that, also the pear installation was built on this version, while xampp being installed,i now have two versions of php,xampp's 5.3.8 and the 5.3.6, anyway, what i want to do is to use the existing xampp php version and build pear on that, to make all my work through xampp.so my questions are:
how to uninstall the php V5.3.6 and it's pear installation?
how to link the CL with the php ver. of xampp?
how to build the next pear installation on the php ver. of xampp?
i want all my web dev. work through xampp, is there anything else i need to unistall, to avoid this confusion? 4.
i did the following in attampet to solve the problem:
i wrote this in bash:
gedit ~/.bashrc
i added that to the end of ~/.bashrc file in attempt to change environment path:
export PATH=/opt/lampp/bin:$PATH
export PATH=/opt/lampp/lib/php:$PATH
export PATH=/opt/lampp/lib/php/PHPUnit/pearcmd.php:$PATH
i checked the php and pear version using 'php -v' and 'pear list'
i got an ouput of:
PHP 5.3.8 (cli) (built: Sep 19 2011 13:29:27)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
and for pear:
Installed packages, channel pear.php.net:
=========================================
Package Version State
Archive_Tar 1.3.9 stable
Console_Getopt 1.3.1 stable
PEAR 1.9.4 stable
PHPUnit 1.3.2 stable
Structures_Graph 1.0.4 stable
XML_Util 1.2.1 stable
when i run: 'phpunit MessageTest.php': i get
PHP Warning: require_once(PHP/CodeCoverage/Filter.php): failed to open stream: No such file or directory in /usr/bin/phpunit on line 38
Warning: require_once(PHP/CodeCoverage/Filter.php): failed to open stream: No such file or directory in /usr/bin/phpunit on line 38
PHP Fatal error: require_once(): Failed opening required 'PHP/CodeCoverage/Filter.php' (include_path='.:/php/includes:/opt/lampp/lib/php:/opt/lampp/bin:/opt/lampp/lib/php/PEAR') in /usr/bin/phpunit on line 38
5.i ran the following commands as reported in other questions as a solution to that error:
sudo apt-get remove phpunit
sudo pear channel-discover pear.phpunit.de
sudo pear channel-discover pear.symfony-project.com
sudo pear channel-discover components.ez.no
sudo pear update-channels
sudo pear upgrade-all
sudo pear install --alldeps phpunit/PHPUnit
sudo apt-get install phpunit
and updated include path of php.ini to be:
include_path = ".:/php/includes:/opt/lampp/lib/php:/opt/lampp/bin:/opt/lampp/lib/php/PEAR"
the php file MessageTest.php:
<?php
require 'PHPUnit/Autoload.php';
$path = '/opt/lampp/lib/php/PEAR';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
require_once 'PHPUnit/Framework/TestCase.php';
require_once 'Message/Controller/MessageController.php';
class MessageTest extends PHPUnit_Framework_TestCase{
private $message;
public function setUp() {
$this->message = new MessageController();
}
public function tearDown() {
}
public function testRepeat(){
$yell = "Hello, Any One Out There?";
$this->message->repeat($yell); //sending a request
$returnedMessage = $this->message->repeat($yell);//get a response
$this->assertEquals($returnedMessage, $yell);
}
}
?>
MessageController class from MessageController.php that i'm trying to test
<?php
class MessageController {
public function actionHelloWorld() {
echo 'helloWorld';
}
public function repeat($inputString){
return $inputString;
}
}
$msg = new MessageController;
?>
I'm not using any PHP framework, i just made the files and classes sounds like it that's all.
and still i get the same error:
PHP Warning: require_once(PHP/CodeCoverage/Filter.php): failed to open stream: No such file or directory in /usr/bin/phpunit on line
Warning: require_once(PHP/CodeCoverage/Filter.php): failed to open stream: No such file or directory in /usr/bin/phpunit on line 38
PHP Fatal error: require_once(): Failed opening required 'PHP/CodeCoverage/Filter.php' (include_path='.:/php/includes:/opt/lampp/lib/php:/opt/lampp/bin:/opt/lampp/lib/php/PEAR') in /usr/bin/phpunit on line 38
sure, i'm getting demanding here, i've wasted a lot of time and got really frustrated over this, hope you guys dont get bored reading through my questions, i appreciate your help
thanks in advance,
Mohamad elbialy
Finally, i got the answer for the question on how to link the xampp's php and pear to CL (bash shell for ubuntu),
type the following in a terminal window:
gedit ~/.bashrc
the file opens and you add the following to the end of file:
export PATH=/opt/lampp/bin:$PATH
and to make sure type the following in the terminal:
echo $PATH
you'll see '/opt/lampp/bin' in the echoed path along with others added by default
this is the only way that worked for me after 2-3 days of searching forums, other stackoverflow and superuser questions
to check that the CL is dealing with xampp's php and pear version, type the following:
php -v shows the version of php
pear list shows the version of pear along with pear dependent packages
Now, i've been doing this to make PHPunit work in CL, for 5 days, imagine the frustration,
being a newbie to Ubuntu i made alot of sudo and not so sudo commands that missed the whole thing for me, so i decided to make a fresh installation of ubuntu (to delete all those pear, php and phpunit packages that i installed and couldnt track thier path)
so starting from a fresh ubuntu 11.10 and xampp 1.7.7, i did the following to make phpunit work:
i made the link for xampp's php and pear with cL (i wrote how above),
type the following steps in CL:
sudo /opt/lampp/bin/pear uninstall phpunit (xampp's is 1.2.something, i want to install 3.6.10)
sudo /opt/lampp/bin/pear list (PHPunit is not there, that's a check),
the following steps as advised in PHPunit manual1
sudo /opt/lampp/bin/pear config-set auto_discover 1 (opens the download channel or something)
sudo /opt/lampp/bin/pear install pear.phpunit.de/PHPUnit (this installs ver. 3.6.10),
now type in CL:
sudo /opt/lampp/bin/phpunit --version (this shows the version of 3.6.10, yes you've made it)
i used /opt/lampp/bin/phpunit, to make you see quick results and no, you dont need to include anything in path to work, you already done that, you need to close that terminal and open a new one and type only, phpunit --version, you'll get the same result, it's there, it's all yours
Note:
i used '/opt/lampp/bin/something and then the command', to force my installations through xampp's php and pear, this is not needed (cause you set the environment path), but that's how you get to do things when you spend more than 5 days of search.
i tried working with phpunit 1.2.something of xampp's, but it seems that it's not there for the command line, i dont know why and i dont want to, so if that happens to you and you want ver.1.2.something, find all versions, using the instructions in this link (http://pear.phpunit.de/) and do the same steps to install it,
i didnt try the method in that link and if you get stuck you can comment to this answer,

Netbeans integration with Mac OS X native PHP, PEAR PHPUnit config

I am trying to integrate Netbeans 6.9 or 7 into my development environment (Mac OS X 10.6.7 native PHP no stacks) but no matter what I try I am not getting Netbeans to recognize my PHP interpreter (/usr/bin/php) or my PHPUnit script (/usr/local/bin/phpunit).
Anybody got some less than obvious ideas, although I may have missed one of those. I have exhausted search terms on the web trying to find someone who went through the same problems but nothing has come of it.
EDIT
Well for the past day I have been using phpunit --version to verify my phpunit version (3.5.13) and pear list to verify my PEAR 1.9.2 install. Well I just discovered the pear list-all which shows phpunit as 1.3.2. Upon entering pear upgrade phpunit/PHPUnit the response I get is Nothing to upgrade
This may explain the PHPUnit script problem since apparently there are 2 versions of PHPUnit installed and the one I am trying to point to must not be tied into PEAR.
which php /usr/bin/php
which pear /usr/local/bin/pear
which phpunit /usr/local/bin/phpunit
Any ideas? Thanks
Wrong phpunit versions
$ pear list-all
shows the packages from the default channel, which is "pear.php.net" unless you configured it otherwise. You did install phpunit from pear.phpunit.de, which is a different channel.
PHPUnit previously (version 1) was hosted on pear.php.net but moved to its own channel.
Running
$ pear list-all -c pear.phpunit.de
shows phpunit 3.5.13.
$ pear install phpunit/phpunit
is actually the same as
$ pear install pear.phpunit.de/phpunit
because phpunit is the short name/alias for the pear.phpunit.de channel.
Two phpunits installed
You probably do not have two phpunit versions installed. "list-all" lists all available packages on a channel, not only local/installed ones.
Well I finally gave up on netbeans and went over to PhpStorm 2. I am not having any problems there and it does what I need. cweiske I apprecaite the info provided as that was of great help for things I did not realize.

MAMP php includes

I'm not a php developer but I'm fiddling with MAMP. I've installed MAMP and my php include() calls aren't working.
[13-Jul-2010 19:23:30] PHP Fatal error: require_once() [<a href='function.require'>function.require</a>]: Failed opening required '1' (include_path='.:/Applications/MAMP/bin/php5.3/lib/php:/Applications/MAMP/htdocs/mt_sandbox/php/') in /Applications/MAMP/htdocs/mt_sandbox/php/email/owner_emails.php on line 5
As you can see there, I was trying to edit my php.ini file to use a second include path to the 'php' directory of my project 'mt_sandbox'.
Here are the exact includes
require_once("Mail.php") or die ('php load error for Mail.php');
require_once('/Applications/MAMP/htdocs/mt_sandbox/php/email/email_manager.php') or die ('php load error for email/email_manager.php');
The die messages aren't firing because I'm getting the PHP Fatal error.
Can anyone tell me what I'm doing wrong? How can I get setup to use includes in my scripts?
I ran across this same issue after upgrading to Mountain Lion. Considering how old your post is I assume you have solved this, but figure an answer may be useful for others searching.
When installing pear extensions for MAMP make sure to run your commands using the pear package in MAMP. If pear is already installed outside of MAMP and you execute
pear install -a Mail
This will fire off the wrong pear function. Executing this will tell you which pear function you are using.
which pear
For me it was in /opt/local/bin/pear
To use the MAMP pear function I navigated into this directory '/Applications/MAMP/bin/php/php5.4.4/bin' and used this command
./pear install -a Mail
This fired the pear command in MAMP and installed the package for me.
Use an absolute path to the file you're including

Categories