Back to Community

Fixing the 'decoct() Argument Must Be of Type Int' Error in Duplicator

62 threads Sep 16, 2025 PluginDuplicator

Content

If you're encountering a fatal error during a Duplicator migration that mentions decoct(): Argument #1 ($num) must be of type int, string given, you're not alone. This is a common issue that arises from a PHP version compatibility problem between the server where the package was created and the server where you are trying to install it. This guide will explain why this happens and walk you through the most effective solutions.

Understanding the Problem

This error occurs when the Duplicator installer script (installer.php) tries to set file permissions on the new server. The specific function decoct(), which converts decimal numbers to octal (used for permission values), became more strict in PHP 8.0+. It now requires a pure integer as input.

The error suggests that the script is receiving a string instead of an integer. This typically happens because the package was built on a server with an older version of PHP (e.g., 7.4) and is now being installed on a server running PHP 8.0 or newer. The way file permission data is stored and passed between these versions has a slight incompatibility.

How to Resolve the 'decoct()' TypeError

Here are the most common and effective solutions, starting with the simplest.

Solution 1: Create a New Package on a PHP 8.0+ Server

The most straightforward fix is to avoid the version mismatch altogether.

  1. On your destination server (where you are trying to install), ensure it is running a supported PHP version (e.g., 8.0, 8.1, or 8.2).
  2. On your original server, temporarily change its PHP version to match the destination server (e.g., 8.1). You can usually do this from your hosting control panel (cPanel, Plesk, etc.).
  3. Once both servers are on a similar PHP version, use Duplicator to build a completely new package on the original server.
  4. Upload this new package and installer to your destination server and run the installation again. The error should no longer appear.

Solution 2: Manually Extract the Archive (Advanced)

If creating a new package is not possible, you can work around the installer script's permission function by manually extracting the files.

  1. Upload the Duplicator package (the _archive.zip or _archive.daf file) and the installer.php file to your destination server's root directory via FTP/SFTP.
  2. Using your hosting control panel's file manager or an FTP client, manually extract the archive file. Extract all contents into your website's root directory (e.g., public_html). This step bypasses the part of the installer that is causing the error.
  3. Once the files are extracted, run yoursite.com/installer.php in your browser. The installer should now skip the extraction phase and proceed directly to the database setup and configuration steps.

Solution 3: Apply a Code Patch (Temporary Workaround)

Warning: This solution involves editing the installer.php file and is recommended only for advanced users. Always back up the file first.

The error is often triggered on a specific line of code. You can modify this line to force the value to be an integer.

  1. Open the installer.php file from your destination server in a code editor.
  2. Search for the line number mentioned in the error stack trace (e.g., line 607).
  3. You will likely find a line of code similar to this:
    $mode = decoct($mode);
  4. Change this line to explicitly cast the variable $mode as an integer before processing:
    $mode = decoct((int)$mode);
  5. Save the file and upload it back to your server, overwriting the old one. Try running the installer again.

Conclusion

The decoct() type error is a classic case of a PHP version compatibility issue. The most permanent and reliable fix is to create a new package with matching PHP versions on both servers. If that's not an option, manually extracting the archive is a effective workaround that allows the installer to continue its job. For more persistent or complex issues, checking the server's error logs for additional clues can be helpful.

Related Support Threads Support