尝试在CentOS上运行`composer update`时出现了这个错误。

huangapple go评论62阅读模式
英文:

Trying to composer update this error came up on CentOs

问题

我正在尝试在CentOS系统上部署我的Laravel项目。当我尝试运行composer update命令时,我遇到了这个错误。我无法找到解决方案,我在这个平台上搜索了解决方案。我找到了Windows的解决方法,但在我的CentOS系统上不起作用。

Windows的解决方法:
我将在php.ini文件中添加以下行:extension=php_fileinfo.dll,但没有起作用。

错误消息:

以root/super用户继续 [yes]? yes
正在加载composer仓库和包信息
来自https://repo.packagist.org的信息:#与乌克兰站在一起
更新依赖关系
无法解析您的要求以安装可用的软件包集。

  问题 1
    - laravel/framework[v8.12.0,...,8.x-dev]需要league/flysystem ^1.1 -> 可满足于league/flysystem[1.1.0,...,1.x-dev]。
    - league/flysystem[1.1.0,...,1.x-dev]需要ext-fileinfo * -> 您的系统中缺少它。安装或启用PHP的fileinfo扩展。
    - Root composer.json需要laravel/framework ^8.12 -> 可满足于laravel/framework[v8.12.0,...,8.x-dev]。

要启用扩展,请验证它们在您的.ini文件中是否已启用:
    - /opt/cpanel/ea-php74/root/etc/php.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/20-bcmath.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/20-calendar.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/20-ctype.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/20-curl.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/20-dom.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/20-ftp.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/20-gd.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/20-iconv.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/20-imap.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/20-json.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/20-mbstring.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/20-mysqlnd.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/20-pdo.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/20-phar.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/20-posix.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/20-simplexml.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/20-sockets.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/20-sqlite3.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/20-tokenizer.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/20-xml.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/20-xmlwriter.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/20-xsl.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/30-mysqli.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/30-pdo_mysql.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/30-pdo_sqlite.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/30-xmlreader.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/zzzzzzz-pecl.ini
您还可以在终端中运行`php --ini`以查看PHP在CLI模式中使用哪些文件。
或者,您可以使用`--ignore-platform-req=ext-fileinfo`选项运行Composer,以临时忽略这些所需的扩展。

使用选项--with-all-dependencies (-W)允许升级、降级和删除目前锁定到特定版本的软件包。
英文:

I'm trying to deploy my laravel project on CentOs system. When im going to run composer update command i am encountering this error. I can't figure out the solution and I saerched for soloution in this platform. I found for windows but not work on my CentOs system.

Soliton for windows;
I am going to add this line in php.ini file: extension=php_fileinfo.dll but didn't work.

Error Message;

Continue as root/super user [yes]? yes
Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
 Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - laravel/framework[v8.12.0, ..., 8.x-dev] require league/flysystem ^1.1 -> satisfiable by league/flysystem[1.1.0, ..., 1.x-dev].
    - league/flysystem[1.1.0, ..., 1.x-dev] require ext-fileinfo * -> it is missing from your system. Install or enable PHP's fileinfo extension.
    - Root composer.json requires laravel/framework ^8.12 -> satisfiable by laravel/framework[v8.12.0, ..., 8.x-dev].

To enable extensions, verify that they are enabled in your .ini files:
    - /opt/cpanel/ea-php74/root/etc/php.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/20-bcmath.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/20-calendar.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/20-ctype.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/20-curl.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/20-dom.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/20-ftp.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/20-gd.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/20-iconv.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/20-imap.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/20-json.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/20-mbstring.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/20-mysqlnd.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/20-pdo.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/20-phar.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/20-posix.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/20-simplexml.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/20-sockets.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/20-sqlite3.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/20-tokenizer.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/20-xml.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/20-xmlwriter.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/20-xsl.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/30-mysqli.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/30-pdo_mysql.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/30-pdo_sqlite.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/30-xmlreader.ini
    - /opt/cpanel/ea-php74/root/etc/php.d/zzzzzzz-pecl.ini
You can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode.
Alternatively, you can run Composer with `--ignore-platform-req=ext-fileinfo` to temporarily ignore these required extensions.

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

答案1

得分: 1

以下是要翻译的内容:

你的必需软件包中需要在你的CentOs系统中安装特定的php扩展。

请查看由composer update引发的错误消息中的第2行:

  • league/flysystem[1.1.0, ..., 1.x-dev] 需要 ext-fileinfo * -> 但它在你的系统中缺失。 请安装或启用PHP的fileinfo扩展。

请取消注释CentOs的php.ini文件中的这个缺失的php扩展。

缺失的扩展是 ext-fileinfo

注意:在部署你的项目到新环境时,运行 "composer install" 也是个好主意,以减少可能触发安装问题的突发软件包版本更新。同时不要忘记上传你的composer.lock文件。

在这里查看文档:https://laravel.com/docs/9.x/deployment#autoloader-optimization

英文:

One of your required package need a specific php extension in your CentOs system.

See the 2nd line error message thrown by composer update<br>

- league/flysystem[1.1.0, ..., 1.x-dev] 
 require ext-fileinfo * -&gt; it is missing from your system. 
 Install or enable PHP&#39;s fileinfo extension.

Please enable this missing php extension by uncomment it from inside your CentOs php.ini

The missing extension is ext-fileinfo

Note: also a good idea to run "composer install" when deploying your project in new environment, to minimize sudden package version updated that might trigger installation issues.
Also dont forget to upload your composer.lock as well.
Have a look at documentation here:
https://laravel.com/docs/9.x/deployment#autoloader-optimization

答案2

得分: 0

我再次遇到了这个问题,并按照以下方式解决了它:

在WHM面板中通过EasyApache安装File Info扩展和其他必要的包后,我的问题完全解决了。感谢所有人。

英文:

I encountered this problem again and resolved it as follows:

After installing the File Info extension and other necessary packages via EasyApache in the WHM panel, my problem was completely resolved. Thanks to everyone.

huangapple
  • 本文由 发表于 2023年2月10日 06:58:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/75405320.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定