Problems installing PEAR MDB2 with MAMP - php

I've installed a copy of MAMP on my macbook so I can run my php/mysql based website locally.
The MAMP package itself seems to work fine but I needed the PEAR MDB2 Package.
I did the following to install
pear install MDB2
pear install MDB2_Driver_mysql
pear channel-update pear.php.net
All apparently worked and if I try again, they say already installed.
The php include path set in php.ini also looks to be correct:
include_path = ".:/Applications/MAMP/bin/php5.3/lib/php"
Yet after restarting the server and trying to hit my site, I still get
Fatal error: require_once() [function.require]: Failed opening required 'MDB2.php' (include_path='.:/Applications/MAMP/bin/php5.3/lib/php') in /Applications/MAMP/htdocs/config.php on line 5

Is /Applications/MAMP/bin/php5.3/lib/php the root directory for PEAR? That doesn't sound right. Run the command pear config-get php_dir, it will tell you where the PEAR root directory is (despite the misleading configuration name). The default is /usr/share/pear.

Related

ERROR: Could not include PEAR database functions required for the database backend

This error happen when I connect dsn in squirrel mail address book stored into mysql
Is PEAR installed, and is the include path set correctly to find DB.php? storing addressbook in squirrel mail to mysql, i am getting the error. Pls help, if any one know the solution
You can use the system package. For example for Fedora/CentOS/Redhat :
sudo yum install php-pear-DB
Or use pear to install DB with :
pear install DB
Or download DB.php here : http://pear.php.net/package/DB/download (current last version : http://download.pear.php.net/package/DB-1.7.14.tgz ) and uncompress DB.php and the DB directory in ./squirrelmail-*/src/
This is an old thread but I never found the real solution to the Virtualmin's Squirrelmail error:
"Could not include PEAR database functions required for the database backend.
Is PEAR installed, and is the include path set correctly to find DB.php?
Please contact your system administrator and report this error."
By now, Virtualmin version is 1.831 and I am on Debian 8. The standard PEAR installed by Virtualmin is version 1.9.5.
To solve this annoying problem you need to run the command:
pear install db
This command will fail, because the required version of PEAR for this would be 1.10.x. Now you need to update to PEAR 1.10.x which is pretty easy:
wget http://pear.php.net/go-pear.phar
php go-pear.phar
This will update PEAR, check the version with:
pear version
in my case: PEAR Version: 1.10.3
Now you can run the last command:
pear install db
It will install it and finally the error will not appear anymore.
I hope this will help somebody.
PS. In my working configuration I have uncommented the following line:
;include_path=".:/usr/share/php" (should remove the leading ";")
at the following locations:
/etc/php5/apache2/php.ini
/etc/php5/cli/php.ini and restart Apache

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,

Error during installing XML_RPC2

I'm trying to install XML_RPC2 package from PEAR library, but whenever I type a proper command (pear install XML_RPC2) I'm getting an error:
pear/XML_RPC2 requires PHP extension "curl"
No valid packages found
install faild
Strangely enough command
$ pear package-dependencies xml_rpc2
returns information "this package does not have any dependencies" (works fine in any other case).
I've also tried with older versions of XML_RPC2 - same thing. It's the first packege I have problem with.
I'm sure curl is enabled and it's work(tested). Beside that I have installed all others components listed on dependencies list(PHP 5.3, PEAR 1.9.2, Cache_Lite 1.7.9).
I'm working on standard WAMP installtion on Windows XP.
I'll be grateful for any help:)
Edit.
Final solution: WAMP has two locations of php.ini, one used by php scripts and one for console commands. The first one is located in a apache directory (ie wamp/bin/apache/apache2.2.21) and the second one is in the php directory (ie wamp/bin/php/php5.3). If you're enabling modules using options in WAMP's tray icon (PHP extensions or php.ini) you are editing php.ini file in apache directory so it will take effect only on script runed by a browser and not by a command line.
"cURL" is an extension, not a (PEAR-)package. See Manual for installation instructions.
Had this very same issue
1) on the cmd line:
php -me
this will show you weather the curl extension is enabled or not. you may check your php.ini and find out that it's enable but only php -me will tell if there is a problem.
2) user pear config-show
this will list your pear configuration. make sure that ext_dir is pointing to where your php extensions are located:
pear config-show
3) make sure all your pear settings are correct otherwise use the pear config-set to correct them (e.g ext_dir)
pear config-set ext_dir \your\php\ext
If you are sure about the curl extension being enabled just install XML_RPC2 using the nodeps option
pear install --nodeps XML_PPC2
Then you should be fine.

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