magento 2 syntax error during installation, unexpected ‘.’ in AbstractFactory.php on line 93

Recently tried to install Magento v2.1 on a server but got the following error message:

PHP Parse error: syntax error, unexpected '.' in public_html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 93

Line 93 in AbstractFactory.php is return new $type(...array_values($args));

It turns out that ... is a new operator introduced in PHP 5.6, which is also known as the Splat Operator.

Upgrading PHP version to 5.6 solved the problem. The lesson here is to always check the minimum system requirements before installation. The minimum systems requirements for Magento 2.1 can be found here.

Magento 2 useful commands

Here’s a list of Magento 2 commands that I use frequently:

bin/magento deploy:mode:show //show current application mode
bin/magento deploy:mode:set //set application mode, possible values are default, developer, production

bin/magento cache:clean //Clean cache
bin/magento cache:flush //Flushes cache storage, this will clear all frontend sessions

bin/magento module:enable Module_Name //enable a module
bin/magento module:disable Module_Name //disalbe a module

bin/magento indexer:reindex //reindex all index
bin/magento setup:upgrade //update all modules

To display all available commands, use

bin/magento list