Menu
InformatiWeb
  • Index
  • Courses
  • Tutorials
  • InformatiWeb Pro

Login

Registration Password lost ?
FR
  • IT
    • Articles
    • Backup
    • BIOS
    • Live CD
    • MultiBoot
    • Security
    • Virtualization
    • Web
    • Windows
  • InformatiWeb
  • Tutorials
  • IT
  • Web
  • Host your website created with CakePHP 2 at LWS, OVH or 1and1
  • Web
  • OVH, LWS
  • 21 November 2015 at 13:05 UTC
  • Lionel

Host your website created with CakePHP 2 at LWS, OVH or 1and1

When you want to host a site created with the CakePHP 2 framework, it is possible that you have an internal server error (code 500).
To address this issue, simply edit 3 ".htaccess" files of CakePHP. But the modification depends on your web hosting.

  1. For LWS
  2. For 1and1
  3. For OVH

1. For LWS

For LWS.FR webhost, there are 2 possibilities :

  • a shared webhosting
  • or a multi-domains web hosting

In the case of the shared webhosting (a web hosting for one site), you will not have problems.

But, if you use the multi-domains option, you will have problems with any additional domains.
Indeed, with this option, you can host a site to the root of your FTP account (no problem for this site), but others will be in subfolders : "my-2nd-domain.net," "my-3rd-domain.net ", ...
For these sites, you will need to edit ".htaccess" files like this :

Plain Text

\.htaccess

Apache

<IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteBase /
   RewriteRule    ^$ app/    [L]
   RewriteRule    (.*) app/$1 [L]
</IfModule>

Plain Text

\app\.htaccess

Apache

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteBase /app
    RewriteRule    ^$    webroot/    [L]
    RewriteRule    (.*) webroot/$1    [L]
</IfModule>

Plain Text

\app\webroot\.htaccess

Apache

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /app/webroot
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

2. For 1and1

For 1and1 webhost, you should use PHP 5 and use RewriteBase instructions like this :

Plain Text

\.htaccess

Apache

<IfModule mod_rewrite.c>
    AddType x-mapp-php5 .php
    Options +FollowSymLinks
    RewriteEngine On
    RewriteBase /
    RewriteRule ^$ app/ [L]
    RewriteRule (.*) app/$1 [L]
</IfModule>

Plain Text

\app\.htaccess

Apache

<IfModule mod_rewrite.c>
    AddType x-mapp-php5 .php
    Options +FollowSymLinks
    RewriteEngine On
    RewriteBase /
    RewriteRule ^$ webroot/ [L]
    RewriteRule (.*) webroot/$1 [L]
</IfModule>

Plain Text

\app\webroot\.htaccess

Apache

<IfModule mod_rewrite.c>
    AddType x-mapp-php5 .php
    Options +FollowSymLinks
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php/$1 [QSA,L]
</IfModule>

If you get an error about the timezone :

Plain Text

Warning: strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier.

Il suffit de décommenter (enlever le # en début de ligne) et modifier la ligne "date_default_timezone_set" dans le fichier "\app\Config\core.php".
Note : La liste complète des fuseaux horaires se trouve sur le site de PHP.

Just edit the "date_default_timezone_set" line in the "\app\Config\core.php" file.
Note : The full list of time zones is on the PHP site.

PHP

// Time zone of London
date_default_timezone_set('Europe/London');

3. For OVH

Apparently, you only need to use version 5 of PHP.

For this, you have 2 possibilities :

  • use the ".ovhconfig" file
  • activate PHP5 via .htaccess

If you want to use the .ovhconfig file, the file should look like this.
Note : As mentioned in the OVH FAQ, this file is present by default on 2014 web hostings. If this file doesn't exist, just create it.

Plain Text

.ovhconfig

Plain Text

app.engine=php
app.engine.version=5.5
http.firewall=none
environment=production

If you want to use the .htaccess file, simply add this line to the beginning of the ".htaccess" file located in the root of your CakePHP site :

Apache

SetEnv PHP_VER 5

Share this tutorial

Partager
Tweet

To see also

  • OVH - Change contacts of your domain

    Web 7/2/2013

    OVH - Change contacts of your domain

  • OVH - Enable SSL on your web hosting

    Web 6/2/2018

    OVH - Enable SSL on your web hosting

  • OVH - Multisite option for your web hosting

    Web 5/18/2018

    OVH - Multisite option for your web hosting

  • Transfer a .net domain from LWS.FR to OVH

    Web 11/3/2018

    Transfer a .net domain from LWS.FR to OVH

Comments

You must be logged in to post a comment

Share your opinion

Pinned content

  • Useful softwares
  • Our programs
  • Terms and conditions
  • Share your opinion

InformatiWeb Pro

  • Win. Server administration
  • Linux Administration
  • Virtualization

Contact

  • Guest book
  • Technical support
  • Contact

® InformatiWeb.net 2008-2022 - © Lionel Eppe - All rights reserved.

Total or partial reproduction of this site is prohibited and constitutes an infringement punishable by articles L.335-2 and following of the intellectual property Code.