﻿---
path: faq/cross-platform-migration.mdx
title: Cross-platform migration to Passwork 7
slug: cross-platform-migration
description: >-
  Migrating to Passwork 7 when the current OS does not support PHP 8.3: a clean
  installation on a new OS, connecting to MongoDB on the old server, and
  transferring database objects.
keywords:
  - Passwork
  - migration
  - Passwork 7
  - cross-platform migration
  - legacy OS
  - PHP 8.3
  - MongoDB
  - manual installation
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

If the current server runs a legacy OS without PHP 8.3 support, a full Passwork update on that OS is not possible. Instead of moving the entire old installation, we recommend a **cross-platform migration**:

1. On the new OS, perform a [manual installation](https://passwork.pro/tech-guides/manual-installation/linux/intro/) of Passwork 7.
2. Data is transferred from the server where Passwork 6.5 remains.
3. Passwork 7 connects to MongoDB on the legacy OS, reads the database objects, and updates them into a new local database on the current OS.

:::info
This guide is intended for a **manual installation** of Passwork.
:::

## Actions on the current OS with Passwork

### Update and initial migration

1. [Update Passwork to version 6.5](https://passwork.pro/tech-guides/migration-to-passwork-7/passwork-update-to-version-6_5/intro/).
2. Perform the [initial data migration](https://passwork.pro/tech-guides/migration-to-passwork-7/initial-data-migration/).

### Open access to the MongoDB database

Edit the MongoDB configuration file `/etc/mongod.conf` and change `bindIp` from `127.0.0.1` to `0.0.0.0`:

<Tabs className="tabs-container">
  <TabItem className="tab-item-container" value="shell" label="shell">

```yaml
net:
  bindIp: 0.0.0.0
```

  </TabItem>
</Tabs>

Restart the MongoDB service:

<Tabs className="tabs-container">
  <TabItem className="tab-item-container" value="shell" label="shell">

```shell
systemctl restart mongod.service
```

  </TabItem>
</Tabs>

### Generate configuration files for Passwork 7

Create a temporary directory and copy the Passwork configuration file:

<Tabs className="tabs-container">
  <TabItem className="tab-item-container" value="shell" label="shell">

```shell
mkdir /tmp/pwk_migrate
cp /var/www/app/config/config.ini /tmp/pwk_migrate
```

  </TabItem>
</Tabs>

Download the conversion script, set permissions, and run it:

<Tabs className="tabs-container">
  <TabItem className="tab-item-container" value="shell" label="shell">

```shell
cd /tmp/pwk_migrate/
wget https://repos.passwork.pro/repository/linux/scripts/config_convert.sh
chmod +x config_convert.sh
./config_convert.sh --input ./config.ini --output ./
```

  </TabItem>
</Tabs>

After it finishes, the directory contains two configuration files:

- `config.env`
- `encryption_key`

### Confirm the migration on the Customer Portal

Confirm the data migration on the Passwork [Customer Portal](https://portal.passwork.pro). [Migration confirmation](https://passwork.pro/tech-guides/migration-to-passwork-7/migration-confirmation-on-client-portal/).

## Actions on the new OS

### Install Passwork 7

Perform a [manual installation](https://passwork.pro/tech-guides/manual-installation/linux/intro/) of Passwork (the latest available version).

:::danger
After installing Passwork on the new OS, **do not open** the web interface. Otherwise it will be impossible to complete the Passwork migration correctly.
:::

### Transfer and configure the configuration files

1. Copy the `config.env` and `encryption_key` files from `/tmp/pwk_migrate/` on the legacy OS to `/var/www/init/` on the new OS.
2. In `/var/www/init/config.env`, set the MongoDB address of the legacy OS in `MIGRATION_DATABASE_URL`, and keep `MONGODB_URL` local:

<Tabs className="tabs-container">
  <TabItem className="tab-item-container" value="DEB" label="DEB">

```shell
MONGODB_URL=mongodb://127.0.0.1:27017
MIGRATION_DATABASE_URL=mongodb://192.168.1.100:27017
```

  </TabItem>
</Tabs>

:::info
Replace `192.168.1.100` with the **IP** or **hostname** of the server with the legacy OS. For the local database on the new OS, `mongodb://127.0.0.1:27017` or `mongodb://localhost:27017` are valid.
:::

3. Set the owner of the files in `/var/www/init/` to the web server user:

<Tabs className="tabs-container">
  <TabItem className="tab-item-container" value="DEB" label="DEB">

```shell
chown www-data:www-data /var/www/init/*
```

  </TabItem>
  <TabItem className="tab-item-container" value="RPM" label="RPM">

```shell
chown apache:apache /var/www/init/*
```

  </TabItem>
</Tabs>

### Start the database objects migration

Start transferring objects from MongoDB on the legacy OS to the local MongoDB on the new OS:

<Tabs className="tabs-container">
  <TabItem className="tab-item-container" value="DEB" label="DEB">

```shell
sudo -u www-data bash -c 'cd /var/www && yes | php -d memory_limit=-1 ./bin/console database:v6:migration'
```

  </TabItem>
  <TabItem className="tab-item-container" value="RPM" label="RPM">

```shell
sudo -u apache bash -c 'cd /var/www && yes | php -d memory_limit=-1 ./bin/console database:v6:migration'
```

  </TabItem>
</Tabs>

For details, see [Migration of Passwork database objects](https://passwork.pro/tech-guides/migration-to-passwork-7/passwork-database-objects-migration/).

## Completing the migration with client-side encryption

If Passwork uses [client-side encryption](https://passwork.pro/tech-guides/migration-to-passwork-7/encryption-mode-determination/), complete the final stage — [Data migration in the Passwork web interface](https://passwork.pro/tech-guides/migration-to-passwork-7/data-migration-in-passwork-web-interface/).

## Post-migration actions

After the migration is finished, follow the [post-migration actions](https://passwork.pro/tech-guides/migration-to-passwork-7/post-migration-actions/).
