1and1.com, as I said before, is a great host. Their support may not be able to tell you how to do everything you want to do, but for the most part, they give you full access. If they offer a Free server for three years deal again, snatch it up. You’ll save loads of money and may be offered an upgrade to a professional server for half price as I was.
A couple weeks ago, I told Michael (who paired with Angela has done some neat stuff – I’m gonna have to free up an hour to just browse through their site and listen to the Taiwanese Education Ministry stuff they have there and at http://metroministries.org/ ) that I would post a walk through of installing custom modules for PHP PEAR. PEAR is “custom framework for PHP Components”. In otherwords, PEAR is a HUGE common library of PHP code that will give you access to a wealth of resources you don’t have in the standard installs of PHP. If you want to do something easy or complex, there’s a good chance that there is a pear module that will help you out. Whether it is simply getting the date of a certain holiday, caching a news feed, rotating 3d objects for your visitors, streaming data to them or any of a large number of other tasks, chances are, there is a PEAR module that can give you a head start on your project. Here, take a look: http://pear.php.net/packages.php
Obviously, not all of those modules are installed under the default 1and1 PEAR account and there might be one there that you want but is not available by default. This article tells you how to get one of those modules installed. Fortunately, it’s not that complicated. Really the trick to installing custom PEAR modules at 1 and 1 is as simple as knowing how they are classifed in the PEAR documentation. See 1and1 has PEAR installed, but it is locked down so that you can’t break anything for all of the people that share your webserver. PEAR has planned for this and allows you to install a custom configuration for your particular webserver. This PEAR configuration will be the default for ALL of the server’s you host and will not affect anyone elses. PEAR calls that a “SHARED HOST” and once you have that term, you can follow the documentation here: http://pear.php.net/manual/en/installation.shared.php.
To customize all of that for 1and1, you have to put it in their directory structure. The 1and1 directory structure has two seperat number. First a two (or now maybe three) digit number which indicates the server or server farm you belong to (that’s a guess, but I think it makes sense). The second indicates your contract ID. This is not to be confused with your user ID which is the number that is shared by all of your email addresses and ftp logins. So, the directory structure looks something like this:
/kunden/homepages/10/d55555555/htdocs/ where 10 is the number I am guessing is the server farm and d55555555 is your contract ID. If you keep this in mind when reading through the document, you’ll be able to figure most of it out.
I don’t have time for the full blow by blow walk through with screenshots that I usually do, but hopefully, a quick run through will be all you need and then you can ask any questions you might have in the comments.
So your first task is to get putty.
That’s this PuTTY:
Not this putty:
Just download it from here: http://www.chiark.greenend.org.uk/~sgtatham/putty/ and install.
Setup an account to log into your site. It is straight forward, if you have difficulties. Please take a break and read the help docs on it and decided if you really want to take on custom pear modules without further reading and studying. Perhaps there is an easier way to do what you want to do.
Once you have putty installed (BTW does anyone have XWindows working through PuTTY for 1and1.com yet? I’ve wanted to try it but haven’t had the time yet…) login using your user number and main password (u35555555 or something like that not your contract ID)
Once you are logged you’ll be at a prompt that looks like this:
Now ask pear what it’s current configuration is:
u35555555:~ > pear config-show
You’ll see that everything (Bin_dir, doc_dir and etc) is using common directory. That’s probably something like this: /usr/local/bin/php
What you need to do is create a custom config file into which you can install all of the modules you use but are not provided by default. In this case, we will be installing the HTTP_Request extension so that we can do some custom page grabbing and XSF attacks (JUST KIDDING!!!).
So, the first thing to do is create the config file in your root directory:
u35555555:~ > pear config-create /homepages/10/d55555555/htdocs/ .pearrc
Now tell the common pear module to create a copy of its directory structure for you to use…
u35555555:~ > pear install -o PEAR
Would you like to see what we’ve done?
u35555555:~ > cat .pearrc
You’ll get something that looks like this:
And that’s pretty much it! You’re installed. You can, if you want, see if a specific module is installed with a command like:
u35555555:~ > pear list-files HTTP
u35555555:~ > pear search HTTP_Request
You can try to install things:
u35555555:~ > pear install HTTP_Request
But you may find that other modules are required. So you must install them too
u35555555:~ > pear install Net_URL
However, the EASIEST thing to do is to have PEAR install all fo the modules you need automatically with the –alldependency swithc
u35555555:~ > pear install HTTP_Request –alldeps
That’s it! Your all installed.
Here is one final helpful command: config-show. If you (and I) did everything right, you should get something like the following:
u35555555:~ > pear config-show
Configuration (channel pear.php.net):
Auto-discover new Channels auto_discover
Default Channel default_channel pear.php.net
HTTP Proxy Server Address http_proxy
PEAR server [DEPRECATED] master_server pear.php.net
Default Channel Mirror preferred_mirror pear.php.net
Remote Configuration File remote_config
PEAR executables directory bin_dir /homepages/10/d55555555/htdocs/pear
PEAR documentation directory doc_dir /homepages/10/d55555555/htdocs/pear/docs
PHP extension directory ext_dir /homepages/10/d55555555/htdocs/pear/ext
PEAR directory php_dir /homepages/10/d55555555/htdocs/pear/php
PEAR Installer cache directory cache_dir /homepages/10/d55555555/htdocs/pear/cache
PEAR data directory data_dir /homepages/10/d55555555/htdocs/pear/data
PHP CLI/CGI binary php_bin /usr/local/bin/php
PEAR test directory test_dir /homepages/10/d55555555/htdocs/pear/tests
Cache TimeToLive cache_ttl 3600
Preferred Package State preferred_state stable
Unix file mask umask 22
Debug Log Level verbose 1
PEAR password (for password
Signature Handling Program sig_bin /usr/bin/gpg
Signature Key Directory sig_keydir /usr/local/etc/pearkeys
Signature Key Id sig_keyid
Package Signature Type sig_type gpg
PEAR username (for username
User Configuration File Filename /kunden/homepages/10/d55555555/htdocs/.pearrc
System Configuration File Filename /usr/local/etc/pear.conf
(Please let me know if this post works for you or if there are mistakes I need to corred. This was all recovered from the bash log, so I could have miss read a step along the way – Thanks! Brian.)