Abby and Win's Blog

Our Blog 2 Share 4 All

Installing PEAR on Godaddy shared accounts

| 53 Comments

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 :)

53 Comments

  1. 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!

  2. 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.

  3. 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.

  4. 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

  5. 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.

  6. 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

  7. thanks for sharing your experiences

  8. Thank you ! Great instructions and insight.

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

  9. 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.

  10. 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.

  11. 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.

  12. 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

  13. it’s all about sharing, thanks rob

  14. 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.

  15. 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”

  16. 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);

  17. 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.

  18. 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”

  19. 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

  20. 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.

  21. 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!!

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

  23. 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.

  24. 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?

  25. Pingback: 6Flex » Blog Archive » Creating a mashup

  26. 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.

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

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

  29. 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.

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

  31. Apparently GoDaddy includes PEAR pre-installed with PHP 4, but it does not come preconfigured if you are set up with PHP5. I asked them for information regarding this, and they told me to search Google.

    Thanks so much for this tutorial, it cut my server-switch time down to minimal. The notes helped as well, thanks! My hosting came with “php.ini” where it was supposed to be php5.ini. Other than that, go-pear took care of everything.

  32. I was able to secure PEAR with .htaccess and .htpasswd , and I installed the Mail package.
    I have the php5.ini in my root folder and my php is able to find php5.ini but it can’t find Mail.php
    It says no such file or directory exists

    I used require_once “Mail.php”; in my php

    Is there anyone who knows how to solve this problem?

    Could it be the path in my php5.ini ?
    include_path = .:/usr/local/php5/lib/php:/home/content/95/5788191/html/mywebsite/pear_admin/PEAR
    I tried quotes as well.

    Or is it because it simply can’t access the mail.php file ?
    After all, I secured it with a password and a username.
    Any idea on how to solve this problem?
    Thank you.

  33. I’ve been doing some tests but it’s still not working. I keep getting the following error :
    No such file or directory in /home/content/95/5788191/html/mywebsite/form.php
    form.php is the php code used by my contact page.

    Either I installed the package wrong (simple click of a button, right? The files are all there on my server) or my path in php5.ini is wrong.

    Any idea?

  34. I’m AM grateful of this Post by sherwin… but doing this took me literally all day to get working (left-right quote marks, the need to install other packages to stop getting the frustrating include error, et al.)

    AND I’m STILL scratching my head about the pearfrontendweb.php file.

    What is the point in password protecting this pear_admin folder if anyone can still access the pearfrontpageweb.php file. Do I just delete that now?

    Thanks for everyone’s very helpful posts!

    Things that really helped me if you are still having problems:

    1. You must install packages on top of PEAR if you are getting an error looking for Mail.php. You need mail and net_smtp installed (typing those two into the quick install in pear should work) and possibly mime too (all mentioned above)

    2. Sound silly but make sure you have the right settings for outgoing mail… test them in a straightforward mail client. Username, passport, port etc.

    3. Make sure the quote marks (speech marks, whatever) are just plain ones from your keyboard. The given include line uses left and right one’s which don’t work. I ended up using Jason’s:

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

    which works.

    4. If you are using PHP5 you MAKE a php5.ini file. Forget the php.ini that’s in your directory already! Simple text file with this in it:

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

    save as php5.ini

    If anyone can help with my password issue I’d be very grateful

    Chris

  35. aaaah. and in answer to my own question it looks like you just change the permissions on the PEAR folder to 700 (owner can read/write/execute, no-one else can).

    Don’t hold me to that, but it’s working for me so I thought I’d share

    Chris

  36. I recently switched our site to PHP Version 5.2.14 and have followed all of the instructions here to get PEAR running (I have it running locally on two testing servers) but when I try to access the index page inside the pear_admin folder, after submitting the username and password data for the .htaccess/.htpasswd files, I get this error message:

    Fatal error: No PEAR.php in supplied PEAR directory: @pear_dir@ in /home/content/S/a/m/Sample123/html/pear_admin/index.php on line 24

    When I try to access the pearfrontendweb.php directly, I get this message:
    Error:

    the template directory (/usr/local/php5/lib/php/data/PEAR_Frontend_Web/data/templates) is not a directory, or not readable. Make sure the ‘data_dir’ of your config file (/usr/local/php5/lib/php/data) points to the correct location !

    I noticed that a pear.conf file which contains path information was installed in my root directory. I moved that to my pear_admin folder with the index.php page.

    NOTE: I’ve also set permissions to the PEAR folder so that owner has read/write/execute permissions

    So I’m wondering how to get this working as I want to implement RSS feeds and the PEAR Mail object on my websites. Any help will be greatly appreciated!

    thanks
    mark

  37. I wasn’t able to get the htaccess file to work but I figured out why:
    If you copy and paste the htaccess contents in this post, delete the “quotes” and retype them in. They weren’t showing up as real quotes in my file, just characters that looked like quotes.

  38. I was having the same problem as you and was waiting for someone to reply. But I figured it out.
    Set the $pear_dir variable to where your PEAR folder is(the default location didn’t work for me):
    $pear_dir = /home/content/S/a/html/PEAR

    Then accommodate the rest of your code accordingly. This is what my index.php file looks like:

    I hope this helps…

  39. Thanks so much Shawn! That got it to work – I was putting in the full path in place of the @pear_dir@ on line 8 of the index.php in the pear_admin folder:

    ‘.:/usr/local/php5/lib/php:/home/content/s/a/m/sample/html/PEAR’

    all that is needed is:

    ‘/home/content/s/a/m/sample/html/PEAR’

    I hope this helps others reading this blog!

    enthusiastically,
    mark h

  40. Hi guys, your post is so very helpful in installing and configuring PEAR.

    I’ve got PEAR running on my godaddy.com shared hosting, and also the Mail module. But when I tried to send a mail through my gmail account, its returning the error status:
    “Failed to connect to ssl://smtp.gmail.com:465 [SMTP: Failed to connect socket: Connection refused (code: -1, response: )]”

    Then I figured out that its a problem if openssl is not present. But then, godaddy has already got openssl installed but still I’m getting this error. Anyhelp would be really helpful.

    Regards,
    LoGiX

  41. Hi, I’m getting a 401 Authorization Required error. (The server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn’t understand how to supply the credentials required.)

    For testing purposes, I put in the user and password that is being used on this site, but authorization keeps failing. Anyone have any ideas?

  42. I tried to install go-pear.php on a shared godaddy hosting account but got the following error:
    “Sorry! Your PHP version is too new (5.2.17) for this go-pear. Instead use http://pear.php.net/go-pear.phar for a more stable and current version of go-pear, more suited to your PHP version.”

    Anyone have an idea what to do with the ‘go-pear.phar’ file? I can’t just rename it and run it as a php file.

    Any help would be appreciated.

    Thanks,
    WSG

  43. I wanted to say thank you to everyone. I know there were a few hiccups along the way, but through everyone’s responses I was able to get it to work.

    Going to the http://www.htaccesstools.com/htpasswd-generator/ site to generate my .htpasswd content saved the day. (Rob you may want to try that if you haven’t got it working yet.)

  44. The instructions works only if you have a linux hosting with godaddy and not with Windows hosting. Pear gets downloaded but when it comes to execution, it is not possible to give permissions to the folders created.

    Alok

  45. Well, after reading through all the posts and not getting any of this to run, referred to Jonathan’s Post #10 and made sure the path pointed to my pear_admin folder on the go-pear setup screen. Apparently, the .conf file in my root directory was not pointing to the correct folder and causing a server 500 error – or so I think. I did several installs with different fold options and no wonder I had paths pointing left/right/up/down… no wonder it did not work.

    Once I reinstalled and followed the rest of the setup procedures, probably with the help of all other fixes posted, I finally got mine to run as promised.

    :) I am happy. Thanks to all who took the time to help everyone else.

    George

  46. GOT AN ERROR, HERE ARE THE DETAILS:

    Starting installation …
    Loading zlib: ok

    Bootstrapping Installer……………….
    Bootstrapping PEAR.php…………(remote) “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>

    An Exception Has Occurred
    Unknown location: /pear/pear-core/branches/PEAR_1_4/PEAR.php

    HTTP Response Status
    404 Not Found

    ——————————————————————————–

    ok
    Bootstrapping Archive/Tar.php…………(remote)
    Fatal error: Class ‘PEAR’ not found in /home/content/60/7604660/html/temp/Archive/Tar.php on line 57

  47. Thanks for the tutorial, if some body creates the video tutorial it will be very useful to the new bies like me.

    Got the same error of Zeeshan, while installing
    http://pear.php.net/go-pear after 20% it has strucked with error

    Starting installation …
    Loading zlib: ok

    Bootstrapping Installer……………….
    Bootstrapping PEAR.php…………(remote) “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>

    An Exception Has Occurred

    Unknown location: /pear/pear-

    HTTP Response Status

    404 Not Found

    ok
    Bootstrapping Archive/Tar.php…………(remote) “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>

    An Exception Has Occurred

    Unknown location: /pear/packages/Archive_Tar/tags/A

    HTTP Response Status

    404 Not Found

    ok
    Bootstrapping Console/Getopt.php…………(remote)
    An Exception Has Occurred

    Unknown location: /pear/pear-
    HTTP Response Status

    404 Not Found

    ok
    Fatal error: Class ‘PEAR’ not found in /home/content/26/8073326/html/go-pear.php on line 696

    Any solution please.

    • I guess this is because php doesn’t use svn anymore, but github. Pear installer still uses svn addresses and they are empty directories now. If anyone can find a solution, I will be glad too.

  48. I’m running a couple domains on GoDaddy shared hosting and I just completed the install of PEAR. This blog was a tremendous help!

    I have multiple domains being hosted off this one account and right now only my main domain can access the PEAR modules.

    If one of the other domains tries to access it I get a :
    “Warning: include(Mail.php) [function.include]: failed to open stream: No such file or directory in /home/content/11/9025222/html/domaincom/filename.php on line 28″

    Does anybody know how to get PEAR working with all of the domains on your hosting account?

  49. Greetings, I am writing from Caloundra, Australia. Thanks so much for the great post. It helped me a lot with my TAFE computing research :)

Leave a Reply