我在 Jenkins 上运行 composer install
时遇到困难。
我有一个 Jenkins 作业,我需要为其运行 composer install
。我已经安装了 php7.2 和 Composer 。当我运行命令时,出现以下错误:
composer 安装
Problem 1
- teamtnt/tntsearch v1.3.2 requires ext-pdo_sqlite * -> the requested PHP extension pdo_sqlite is missing from your system.
- teamtnt/tntsearch v1.3.2 requires ext-pdo_sqlite * -> the requested PHP extension pdo_sqlite is missing from your system.
- Installation request for teamtnt/tntsearch v1.3.2 -> satisfiable by teamtnt/tntsearch[v1.3.2].
所以我使用以下命令安装 sqlite:sudo apt-get install php7.2-sqlite3
在此之后,我收到了额外的警告,但错误仍然存在。
PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_sqlite.so'
(tried: /usr/lib/php/20170718/pdo_sqlite.so (/usr/lib/php/20170718/pdo_sqlite.so:
undefined symbol: sqlite3_column_table_name), /usr/lib/php/20170718/pdo_sqlite.so.so
(/usr/lib/php/20170718/pdo_sqlite.so.so: cannot open shared object file:
No such file or directory)) in Unknown on line 0
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.
Problem 1
- teamtnt/tntsearch v1.3.2 requires ext-pdo_sqlite * -> the requested PHP extension pdo_sqlite is missing from your system.
- teamtnt/tntsearch v1.3.2 requires ext-pdo_sqlite * -> the requested PHP extension pdo_sqlite is missing from your system.
- Installation request for teamtnt/tntsearch v1.3.2 -> satisfiable by teamtnt/tntsearch[v1.3.2].
当我通过 ssh 进入 Jenkins 框并从工作区目录运行 composer install
时,一切都按预期运行并且生成了 vendor 目录且没有错误。
我花了很多时间在 StackOverflow 上查看现有问题的答案。
我已经清除了所有不是 php7.2 的东西,并删除了我机器的所有以前版本。
我还安装了 php7.2-pdo_sqlite,并确保它显示在 php.ini 文件中。
我也试过完全删除 php(并使用 php -v
检查),然后重新安装 php7.2。
当我运行 php --ini
时,我看到/etc/php/7.2/cli/conf.d/20-pdo_mysql.ini,并且
/etc/php/7.2/cli/conf.d/20-pdo_sqlite.ini 显示在列表中。
我还授予了对/usr/lib/php/20170718/pdo_sqlite.so 的读取权限,以防出现权限错误。
我还能做些什么来解决上述错误? - 我的目标是能够运行 composer install。
最佳答案
解决方法
如果您的构建管道不需要安装 sqlite
,您可以使用 --ignore-platform-reqs
绕过平台要求检查,如下所示:
composer install --ignore-platform-reqs
来自documentation :
--ignore-platform-reqs: ignore php, hhvm, lib-* and ext-* requirements and force the installation even if the local machine does not fulfill these. See also the platform config option.
不幸的是,如果您有断言 sqlite
功能的测试,这不是解决方案。
关于php - 运行 composer install 时处理 "the requested PHP extension pdo_sqlite is missing from your system. ",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50957285/