A word of warning to users of 1and1 and cakePHP

Something I found out recently when I updated the cakePHP core files, when accessing my 1and1 hosting using ssh I kept getting errors when using the cakePHP console. The problem was caused by the fact that by default 1and1 uses PHP 4 for the command line. This cannot be altered using .htaccess, however after a little googleing I found that using php5 on the command line does as you would expect. So to make your cakePHP console work using PHP 5, all that is needed is a little editing of one file. CORE/console/cake

Change this:

exec php -q ${LIB}cake.php -working "${APP}" "$@"

To this:

exec php5 -q ${LIB}cake.php -working "${APP}" "$@"

All console actions will then be run using PHP 5.

7 thoughts on “A word of warning to users of 1and1 and cakePHP

  • 18th November 2010 at 3:56 pm

    Another hint is to include the following lines in your apps top level .htaccess if you want your 1and1 server to allow you to use php5 commands.

    Change ‘/.htaccess’ to:

    AddType x-mapp-php4 .php
    AddType x-mapp-php5 .php
    SetEnv PHP_VER

    RewriteEngine on
    RewriteRule ^$ app/webroot/ [L]
    RewriteRule (.*) app/webroot/$1 [L]

  • 18th November 2010 at 3:58 pm

    P.S. I came across the above issue and fix after uploading a CakePHP app that was working fine on my server to a client’s 1and1 server and my use of ClassRegistry::init() began throwing errors.

  • 26th May 2011 at 2:25 pm

    1and1 has new panel and you can switch on and off with one click right now 😉

  • 1st February 2012 at 7:30 am

    Please add

    RewriteBase /

    in your .htaccess file and issue will be resolved.

  • 3rd December 2012 at 8:18 pm

    Thanks for this Duncan,

    I had a frustrating time sorting this out with cakePHP v2.2 until I found your fix.


Leave a Reply to Paul Gardner Cancel reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.