This blog post is for those in the process of running the Magento data migration tool using SSH and come across these two error messages.

  1. Warning: Unsupported declare ‘strict_types’ in /home/(user)/public_html/(domain)/vendor/magento/inventory-composer-installer/src/Plugin.php on line 6
  2. Parse error: syntax error, unexpected ‘:’, expecting ‘;’ or ‘{‘ in /home/(user)/public_html/(domain)/vendor/magento/inventory-composer-installer/src/Plugin.php on line 55

Steps that were taken to duplicate error messages:
I log in to putty as a root user and I change the directory to cd /home/(user)/public_html/(domain)/ and then I run the following command:
composer config repositories.data-migration-tool git https://github.com/magento/data-migration-tool

This is of course after I have uploaded and extracted the data migration tool to the Magento root directory.

The error message had to do with SSH using the wrong PHP version, I also tried an alias PHP command: alias php=/opt/php71/bin/php but this did not resolve the problem and I still ended up with the same error messages.

To find out what PHP version your server is using type in php -v in the command prompt. My server was using:
PHP 5.6.37 (cli) (built: Sep 3 2018 05:04:28) and my domain was using PHP 7.1.7 under PHP Configuration which is why I was able to install Magento 2 onto the server.

EasyApache Migration

So here’s the problem or the solution to the problem. The problem was I needed to upgrade my server to the latest PHP version. I needed a package that installed 7.2 PHP version. To install I needed to upgrade my server from EasyApache 3 to EasyApache 4 which required a migration. I needed to do a migration because I had already built EasyApache 3 to the prerequisite settings of Magento 2.

MultiPHP Manager

So I went ahead with the EasyApache migration. Then I had my hosting company enable MultiPHP Manager. Under the MultiPHP Manager, I selected my domain to change the PHP Version. Only to find out that PHP version wasn’t available, only 5.6 was available. So I had to install PHP version 7.2 using EasyApache4 and these instructions I found from my hosting company. Once PHP 7.2 was installed I was able to change my domain and apply PHP 7.2.

I then ran the composer code is SSH again, but still got the same error messages.

I finally solved the problem by going into MultiPHP Manager and setting the system default PHP version to 7.2. This resolved my error messages and I was able to continue running the composer for the Magento data migration tool.

I knew I had resolved the issue because I was now on to a new error message, an easier fix, which said: Do not run Composer as root/super user! See https://getcomposer.org/root.

Magento: Do Not Run Composer as Root User

Elyssa McGregor

Hi! I'm Elyssa McGregor. I love helping people succeed online and promoting businesses with our wide range of promotional products. I have a love for search engine optimization (SEO) and getting companies out there on the world wide web. How can I help you?

View all posts

2 comments