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.
For LWS.FR webhost, there are 2 possibilities :
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>
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');
Apparently, you only need to use version 5 of PHP.
For this, you have 2 possibilities :
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
Web 7/2/2013
Web 6/2/2018
Web 11/3/2018
Web 7/22/2013
Pinned content
InformatiWeb Pro
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.
You must be logged in to post a comment