Installing PEAR on Godaddy shared accounts

I recently found out how to install PEAR on a Godaddy shared hosting account.

  1. Visit http://pear.php.net/go-pear. Save the text displayed onto your desktop and name it go-pear.php. Upload this to your server. If you’re hosting multiple domains on the account, it’s best that you should upload this file in your root folder. Run this file on your browser and follow the on-screen instructions.
  2. After completing the installation, it is time to edit your php.ini file. If you are running PHP4, there should be a file in the root directory called php.ini. If you are running PHP5, there should be a file in the root directory called php5.ini. If not, create one and add the following: include_path = “.:/usr/local/php5/lib/php:/home/content/s/a/m/sample/html/PEAR”. Keep in mind that /s/a/m/sample is just an example. Doing this will ensure that every page, you create, will look in the PEAR directory so that you it will use the installed packages.
  3. This installation will include Pear_Frontend_Web which is the web-based admin interface. It may have created an index.php file in the directory where PEAR is installed (root). If not you can get a copy from PEAR/docs/PEAR_Frontend_Web/docs/index.php.txt. I would suggest creating a folder called pear_admin in the root directory and storing this file there. If you didn’t install PEAR in the root directory, you may need to edit this file accordingly.
  4. You will need to create a .htaccess and .htpasswd file in the same directory as the index.php file. An example of how the .htaccess file should look as follows:
    AuthUserFile /home/content/s/a/m/sample/html/pear_admin/.htpasswd
    AuthType Basic
    AuthName “Web-based PEAR Frontend”
    Require valid-user

    An example of how the .htpasswd file should look as follows:


    admin:cGyUX9QugYMgE

    This will create “admin” as the user name and “password” as the password. You can generate your own by going to this link – http://www.htaccesstools.com/htpasswd-generator/

    Be aware that files beginning with a dot are invisible. You may have to edit your settings on the FTP app you’re using so that you can see them.

Once the files are created and saved, you can now go to http://your-domain.com/pear_admin/index.php. It will ask for the user name and password. Once you are logged in, you can now manage Pear via web browser. That’s it! Now you can run PEAR on a shared account from Godaddy. One less complaint :)

  • Share/Bookmark

