![](/img/trans.png)
[英]Trying to install Laravel using composer and it says "the requested PHP extension fileinfo is missing from your system"
[英]Laravel deployment to azure windows web app using GitHub gives error requires ext-fileinfo * -> it is missing from your system
當我嘗試使用 github 將我的 laravel 項目部署到 azure windows web 應用程序時,出現以下錯誤。
但如果我使用 azure 工具,它部署得很好
Your requirements could not be resolved to an installable set of packages.
Problem 1
- laravel/framework[v7.29.0, ..., 7.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 ^7.29 -> satisfiable by laravel/framework[v7.29.0, ..., 7.x-dev].
To enable extensions, verify that they are enabled in your .ini files:
- C:\tools\php\php.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
我試過 php --ini
C:\\Program Files(x86)\\PHP\\v7.4\\php.ini 在以下位置掃描其他 .ini 文件:
並在該文件中啟用
extension=fileinfo
這也是我的作曲家文件
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.4 || ^8",
"doctrine/dbal": "^2.13",
"fideloper/proxy": "^4.4",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^6.3.1|^7.0.1",
"laravel/framework": "^7.29",
"laravel/tinker": "^2.5",
"predis/predis": "^1.1",
"tcg/voyager": "^1.4",
"tymon/jwt-auth": "^1.0"
},
"require-dev": {
"facade/ignition": "^2.0",
"fakerphp/faker": "^1.9.1",
"mockery/mockery": "^1.3.1",
"nunomaduro/collision": "^4.3",
"phpunit/phpunit": "^8.5.8|^9.3.3"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"platform-check": false
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"psr-4": {
"App\\": "app/"
},
"classmap": [
"database/seeds",
"database/factories"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
},
"repositories": {
"hooks": {
"type": "composer",
"url": "https://larapack.io"
}
}
}
經過 24 小時的搜索,我找到了解決方案。 這與部署時設置的 php 相關。 要使用必要的擴展設置 PHP,您需要更新 GitHub 存儲庫(.github/workflows 文件夾)上的 .yml 文件。
在“Setup PHP >> with”步驟中添加一個新行,例如“extensions: fileinfo”
如果您需要啟用任何其他擴展,您可以將所有擴展添加為逗號分隔。
例子:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
extensions: fileinfo, pdo_mysql
請閱讀此文檔: https : //github.com/shivammathur/setup-php#heavy_plus_sign-php-extension-support
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.