My PHP version is php-4.3.9-3.1 and the pear comes with the installation.

Now , to get started, I need to set the include_path for PEAR in php.ini.

My pear is installed in /usr/share/pear/.

I have added the following line in the php.ini.
Please tell me whether it is correct or not.

include_path = .:/usr/share/pear/

And I restarted the apache service.

Now, The pear should work with PHP.
Is there any other thing i need to do.
Do suggest the needful.

Thanks in advance

    this is the syntax for Unix:

    include_path = ".:/php/includes:/usr/share/pear"

    I think it would work without quotes, too.
    I also think you should NOT have a slash / at the end of paths.
    This example will include these 3 paths:
    .
    /php/includes
    /usr/share/pear

    ... where "." is same directory where current php script is running

      I have included the same in /etc/php.ini.
      And i have written a samble db connectivity script. It does not display anything in the browser. Just a blank page appears. My php script is below:


      ?php
      // The pear base directory must be in your include_path
      echo require_once 'DB.php';
      require_once 'DB.php';
      $user = 'sailaja';
      $pass = 'google';
      $host = 'localhost';
      $db_name = 'login_test';

      // Data Source Name: This is the universal connection string
      $dsn = "mysql://$user:$pass@$host/$db_name";

      // DB::connect will return a Pear DB object on success
      // or a Pear DB Error object on error
      // You can also set to TRUE the second param
      // if you want a persistent connection:
      // $db = DB::connect($dsn, true);
      $db = DB::connect($dsn);
      // With DB::isError you can differentiate between an error or
      // a valid connection.
      if (DB::isError($db)) {
      die ($db->getMessage());
      }
      // Once you have a valid DB object

      $sql = "select * from login_app";
      // If the query is a "SELECT", $db->query will return
      // a DB Result object on success.
      // Else it simply will return a DB_OK
      // On failure it will return a DB Error object.
      $result = $db->query($sql)


        just a blank page

        this is a a good sign,
        means were no errors!

        it is blank because you have no 'echo'
        nothing written to screen, in your script

        you can add as a last line:

        echo 'result: '.$result;
        
        // or maybe better - will display array $result
        print_r( $result );
        

          I am getting the following error:
          1DB Error: insufficient permissions

            you might have to use phpMyAdmin
            to check and change permissions for $user = 'sailaja';

            just because a user can connect
            does not always mean a user can access data from a db_name

              i am getting the following error now.

              1db_error Object ( [error_message_prefix] => [mode] => 1 [level] => 1024

               => -18 [message] => DB Error: no such table [userinfo] => select * from login_app [nativecode=1146 ** Table 'login.login_app' doesn't exist] [backtrace] => Array ( [0] => Array ( [file] => /usr/share/pear/DB.php [line] => 748 [function] => pear_error [class] => db_error [type] => ->  [args] => Array ( [0] => DB Error: no such table [1] => -18 [2] => 1 [3] => 1024 [4] => select * from login_app [nativecode=1146 ** Table 'login.login_app' doesn't exist] ) ) [1] => Array ( [file] => /usr/share/pear/PEAR.php [line] => 536 [function] => db_error [class] => db_error [type] => ->  [args] => Array ( [0] => -18 [1] => 1 [2] => 1024 [3] => select * from login_app [nativecode=1146 ** Table 'login.login_app' doesn't exist] ) ) [2] => Array ( [file] => /usr/share/pear/DB/common.php [line] => 500 [function] => raiseerror [class] => pear [type] => :: [args] => Array ( [0] => [1] => -18 [2] => [3] => [4] => select * from login_app [nativecode=1146 ** Table 'login.login_app' doesn't exist] [5] => DB_Error [6] => 1 ) ) [3] => Array ( [file] => /usr/share/pear/DB/mysql.php [line] => 775 [function] => raiseerror [class] => db_mysql [type] => ->  [args] => Array ( [0] => -18 [1] => [2] => [3] => [4] => 1146 ** Table 'login.login_app' doesn't exist ) ) [4] => Array ( [file] => /usr/share/pear/DB/mysql.php [line] => 227 [function] => mysqlraiseerror [class] => db_mysql [type] => ->  [args] => Array ( ) ) [5] => Array ( [file] => /usr/share/pear/DB/common.php [line] => 1144 [function] => simplequery [class] => db_mysql [type] => ->  [args] => Array ( [0] => select * from login_app ) ) [6] => Array ( [file] => /var/www/html/pear/sailu.php [line] => 32 [function] => query [class] => db_mysql [type] => ->  [args] => Array ( [0] => select * from login_app ) ) ) [callback] => ) .... // You can disconnect from the database with: $db->disconnect(); ?>

                my mistake i gacve the database name wrong
                its getting me the results. Thanks for your help.
                It was precious

                  Write a Reply...