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.

20 thoughts on “1and1.com – php.ini and htaccess customization

  • June 27, 2012 at 2:59 AM
    Permalink

    Thank you very much, this saved me a ton of time!

    I assume the phpcopy.php and phpdelete.php scripts need to be removed from the server once they have done their job?

    Thanks again!

    Reply
    • June 27, 2012 at 8:02 AM
      Permalink

      Actually, you could leave it in place as all it will do is copy the same file over again or delete the same file over again. However, I tend to just change the permissions on the file to be 000 so that it’s there should I need to update the php.ini file in the future.

      Glad to know this saved you time, too.

      Reply
  • August 21, 2013 at 2:19 AM
    Permalink

    thanks very much for your script!!!!
    dont know why 1&1 doesnt leave us to do this recursive to all folders with an .htaccess

    Reply
  • March 13, 2014 at 9:03 AM
    Permalink

    Hello! This is very usefull but I’m still having problems to figure out which one is the correct tmp path for php. Could it be the same as joomla tmp in joomla root?

    Thanks!

    Reply
    • March 13, 2014 at 9:43 AM
      Permalink

      It’s ok now, I’ve found out that is a directory living among the logs and the joomla installation folder. Thanks!

      Reply
  • December 25, 2014 at 4:05 AM
    Permalink

    Can you help? Your script is not downloading as comes the message 403-Forbidden.

    Reply
    • December 27, 2014 at 1:33 PM
      Permalink

      Hmmm… Interesting! Thanks for letting me know, I’ll take a look and get back to you!

      Reply
  • December 27, 2014 at 1:36 PM
    Permalink

    Ahhh — Fixed! Thanks. The file name include “php” which is now being filtered for by a security plugin to prevent php based scripts from running in the WordPress content directory. I’ve updated the name of the file accordingly and all is working.

    Thanks again for letting me know!

    Reply
  • April 13, 2015 at 12:29 AM
    Permalink

    I recently setup a domain on 1&1, never used them previously but found that I was having problems with a new shopping cart development due to incorrect PHP.INI setup. Their support team stated that I can upload my own PHP.INI file to the route directory.

    Modifying your PHP.INI file slightly and adding output_buffering = 4096 which was set to “0”. Uploaded the PHP.INI file to the 1&1 domain and it worked perfectly. Thank you for the sample file, really helpful.

    Now I know that this facility is available in 1&1, I am impressed with this setup, as the control is now in my hands.

    Thank you for your information

    Reply
    • April 13, 2015 at 8:56 AM
      Permalink

      I’m glad it worked well for you, too. Thanks for the feedback and details about how you used it — hopefully this will also help some others out there.

      Reply
  • June 12, 2015 at 3:17 PM
    Permalink

    I am a newbie blogger. I wanted to install a new theme to my WordPress.org blog that I self host on 1and1.com. I keep getting an error saying that the maximum upload size in php.ini has been exceeded so the theme wont install. I have tried to edit the php.ini on all directories using Filezilla but I keep getting the same error. I am very overwhelmed by all this because I am a total newbie at this. Can you please help with detailed step by step instructions? 1and1.com says users cannot override their php.ini settings. I live in Asia and cannot really call them a lot. I would be really grateful for help with the maximum upload settings on php.ini or .htaccess.

    Reply
    • June 12, 2015 at 4:37 PM
      Permalink

      Sifar —

      I can try to help you a bit here, but this may not be something that fits with comments on a blog. I’ll try though.

      First of all, have you tried to install the theme using the “manual” upload path via FTP? If you trying to upload the them via the browser or using the native installer, that may fail. It sounds like you are not upload the template to a “local” directory on the server. See the section about adding via FTP here –> http://codex.wordpress.org/Using_Themes#Adding_New_Themes

      To (try) to increase your upload limit, you should do the following. I say “try” because 1and1 could block this.

      1. Create a text file named “php.ini” and upload it to the root directory of your WordPress site.
      2. These two lines should be added to the text file —

      post_max_size = 16M
      upload_max_filesize = 16M

      3. Using the scripts provided in this post, copy the php.ini file to every subdirectory under the root of your WordPress site.
      4. Now try your install.

      Reply
  • December 21, 2015 at 2:08 AM
    Permalink

    Hi, In Magento? Where ? Directory? sorry for my english…

    Reply
    • December 21, 2015 at 7:39 AM
      Permalink

      Fabio, this is for 1and1.com’s hosted Linux accounts specifically. Is that what you have?

      Reply
  • March 17, 2016 at 7:44 AM
    Permalink

    We have hosted our website on 1and1 but .htaccess is not working, I have tried to put on root as well but nothing is happening. Actually I wanted to to remove file extensions i.e. .php or .html

    Reply
    • March 17, 2016 at 8:57 AM
      Permalink

      You shouldn’t need to do anything as root — and won’t have root access unless this is a dedicated server. How are you building and updating the .htaccess file? What are the file permissions? There are many unknowns and not enough information to determine your problem.

      Reply
  • June 8, 2016 at 9:12 AM
    Permalink

    Hello!! I created a project that using POD , it works in my localhost but when i try to upload it on my domain server at 1&1.com there is an error message “Connection error: could not find driver” . how can i fix it?

    Reply
    • June 8, 2016 at 9:32 AM
      Permalink

      I’m sorry, but I wouldn’t know what POD is — nor your specific connection issue. You’ll need to reach out to the developer of POD (whatever that is) and/or 1and1.com for support.

      Reply
  • January 1, 2017 at 2:17 PM
    Permalink

    Hey. i download. upload the files to root and with my browser go to phpcopy.php. but its error: Error – no source php.ini file

    i have a 1&1 hosting and i really need to upload large file so i need to change the settings in the php.ini file.

    some one can help me please? Thanks!

    Reply
    • January 2, 2017 at 2:55 PM
      Permalink

      Rowli —

      You said you uploaded it to root, do you mean the root of the website or your account? I need more details here.

      Also, did you modify the oh-copy.php file? It doesn’t sound like you did. Note there is a line where you need to put the server path in it —

      $path = “PUT FULL SERVER PATH TO ROOT FILE HERE”;

      You need to also update the php.ini file as it too has a variable that needs to match your specific server.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *