Sometimes we use to get an error like ‘Pear DB class not found’ while running some scripts that uses PEAR to connect to the database.

Why this error is thrown?

This is because the DB for PEAR is not installed.

How to fix this error?
Step 1) If your are using windows, then
Step 2) Go to start, click on RUN
Step 3) Type cmd
Step 4) cd C:\xampp\xampp\php {Change Directory To The Install Root Of XAMPP}
Step 5) Run this ‘pear install DB’ , YOU SHOULD GET SOME OUTPUT LIKE THIS

C:\xampp\xampp\php>pear install DB
WARNING: "pear/DB" is deprecated in favor of "pear/MDB2"
WARNING: channel "" has updated its protocols, use "pear channel-upd
ate" to update
Package "PEAR" Version "1.9.2" does not have REST xml available
downloading DB-1.7.13.tgz ...
Starting to download DB-1.7.13.tgz (132,246 bytes)
.............................done: 132,246 bytes
install ok: channel://

Ignore the warnings. Now run your script. It will be executed successfully.

Leave a Reply

Your email address will not be published. Required fields are marked *