Have been trying to setup magento for 2 days, but stuck because of the PHP version.

What I have tried

  • Changed php version in cpanel which generates a php.ini file in public_html, but install fails because it requires an empty folder
  • Ran composer command with --ignore-platform-reqs, but it ends up generating an errors:

Warning: Unsupported declare 'strict_types' in path/vendor/magento/inventory-composer-installer/src/Plugin.php on line 6

Parse error: syntax error, unexpected ':', expecting ';' or '{' in path/vendor/magento/inventory-composer-installer/src/Plugin.php on line 55

  • Tried specifying the php version in composer.json, but in the end it returns same 2 errors above

I can't change the default PHP or install PHP 7.1 package using "Remi's RPM repository", due to insufficient privileges, but I do have the right PHP version in /usr/local/bin/php but can't force composer to use it unfortunately.

If there was a way to have it run without forcing the folder to be empty, but it doesn't seem like that's possible.

By far the hardest install of an app I've ever come across :(

  • 1
    Try downloading a zipped install from downloads section on magento website and not using composer for base install Oct 7, 2019 at 10:54
  • @DominicXigen thank you! I didn't realize this was an option. Oct 7, 2019 at 14:59

3 Answers 3


Glad it helped. Just to confirm answer.

Try downloading a zipped install from downloads section on magento website and not using composer for base install.

Inside the zip all the core composer components are included. If you run composer install it should say that nothing needs installing. From this zip install the only time you will need to use composer is if you upgrade existing components or install new ones.

  • Thank you! I was finally able to get it work with composer, but your solution would work too Oct 7, 2019 at 17:48

I work on cPanel servers a lot. Another solution just came to me.

Install composer


Locate binary

whereis composer

composer: /opt/cpanel/composer/bin/composer

Create alias's

alias composer71='/opt/cpanel/ea-php71/root/usr/bin/php -d memory_limit=-1 /opt/cpanel/composer/bin/composer'
alias composer72='/opt/cpanel/ea-php72/root/usr/bin/php -d memory_limit=-1 /opt/cpanel/composer/bin/composer'
alias php71='/opt/cpanel/ea-php71/root/usr/bin/php'
alias php72='/opt/cpanel/ea-php72/root/usr/bin/php'

And so on.

Then you can just run composer71 install or whatever version


Solution was to simply install composer locally and then execute it using the PHP version of my choice (by specifying the full path to the PHP executable)


Install composer locally, so it will generate a composer.phar. This is a file you can simply execute via command line using:

php "composer.phar"

Locate path to the correct php executable, example:


Then execute the following command:

[PATH TO PHP EXECUTABLE] -d memory_limit=2G [PATH TO composer.phar file] create-project --repository=https://repo.magento.com/ magento/project-community-edition [PATH TO WHERE APP NEEDS TO BE INSTALLED]

My example which worked: /opt/cpanel/ea-php71/root/usr/bin/php -d memory_limit=2G composer.phar create-project --repository=https://repo.magento.com/ magento/project-community-edition /home/domain_name/public_html

If extensions are missing:

In my case bunch of extensions were missing, so I had to provision each one in WHM and then restart the process using:

[PATH TO PHP EXECUTABLE] -d memory_limit=2G [PATH TO composer.phar file] upgrade

Example: /opt/cpanel/ea-php71/root/usr/bin/php -d memory_limit=2G ../composer.phar upgrade


When installing composer make sure to do it outside public_html otherwise it will throw an error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.