Views: 3730
Last Modified: 13.07.2020
  • Using third party tools to migrate the site
  • PHP Settings
  • Possible issues with multisite configurations of Bitrix Framework
  • Site is unavailable after unpacking
  • Incomplete archive
  • ERROR 1062 (23000)
  • .htaссess related errors
  • IIS related issues
  • Using third party tools to migrate the site

    You will get the best results migrating your site by using the standard backup and restore tools included in Bitrix Framework.

    While a Bitrix powered site is essentially a number of files and a database, making a blind copy of the site at another location is not the best way. Thousands of small files will take a very long time to copy over the Internet, and then there is a file permission problem.

    The following are the most frequent issues that can be encountered:

    1. Web server cannot write to a folder or delete temporary files. Potential consequences:

      • inability to install system updates;
      • inability to edit the site via the web interface;
      • cache subsystem malfunction and other issues;
      • Note: some rare situations occur when, for example, hosting service assigned access permissions prohibited the system to delete temporary files it was allowed to create in the first place. As a result, the account will be disabled within 24 hours due to reaching disk quota.

        A seemingly simple solution would be assigning 777 permission to all files and folders on Unix platforms (or any other method allowing PHP to read and write wherever it wants to). Obviously, not the most secure solution of all.

    2. Users may be unable to edit via FTP/SFTP the files created in the web interface. This will make updating the site extremely troublesome.

      One of the simplest but not very reliable solutions is setting permissions in the dbconn.php, file enabling anyone to edit files created by means of Bitrix Framework.

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

      However, you will have to manually set permissions for the files created via FTP or SFTP (or use the umask parameter if supported by the hosting provider).

    PHP settings

    Incorrect PHP settings can cause other issues, for example:

    • File owner mismatch: there are servers where PHP runs as one user, while FTP/SFTP access is granted on behalf of another user. As a result, files created by a PHP script would be unavailable via FTP and vice versa, or worse – the server would throw a runtime error due to security violation.
    • Security settings related issues. There are more than one way for PHP to connect to the server, and some of the methods impose strict restrictions on file owner and file permissions. This will result in error 500, and you will have to review web server logs to find the cause of the error.

      Example: most hosting services require that the file owner and file permissions match if PHP is configured as CGI. If the file owner is anything but your account or file permissions allow write access to anyone, PHP script will fail. In this case correct permissions for files and folders have to be assigned, and the dbconn.php file needs to have correct parameters.

    • • Maximum script execution time or other restrictions. If these are in place, the site may act weird: now it works, the next instant it doesn’t.

      Example: Data export and import scripts are ones of the most memory and time dependent. If you encounter issues, check resources on your server. If you find them restricted, contact the administration or change the hosting company altogether.

    • UTF-8 related issues. Make sure this universal encoding is supported (mbstring library is required; PHP parameter mbstring.func_overload=2 has to be set).
    • Other hosting specific issues. To avoid problems, we recommend that you test your site on the selected hosting provider before deploying the project.

    Possible issues with multisite configurations of Bitrix Framework

    Make sure your hosting provider will support your multisite strategy. Not all hosting companies provide correct environment to configure Bitrix Framework to support multiple sites.

    Email issues

    There are hosting companies that don't allow sending email without authentication. If this is the case, you will have to write a custom email sending function according to documentation.

    Site is unavailable after unpacking

    Sometimes, after the archive was unpacked, all a site can show to a user is the authentication form. There are several possible reasons for that:

    • The field Web server root directory for this site specifies incorrect value (Settings> System Settings> Websites > Websites сайтов).

      Solution: set the correct path in this field by clicking insert currently used path link. You can leave the field empty if all of your sites run on the same server.

    • • If you migrated the site by simply copying the files over FTP or SSH, the file .access.php might not be allowed to copy. This file contains user group permissions for the site; any such access will be denied if the file is missing>.

      Solution 1: create a new .access.php file in the site root and add the following text to it:

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

      or

      Solution 2: open the Site Explorer form in your site's Control Panel. Open the site root folder properties window, click the Access tab and set the All Users user group permission to Read.

    Incomplete archive

    Sometimes users notice that, if they open the site archive in WinRAR, there are a lot fewer files than on the source site.

    Reason: the tar format is rather fluid and varies. The system creates a GNU tar, archive, just like the tar command does in Linux. WinRar understands tar, in general, but does not provide full support for this dialect.

    You have to unpack the archive using the restore.php script available on the Backups page. However, if you notice some of the files are missing even then, you have to contact the Helpdesk.

    ERROR 1062 (23000)

    Sometimes users encounter this error when unpacking the archive: ERROR 1062 (23000) at line 1247: Duplicate entry '2-?' for key 2.

    Reason: archive encoding does not match target database server encoding.

    • Archive encoding is sourced from the file /bitrix/php_interface/after_connect.php, for example:
      <?
      $DB->Query("SET NAMES 'utf8'");
      ?>
      which here means the archive is created in UTF-8 encoding.
    • • To learn the target server's encoding, execute the following SQL query to get the value of character_set_server parameter:
      show variables where Variable_name = 'character_set_server';

    Solution 1:

    • Set the parameter character_set_server in the target server's database to the one specified on the source system (and therefore inherited by the archive).

      Attention! You may have to ask your hosting service administration to make this adjustment.

    .htaссess related errors

    Unexpected errors like a 404 when trying to view a details page are often due to the remote system incorrectly renaming the .htaссess file by adding an underscore ("_") to the filename. Find all files whose filename match .htaссess and correct the name if necessary.

    IIS related issues

    The system adds the web.config file to the archive, which may cause the restore.php script to malfunction.

    Solution: Delete the extracted web.config. The server will create a new one as required.




    Courses developed by Bitrix24