CakePHP 3.0 install with composer is broken? [clos

2019-06-10 20:12发布

问题:

I get this error when trying to pull localhost.

error: Warning: require(C:\xampp\htdocs\sync\vendor\autoload.php): failed to open stream: No such file or directory in C:\xampp\htdocs\sync\config\bootstrap.php on line 23

using composer to install from the cakephp site here: http://book.cakephp.org/3.0/en/quickstart.html

Every time I try this is what I get along with some errors in the cmd here:

C:\xampp\htdocs>php composer.phar create-project --prefer-dist -s dev cakephp/app sync
Installing cakephp/app (dev-master ebdd94ef28cd742b90fc03a5f8cca46c6306ded2)
  - Installing cakephp/app (dev-master master)
    Loading from cache

Created project in sync
Loading composer repositories with package information
Installing dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

Problem 1
- Installation request for cakephp/cakephp 3.0.*-dev -> satisfiable by cakephp/cakephp[3.0.x-dev].
- cakephp/cakephp 3.0.x-dev requires ext-intl * -> the requested PHP extension intl is missing from your system.

Problem 2
- cakephp/cakephp 3.0.x-dev requires ext-intl * -> the requested PHP extension intl is missing from your system.
- cakephp/debug_kit 3.0.x-dev requires cakephp/cakephp 3.0.*-dev -> satisfiable by cakephp/cakephp[3.0.x-dev].
- Installation request for cakephp/debug_kit 3.0.*-dev -> satisfiable by cakephp/debug_kit[3.0.x-dev].

Update:

Interesting take. I have now installed the CakePHP 3 beta on 5 machines and not once have I seen this error again. After looking, I found this (tried all solutions they offered didn't work): CakePHP 3.0 installation: intl extension missing from system

Solution

I tried:

  • Opening /xampp/php/php.ini
  • Changing ;extension=php_intl.dll to extension=php_intl.dll (remove the semicolon)
  • Copy all the /xamp/php/ic*.dll files to /xampp/apache/bin
  • Restart apache in the Xampp control panel

For some strange reason, after I restarted apache several more times it just started working randomly out of nowhere 30 mins later. Something must have cached or required a hard reset.

But that finally did it. And it seems that my title was much more accurate for people to find than the other solved one. Hope this helps more people.

回答1:

No, just read the error! It is telling you already what is wrong.

  • Problem 1 (...) cakephp/cakephp 3.0.x-dev requires ext-intl * -> the requested PHP extension intl is missing from your system.
  • Problem 2 - cakephp/cakephp 3.0.x-dev requires ext-intl -> the requested PHP extension intl is missing from your system.

Install the extensions, problem solved. The official documentation tells you also what is required to run the framework.

Whenever you get an error, read it and pay attention to what it says. It seems to be a common problem that people ignore them these days.

The installation instructions in the official documentation explain this as well including instructions for XAMPP and WAMP users:

In both XAMPP and WAMP, mcrypt and mbstring extensions are working by default. In XAMPP, intl extension is included but you have to uncomment extension=php_intl.dll in php.ini and restart the server through the XAMPP Control Panel. In WAMP, the intl extension is “activated” by default but not working. To make it work you have to go to php folder (by default) C:\wamp\bin\php\php{version}, copy all the files that looks like icu*.dll and paste them into the apache bin directory C:\wamp\bin\apache\apache{version}\bin. Then restart all services and it should be OK.