473,508 Members | 2,218 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PEAR doesn't seem to be working

I installed PHP with PEAR support on my Windows computer. I tried the
snippet of the book "Learning PHP5":

<?php
error_reporting(E_ERROR | E_WARNING | E_PARSE);
echo "test";
include 'DB.php';
$db = DB::connect('mysql://penguin:to*****@db.example.com/restaurant');
if (DB::isError($db)) { die("Can't connect: " . $db->getMessage( )); }
?>

But it only prints "test", it should display an error message saying
it's not able to connect to the DB. Do you know why nothing happens?
Also, I think there should be a real "DB.php" file, correct? What
should I put into this file? Or is it only a line "as is", that doesn't
mean there needs a "DB.php" file?
Thanks,

Jan 24 '07 #1
3 1352
On Wed, 24 Jan 2007 07:49:52 -0800, Charles wrote:
I installed PHP with PEAR support on my Windows computer. I tried the
snippet of the book "Learning PHP5":

<?php
error_reporting(E_ERROR | E_WARNING | E_PARSE);
echo "test";
include 'DB.php';
$db = DB::connect('mysql://penguin:to*****@db.example.com/restaurant');
if (DB::isError($db)) { die("Can't connect: " . $db->getMessage( )); }
?>

But it only prints "test", it should display an error message saying
it's not able to connect to the DB. Do you know why nothing happens?
Also, I think there should be a real "DB.php" file, correct? What
should I put into this file? Or is it only a line "as is", that doesn't
mean there needs a "DB.php" file?
Thanks,
You need to read the docs:
http://pear.php.net/manual/index.php

Specifically:
http://pear.php.net/manual/en/installation.php

--
Schluppy

Jan 25 '07 #2
Specifically:http://pear.php.net/manual/en/installation.php

Thanks, this is what I followed yesterday. But it doesn't say in the
docs if there are PHP files and if they need to be put in a specific
place.

Jan 25 '07 #3
On Thu, 25 Jan 2007 02:35:52 -0800, Charles wrote:
>Specifically:http://pear.php.net/manual/en/installation.php

Thanks, this is what I followed yesterday. But it doesn't say in the
docs if there are PHP files and if they need to be put in a specific
place.
Generally, each pear package contains a set of php files. By default
they're installed in the pear folder hierarchy. Once installed you have to
ensure that the include_path directive in your php.ini contains that path.
Then you can include the files as per usual.

From the manual:

"include_path string

Specifies a list of directories where the require(), include() and
fopen_with_path() functions look for files. The format is like the
system's PATH environment variable: a list of directories separated
with a colon in Unix or semicolon in Windows.

Example G-1. Unix include_path

include_path=".:/php/includes"

Example G-2. Windows include_path

include_path=".;c:\php\includes"

Using a . in the include path allows for relative includes as it means
the current directory."

http://www.php.net/manual/en/ini.core.php

So, assuming you're on windows and your pear directory is in c:\php\pear,
you'd edit the include_path directive in your php.ini to read:

include_path=".;c:\php\includes;c:\php\pear"

If you're using apache you'll want to restart it for the changes to take
effect.

Now in your scripts, you can include any pear packages you've installed
exactly like the documentation for the package specifies.

--
Schluppy


Jan 25 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1528
by: Jay Donnell | last post by:
I just installed Getopt via pear and pear stopped working. No matter what I put as arguments I get the usage instructions: # pear list-installed Usage: pear command <parameters> Type "pear...
13
3006
by: Tim Tyler | last post by:
I've been using PHP for a while now - and have recently been trying to set up PHP, MySQL and Apache on Windows (for a client). It seems like all the PEAR stuff under PHP 5 doesn't work out of the...
0
1462
by: Wayne Smallman | last post by:
OK, anyone have some advice on implementing the likes of SELECT ... FOR UPDATE / SELECT ... LOCK IN SHARE MODE? I'm trying to get it working in conjunction with the transaction facilities built...
39
3632
by: Analysis&Solutions | last post by:
Greetings: Crack open the beer, PEAR DB 1.6.0 is here! (Hey, I'm a bit giddy with excitement that my intense work during the past seven weeks has come to fruition.) For those unfamiliar with...
3
32397
by: joshua.wehner | last post by:
I can't seem to get PEAR to work, but I think it's installed. Any ideas? phpinfo() says '--with-pear=/usr/local/apache/php-pear' $ which pear /usr/local/bin/pear $ pear list Installed...
4
1991
by: russell.hunter | last post by:
I have pear installed on my web server. The problem is, I can't seem to get it working! Whenever I try to call one of the installed packages, for example: require_once "DB.php"; I get the...
8
1553
by: lawrence k | last post by:
I wrote a simple CMS for personal use. I'm thinking of using it for other clients now. It's use of the database is slow and inefficient. I'm thinking of switching to the PEAR class listed here: ...
5
1491
by: crescent_au | last post by:
Hi all, I've been using PHP for a while now but I haven't actually used PEAR. I have just read half a chapter in a book, it sounds alright but haven't actually used it. I was just wondering, is...
3
3499
by: mpar612 | last post by:
I am stumped. Below is my code and it doesn't work (I removed the $login info for posting). PHP Code: require 'PEAR/DB.php'; // Connect to the database $db = DB::connect($login); if...
0
7336
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7401
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7063
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7504
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5640
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5059
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3211
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1568
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
773
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.