安装 CakePhp:"Your requirements could not be resolved to an installable set of packages" 错误

installing CakePhp: "Your requirements could not be resolved to an installable set of packages" error

我正在尝试通过此 tutorial 使用 composer 安装 cakephp 但是在我 运行 命令之后:

sudo composer create-project --prefer-dist cakephp/app my_app_name

我收到错误:

Problem 1 - cakephp/cakephp-codesniffer 3.0.0 requires squizlabs/php_codesniffer ^3.0.0 -> satisfiable by squizlabs/php_codesniffer[3.0.0, 3.0.1, 3.0.2, 3.1.0, 3.1.1]. - cakephp/cakephp-codesniffer 3.0.1 requires squizlabs/php_codesniffer ^3.0.0 -> satisfiable by squizlabs/php_codesniffer[3.0.0, 3.0.1, 3.0.2, 3.1.0, 3.1.1]. - squizlabs/php_codesniffer 3.1.1 requires ext-simplexml * -> the requested PHP extension simplexml is missing from your system. - squizlabs/php_codesniffer 3.1.0 requires ext-simplexml * -> the requested PHP extension simplexml is missing from your system. - squizlabs/php_codesniffer 3.0.2 requires ext-simplexml * -> the requested PHP extension simplexml is missing from your system. - squizlabs/php_codesniffer 3.0.1 requires ext-simplexml * -> the requested PHP extension simplexml is missing from your system. - squizlabs/php_codesniffer 3.0.0 requires ext-simplexml * -> the requested PHP extension simplexml is missing from your system. - Installation request for cakephp/cakephp-codesniffer ^3.0 -> satisfiable by cakephp/cakephp-codesniffer[3.0.0, 3.0.1].

To enable extensions, verify that they are enabled in your .ini files: - /etc/php/7.0/cli/php.ini - /etc/php/7.0/cli/conf.d/10-opcache.ini - /etc/php/7.0/cli/conf.d/10-pdo.ini - /etc/php/7.0/cli/conf.d/20-calendar.ini - /etc/php/7.0/cli/conf.d/20-ctype.ini - /etc/php/7.0/cli/conf.d/20-curl.ini - /etc/php/7.0/cli/conf.d/20-exif.ini - /etc/php/7.0/cli/conf.d/20-fileinfo.ini - /etc/php/7.0/cli/conf.d/20-ftp.ini - /etc/php/7.0/cli/conf.d/20-gettext.ini - /etc/php/7.0/cli/conf.d/20-iconv.ini - /etc/php/7.0/cli/conf.d/20-intl.ini - /etc/php/7.0/cli/conf.d/20-json.ini - /etc/php/7.0/cli/conf.d/20-mbstring.ini - /etc/php/7.0/cli/conf.d/20-phar.ini - /etc/php/7.0/cli/conf.d/20-posix.ini - /etc/php/7.0/cli/conf.d/20-readline.ini - /etc/php/7.0/cli/conf.d/20-shmop.ini - /etc/php/7.0/cli/conf.d/20-sockets.ini - /etc/php/7.0/cli/conf.d/20-sysvmsg.ini - /etc/php/7.0/cli/conf.d/20-sysvsem.ini - /etc/php/7.0/cli/conf.d/20-sysvshm.ini - /etc/php/7.0/cli/conf.d/20-tokenizer.ini You can also run php --ini inside terminal to see which files are used by PHP in CLI mode.

我使用 curl 和 composer 安装了 codeSniffer。我仍然无法摆脱错误。知道我做错了什么吗?

codeSniffer 似乎需要 squizlabs ^3.0.0。 而且您似乎还需要在 .ini 文件中启用扩展。

您需要安装一些扩展,即:

sudo pear install PHP_CodeSniffer

并且还为作曲家启用 php 扩展,即 curl,intl

sudo apt-get update

sudo apt-get install curl php-cli php-mbstring git unzip

额外选项:

全局安装 composer :

sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer

我曾经有过类似的错误。它已通过安装 php-xml 修复。确保你也安装了 waris 所说的。

sudo apt-get install php-xml

我曾经有过类似的错误。它已通过安装 php-xml 修复。确保你也安装了 waris 所说的。 第一个 php 版本

php -v

sudo apt-get install <your php version>-xml