Contrary to the instructions provided on the official PHP website, there are a few extra steps that you need to make in order to setup PEAR on your hosting provider’s systems if they don’t have it installed already. First, you’ll need to download the go-pear.php file and then make the following changes to lines 116-119 of the code:
'PEAR5.php' => 'https://raw.github.com/pear/pear-core/master/PEAR5.php',
'PEAR.php' => 'https://raw.github.com/pear/pear-core/master/PEAR.php',
'Archive/Tar.php' => 'https://raw.github.com/pear/Archive_Tar/master/Archive/Tar.php',
'Console/Getopt.php' => 'https://raw.github.com/pear/Console_Getopt/trunk/Console/Getopt.php',
'PEAR5.php' => 'https://raw.githubusercontent.com/pear/pear-core/master/PEAR5.php',
'PEAR.php' => 'https://raw.githubusercontent.com/pear/pear-core/master/PEAR.php',
'Archive/Tar.php' => 'https://raw.githubusercontent.com/pear/Archive_Tar/master/Archive/Tar.php',
'Console/Getopt.php' => 'https://raw.githubusercontent.com/pear/Console_Getopt/master/Console/Getopt.php',
Basically, you need to change github to githubusercontent on all 4 lines and on the fourth line, change trunk to master. Upload the go-pear.php file to your hosting account and in a browser, execute it by typing in the URL (e.g. http://www.mydomainname.com/go-pear.php). You should get a screen like the one below.
You can safely ignore the ereg() function deprecation error if you get it. Click on the Next >> link.
The Installation prefix should be an absolute path to the directory where go-pear.php was uploaded. You also might need to change line 11 and ask your hosting provider what value to enter because for me, it was not pointing to the correct directory where PHP was installed. It was pointing to my hosting space which is on another drive. You can leave the other values at their default settings or modify them accordingly to your needs. Click on the Install button when you’re ready to begin.
You’ll get an Installation in progress screen, and all you can do is grab a cup of your favorite drink while you wait. It does take a few minutes.
After waiting a bit, you should get an installation completed screen like the one above. Pay attention to the Note as you will need to add that to your include_path in either the php.ini or .user.ini file so that your code can find the PEAR files. If you click on the Start Web Frontend of the PEAR Installer >> link, it probably won’t work. There is one more step to be performed in order to get PEAR (or at least the management console) working correctly. There should be a pear.conf file in the directory where you uploaded go-pear.php. Make a copy of that file and name it pear.ini, or you can just rename it. I recommend copying it though since that makes the original a backup. Now, load the index.php file in your browser, and you should get a screen like this.
That’s it. PEAR is now installed and ready to be used. If you need to make more configuration changes, please consult the PEAR FAQ and Manual.