Safe Mode Hack

From Contao Community Documentation

Use the Safe Mode Hack (SMH) when the System Check tells you to do so or when you encounter problems with uploading or manipulating files in Contao. It is a workaround so try talking to your webspace-provider first if they are willing to change the settings.

Activating the Safe Mode Hack is easy. You can activate it directly during the installation process. When you open the /contao/install.php with your browser it should prompt you with the request to fill in your FTP data for the Safe Mode Hack.

If you don't get the request during the installation or want to configurate the Safe Mode Hack manually, just download the file localconfig.php from /system/config/ and open it with a text editor. Make sure that this editor works with UTF-8 character encoding.

Hint.png Hint: I like to use the freeware editor PSPad. Before opening a file with PSPad you need to click on Format > UTF-8. When you edit Contao files with this editor also check twice if the format of the file is UTF-8 before you save it. You'll encounter weird problems if you save Contao files not with UTF-8 character encoding.

Fill in the following information somewhere between ### INSTALL SCRIPT START ### and ?>:

$GLOBALS['TL_CONFIG']['useFTP']  = true;
$GLOBALS['TL_CONFIG']['ftpHost'] = 'fill in your domain name here';
$GLOBALS['TL_CONFIG']['ftpPath'] = 'fill in your relative ftp path here';
$GLOBALS['TL_CONFIG']['ftpUser'] = 'fill in the username of your FTP data here';
$GLOBALS['TL_CONFIG']['ftpPass'] = 'fill in the password of your FTP data here';
$GLOBALS['TL_CONFIG']['ftpSSL'] = '';
$GLOBALS['TL_CONFIG']['ftpPort'] = 21;

Of course you need to change the informations accordingly to your webspace FTP-data. Change the setting for ftpSSL only if you want to use SSL-connection for the Safe Mode Hack.

Hint.png Hint: People often don't know what to fill in as FTP path. Just use the FTP data in your favorite FTP program and connect to your webspace. Does it connect you directly to the directory where you want to install Contao? Great, your FTP path is: /

Or do you need to change your directory to something like htdocs/, httpdocs/ or html/? That's exactly what you need to fill into the Safe Mode Hack as FTP path. Just make sure that you don't forget the / at the end.

Save localconfig.php after the modification and upload it to system/config/ of your Contao installation.

Write permissions on folders

If you activated the Safe Mode Hack manually, you'll also need to change the CHMOD permissions to 777 with your FTP program on these folders:

  • system/html
  • system/logs
  • system/tmp

Hint.png Hint: If you want to set the CHMOD with Filezilla, just right-click on the folder and select »File Attributes« from the menu. Type 777 in the »Numeric value« field and confirm with a click on the OK-button.
Personal tools

Contao Community Documentation