InstantRails. Install PEAR to PHP.

First, let’s check our status:

Target: Install PEAR to PHP

There’s some way. Check out from http://pear.php.net/go-pear

# Webbased installation:
# 1) Download this file and save it as go-pear.php
# 2) Put go-pear.php on your webserver, where you would put your website
# 3) Open http://yourdomain.example.org/go-pear.php in your browser
# 4) Follow the instructions, done!
#
# Command-line installation (for advanced users):
# 1) Download this file and save it as go-pear.php
# 2) Open a terminal/command prompt and type: php -q go-pear.php
# 3) Follow the instructions, done!

I’ve checked out the first step. But it did nothing. Let’s check the 2nd way:

1. Install the base. Execute:

php -q PEAR\go-pear.phar

2. Standard package:

Continue. We will install a standard package in PEAR. DB Package

pear install db

3. Testing.

Create a script call peartest.php. Remember its name shouldn’t be pear.php or you will get this error:

PHP Fatal error: Class 'PEAR_Error' not found in ...

peartest.php’s content:

<?php
  include_once('DB.php');
  if (class_exists('DB')) {
    $dsn = "mysql://develop:Develop@localhost/drupal_dev";
    $conn = DB::connect ($dsn);
    if (DB::isError ($conn))
    die ("Cannot connect: " . $conn->getMessage () . "\n");
  echo "PEAR Installed correctly";
  } else {
    echo 'PEAR Installed wrong:';
  }
?>

Finish.

del.icio.us Tags: ,
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: