Views: 20309
Last Modified: 08.07.2020
  • Site Migration Using Improper Means
  • PHP Settings
  • Problems with Email
  • Extracted Site Is Unavailable
  • Incomplete Archive
  • ERROR 1062 (23000)
  • Errors in .htaссess
  • If IIS is Used as a Web Server
  • Site Migration Using Improper Means

    The migration of site to hosting should be performed using backup/restore tools built in Bitrix Framework.

    Although a site on Bitrix24 Self-hosted is a set of files and a database, copying of files directly to a remote server in most cases will not be a proper solution. Due to a big number of small files, such copying may take several hours. In addition, the use of standard features enables the avoidance of possible future problems with access rights to the site files.

    Among the most common problems are the following:

    1. Web server cannot write to a folder that it needs to or delete temporary files. Possible consequences:

      • Product update is impossible;
      • Site cannot be edited using a web interface;
      • Caching component works improperly;
      • And other problems.

        Note: For example, the system may even create temporary files, but hosting rights do not allow you to delete them. As a result, after a day of work, the account gets blocked because the disc quota is exceeded.

        In this case, the simplest solution will be establishing the rights to all files and folders 777 (for Unix platform) or provide PHP with the write right for these files in any other way.

    2. There is no possibility to edit the files created using a web interface through ftp/ssh files. In this case, it will be hard for many web developers to debug the site.

      One of the simple but not always effective solutions is to determine settings in the file dbconn.php permitting everyone to edit the files created through Bitrix Framework.

      define("BX_FILE_PERMISSIONS", 0666);
      define("BX_DIR_PERMISSIONS", 0777);

      However, you will have to periodically change the rights manually for the files created through ftp/ssh; or, if hosting supports it, to establish the umask setting.

    PHP Settings

    The following problems may occur during the migration of the site to hosting due to the PHP settings:

    • Problems with file owner inconsistency: on a number of hosting PHP works on behalf of one user, but ftp/ssh access is granted to another. In this case, the files created by one method may be unavailable for modification or even cause a runtime error due to a breach of the security settings.
    • Problems with security settings: there are different options to connect PHP, and some of these options establish severe restrictions on the file owner and file rights. In this case, code 500 errors may occur, and the only way for you to solve the problem is to refer to web server error log.

      Example: If PHP is connected as CGI, hosting often requires that the file owner and file rights were consistent. If your account is not the file owner or if the file rights permit writing to all users, PHP will generate an error. In this case, the correct rights to files and folders and also the correct settings in dbconn.php should be established.

    • Limits to the script execution time or other allocated resources. In this case, the site may act strange –sometimes it may open, and sometimes not and then show white screen.

      Example: Various scripts of data import and export are the most sensitive to memory size and execution time. If you experience errors, check hosting resource availability. If the resources are insufficient, change the hoster.

    • Problems with using utf-8 in hosting. Make sure that it is supported (mbstring library and a possibility to set the parameter pgp: mbstring.func_overload=2 must be available).
    • Other problems that are specific for your hoster. To eliminate them, we recommend that the site operation be tested beforehand in the hosting of your choice and that the contact details of the provider’s support team be available.

    Problems with Email

    Sometimes hosting does not permit sending email without authorization. In this case, you will have to redefine email sending function in accordance with the product documentation in order to send emails from the site.

    Extracted Site Is Unavailable

    After extracting a backup copy, the only thing shown on the site is the authorization form. Possible reasons and solutions:

    • Incorrect value of the box Path to the web server root folder of this site in the site settings (Settings > System settings > Websites > Websites).

      Solution: change the value in the box Path to the web server root folder of this site in the site settings to a relevant path in a new hosting by clicking insert current. Leave the box empty if all the sites work on the same web server.

    • If migration was carried out by a simple copying of files (FTP/SSH), the file .access.php may have been left uncopied. This file contains user groups’ access rights to the site. If this file is absent, all users have the right Forbidden.

      Solution 1: Put the file .access.php with the contents to the site root:

      <?  $PERM["/"]["*"]="R"; ?>


      Solution 2: Establish the right Read for the All users (with non-authorized users) group using product’s file manager in the properties of the site root folder in the Access tab.

    Incomplete Archive

    When looking through WinRar, the archive created by the standard backup system, it becomes evident that the archive contains far fewer files than there are files on the site.

    Reason: the point is that the tar format has several dialects. The system zips archive in the format GNU tar the way tar does it in Linux by default. WinRar understands tar, but does not support this dialect in full.

    Backup archive must be extracted by the system restore.php downloaded from the backup copy page. If in this case some files are also missed, the problem should be solved through the helpdesk service.

    ERROR 1062 (23000)

    When extracting a backup copy, the following error occurs: ERROR 1062 (23000) at line 1247: Duplicate entry '2-?' for key 2.

    Reason: the error occurs if the encoding of the archive is different from the encoding used on the new database server.

    • Archive encoding is set depending on the contents of the file /bitrix/php_interface/after_connect.php, for example:
      $DB->Query("SET NAMES 'utf8'");
      i.e. the archive will be created in the utf8 encoding.
    • Database server encoding may be seen in the parameter character_set_server following the execution of a SQL request:
      show variables where Variable_name = 'character_set_server';

    This error may be bypassed or eliminated by way of one of the following ways:

    • In the new database server settings, change encoding in the parameter character_set_server to the encoding used in the archive.

      Attention: you might want to contact server administrator to perform this operation.

    • Open the archive in a text editor and insert the following line at the very beginning:
      SET NAMES 'utf8';
      The encoding is chosen depending on the archive encoding.

      Attention: this solution works only in case of small dumps (which manage to import in one step).

    Errors in .htaссess

    Some errors (for example, error 404 when going to a page with detailed news information) during site migration occur because the file .htaссess is getting renamed by adding “_” (low line). In order to solve this problem, just check the file name and correct it if the error is detected.

    If IIS is Used as a Web Server

    In this case, the file web.config is also archived causing problems with extraction. After extraction, restore.php will not work.

    Solution: eliminate the extracted file web.config. The server will create a new customized file.

    Courses developed by Bitrix24