1and1.com – php.ini and htaccess customization

I host my website with 1and1.com, and can honestly say I recommend them to others, too. They provide a great deal of resources at a very reasonable price and have reasonably good service on the occasions I’ve needed it.   Perhaps because I don’t expect much from a low cost hosting entity is also why I think their service is fine, too.  It may also be said that I wouldn’t recommend them because of their service – that’s certainly true, too.

They provide a great Linux/Apache/mySQL/PHP setup and allow you to have private domains through their registrar for no additional costs.  Private domains save you against an onslaught of a ton of spam and unwanted phone calls as your registration remains one hidden behind this 1and1 proxy account.

There are a couple of oddities with any hosting provider to overcome and here’s what I have learned about 1and1 and the tools I use to make development easier.  First off, php 5 is not enabled automatically.  In order to have php 5 be the default for the website, you’ll need to add the following line to an htaccess file —

AddType x-mapp-php5 .php

If you are running Joomla!, and wish to use the built in SEO mod_rewrite features, be sure to also set the RewriteBase flag to the root directory —

RewriteBase /

The controls over php values, like with many shared hosts, are controlled via a php.ini file that you may upload to your root directory.  However, with 1and1, there are some less than   traditional settings and you must also place a php.ini file in each directory on the website that php files are used.  If you’ve just started using 1and1 for the first time, figuring all of this out can be challenging.

Download the ini_help.zip files here To easily install a php.ini file everywhere in the website’s code, I use the script phpcopy.php that you’ll find in the archive.  If you need to delete files, you can use the phpdelete.php script.  You will need to insert the full path of where this script lives on the server within the file before you upload it.  I’ve also included a copy of the php.ini file I use.  It will also need the full server path added to it for the tmp directory line.

If you need to determine the full server path, you can do so with a php info script and look under the environment section. Alternatively, you could login via SSH and navigate to the web directory you wish to use and enter “pwd” to see the full path.