31 Responses to “Installing PEAR on Godaddy shared accounts”

  • I have been trying to figure this out for the last three weeks. I got lucky with your simple explanation.

    P.S. With php4 installed you can use — include “DB.php”; because PEAR is installed on the godaddy PHP4 installs. But I couldn’t figure out how to use PEAR with PHP5. I think godaddy is trying to get us to upgrade :)

    Thanks for saving the world one star-fish at a time. You made a difference in my life!

  • thanks for the comment. i have been trying to figure this out for a while too. once i figured it out, i thought i’d share since i know there are other people probably experiencing the same problem. thanks for the PHP4 tip. i just added the include step just to make sure it checks the directory.

    BTW, nice Flash layout on that page.

  • Sam:

    Thank you so much for this great post! You saved me in a huge way! After upgrading to PHP5 on godaddy, I lost all of my pear functionality. I am back up and running now and my stress level has dropped.

  • noob:

    Hi, I followed your steps to fix my pear installation. However, on the web-frontend package manager, none of the images are being displayed. The links work, but the broken image link blue question mark is all that I see. Do you have any idea how to fix that?

    Thanks

  • i no longer have godaddy as a host but if pear works and the images aren’t showing properly, my guess is it either installed pear on a different folder than the default setup or the variable on the cofig file that holds the value of the pear directory needs to be updated. hope that helps.

  • I too experienced the woes of losing the pre-installed PEAR package with Godaddy PHP4. As soon as I upgraded to PHP5 the PEAR functions stopped working. Your instructions definitely got me on the right track. I had a hard time finding help or documentation on my problem, though I found lots of people seeking help, so here are the few things I noticed with my experience, in case it helps others:
    1. PEAR tries to create the index.php web admin file in the hosting root directory, where I happen to already have index.php as my website homepage. That caused a few issues and I had to reload my original index.php and reinstall PEAR again and specify a new file name for the pear admin file.
    2. These instructions are just core for installing PEAR. I, like a majority of those using PEAR, was trying to get PEAR Mail to work. I went to “install new packages” in the pear admin and installed “mail” and “net-smtp” and I’m back in business.
    2. My code still was not locating Mail.php, even though I updated the php5.ini file exactly as above. After tinkering for a while, I finally got it to work after removing the full path, and removing all of the quotes. Below is what works.

    include_path = .:/usr/local/php5/lib/php:./PEAR

  • thanks for sharing your experiences

  • Thank you ! Great instructions and insight.

    I wish Godaddy could provide as much help for their service !

  • Thank you, thank you, thank you. I was lost for a day and a half until I stumbled on your blog post.

    The thing that amazes me is how easy it was to do this but that the documentation on the pear site does nothing but make you get lost.

    You call godaddy and they aren’t any help either it’s almost like no one has ever asked this question of them.

    It is very important that you set up the installation so that the index.php will install in the pear_admin folder which you will have to create in godaddy first or the installation of pear will overwrite your existing index.php file.

  • One more note. Creating a .htaccess and .htpasswd wouldn’t work for me but an easy work around was to set a password protection in the go-daddy file manager.

  • ya most of the pear libraries i used don’t have good documentation or examples – which is unfortunate because they are helpful to me. godaddy has pretty bad tech support unless you have their dedicated server plans. but even then, they aren’t up to par compared to other hosting services.

    glad this helps you.

  • Thank you! You sharing this knowledge is what makes the web and humanity so great.

    The .htaccess file you have didn’t work for me, I got an “Internal Server Error”. This .htaccess did work, however:

    AuthName “mydomain.com pear_admin”
    require valid-user
    AuthUserFile /home/content/s/a/m/sample/html/pear_admin/.htpasswd
    AuthGroupFile /dev/null
    AuthType Basic

  • it’s all about sharing, thanks rob

  • Steve Ward:

    Good, simple instructions. Thanks.

    I too was getting “Internal Server Error” with .htaccess. Tried Rob Bednark’s suggestion above, but still getting the same error.

    Then I changed the line:

    AuthName “mydomain.com pear_admin”

    to

    AuthName mydomain.com/pear_admin

    Everything’s fine now.

    Thanks All.

  • This article, while helpful, really confused me for a bit because some of the directions are for Linux Hosting only, and I have a Windows Hosting account.

    If you have a Windows shared hosting account, you have to password protect the directory via the GoDaddy file manager as Windows Hosting Accounts don’t follow the .htaccess file. The GoDaddy F.A.Q. on how to do this is located here…

    http://help.godaddy.com/article/3977

    Also, the /home/content/s/a/m/sample/html/PEAR path is for Linux only as well. On the Windows hosting accounts, you can use the physical path instead I believe. It will give you the physical path at the bottom of the go-pear.php when you first install pear, just change the php.ini to use that.

    ex:

    include_path = “.:/usr/local/php5/lib/php:D:\Hosting00000\html\PEAR”

  • thanks for sharing tips for Windows users

  • Brooks:

    Special thanks to Jason’s entry (Sep 16, 2008), which points out the additional steps for adding Mail support for Pear. Here are a couple of more tips you might find helpful:
    (note: this is relative to a GoDaddy shared server config)

    1) The names of the PEAR mail modules that you enter in the Pear Admin under
    “Quick-install a package” are:

    mail (this installs general mail support inc. net-smtp)
    mail_mime (installs Mime/multi-part email support)

    These end up installed in /PEAR/Mail.php and /PEAR/Mail/mime.php

    2) Make sure to include one or both of the files listed above as needed:
    example:

    require_once (“Mail.php”);
    require_once (‘Mail/mime.php’); # required for the Mail_Mime class

    3) The includes listed above will only work if your php.ini is configured correctly (as shown in several of the other posts above)

    I like to keep my PHP path modification local to my files rather than in the php.ini. Here are the lines necessary to do that – put them before the mail includes in your php files:

    $path = ‘/home/content/s/a/m/sample/html/PEAR’;
    set_include_path(get_include_path() . PATH_SEPARATOR . $path);

  • Mark:

    When I cut and pasted that text for step 2:

    include_path = “.:/usr/local/php5/lib/php:/home/content/s/a/m/sample/html/PEAR”

    … and replaced it with my PEAR folder, PHP could not find PEAR. When I replaced the quotes “ and ” both with “, it worked. It seems PHP does not like left quote or right quote, but only a generic quote.

  • hi
    your article is really nice
    include_path = “.:/usr/local/php5/lib/php:/home/content/f/e/n/gt/html/PEAR”
    is ncessary
    ya we can only write
    include_path = “/home/content/f/e/n/gt/html/PEAR”

  • sir
    acctualy i am installin pear for ilias
    sir can you help how can install ilias
    plz help see error
    http://www.gradtrain.com/lms

  • jon:

    Careful, if you install the web front end and you are on the root fo the site and you already have a working site with a homepage, the front end will wipe out your homepage. I didn’t know that, luckily there was a backup there.

  • Eddie:

    READ Mark’s up about 4 posts!!!

    Dear GOD I spent all day wrestling this, and that ‘directional quote’ problem was all I was having!! Delete those quotes in your text editor and replace them with the generics!!

  • thanks Eddie, i’ve edited it. hope that fixes the problem next time someone copy and pastes from his comment

  • Thanks for this tutorial – got me 99% of the way there.

    Just wanted to point out that when I opened my brand new PHP5 account, the file which was created was php.ini and I couldn’t get PEAR to work, despite updating it.

    I had to rename php.ini to php5.ini and then it worked beautifully.

    If I’d read more carefully I’d probably have gotten the answer here but wanted to add an answer for skim-readers like me.

  • I just pulled up the pear-go.php file in my browser and got a ton of errors. Any help on those? Do I need to post what they are or can I post the site here so someone can see it?

  • [...] Installing PEAR on shared GoDaddy server, thanks to Abby and Win’s Blog [...]

  • Andrij Demianczuk:

    Thank you VERY much! This tut was amazing, and helped me out more than you can imagine! My godaddy hosting was transferred to a linux shared host. Since I came from a windows server, neither of the php.ini or .htaccess files existed (I cleared my root directory prior to the migration). Incidentally, I also didn’t have a PEAR install and all my scripts were failing. With this tut, I was up and running within 10 minutes! My eternal gratitude goes out to you guys.

  • curt:

    You just saved me a bunch of time!! Thank you for documenting this procedure. Go Daddy web help is terrible.

  • I have 100 domains on Godaddy and i can say that this company is very reputable.”,~

  • Have anyone recently used the MAIL function of PEAR on godaddy’s shared hosting?

    I am trying to get PEAR to work and the support guys are driving me nuts.

    could anyone please help !!!!

    Regards.

  • Thanks for sharing! I’m good to go.

Leave a Reply

Categories