473,667 Members | 2,562 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('my sql://penguin:to***** @db.example.com/restaurant');
if (DB::isError($d b)) { 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 1361
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('my sql://penguin:to***** @db.example.com/restaurant');
if (DB::isError($d b)) { 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_pa th 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\include s"

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\include s;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
1537
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 help options" to list all options. .... Clearly the version of pear doesn't like the newest version of Getopt.
13
3021
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 box. It took me a while to track down the go-pear.bat file in the root - what with all the other garbage in there. Shouldn't this file get at least a mention in:
0
1474
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 into Pear DB. Obvious answer to obvious question: yes, I'm using InnoDB-formatted tables within MySQL. So far, all of the stuff I've put in place certainly isn't stopping me
39
3660
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 PEAR DB, it's a package of PHP classes that provide an object oriented API with common methods of accessing thirteen of PHP's database driver extensions: dBase, FrontBase, InterBase, Informix, mSQL, MS SQL Server,
3
32424
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 packages: ===================
4
2002
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 following error: Warning: main(): open_basedir restriction in effect.
8
1562
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: http://pear.php.net/package/DB What do people think of it?
5
1501
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 it really necessary to use PEAR? I usually get things done using PHP/MySQL. I don't know if I'm really missing out on something by not using PEAR. How highly is it recommended? On most job ads, i don't even see them mentioning PEAR. They mostly...
3
3505
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 (DB::isError($db)) { die ("Can't connect: " . $db->getMessage()); }
0
8883
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8563
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8646
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7390
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6203
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2013
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1778
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.