Error installing Sylius: “PHP Fatal error: require

2019-08-16 17:46发布

问题:

I tried to install Sylius (Symfony) with the command "(php bin/console sylius:install"), but it gives the below error:

PHP Warning: require(C:\xampp\htdocs\acme\bin/../vendor/autoload.php): failed to open stream: No such file or directory in C:\xampp\htdocs\acme\bin\console on line 16

Warning: require(C:\xampp\htdocs\acme\bin/../vendor/autoload.php): failed to open stream: No such file or directory in C:\xampp\htdocs\acme\bin\console on line 16

PHP Fatal error: require(): Failed opening required 'C:\xampp\htdocs\acme\bin/../vendor/autoload.php' (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\acme\bin\console on line 16

Fatal error: require(): Failed opening required 'C:\xampp\htdocs\acme\bin/../vendor/autoload.php' (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\acme\bin\console on line 16

回答1:

Please check your installed PHP version. Most likely it's 5.6. Since Sylius requires > PHP7.1 composer resolves Sylius to to the older version (something pre-beta) based on Symfony 2. Symfony3 moved console from app/ to bin/ folder.

Solution Please install PHP 7.1 locally, remove vendor folder and run composer install again