laravel 使用 composer 安装组件遇到的问题解决 - 简书 ---- 补充

问题1

Failed to initialize global composer: Composer could not find the config file: /root/.composer/composer.json
composer config -l -g
  • 在输出的结果中,其中的 【home】 配置项内容就是了composer的主目录,然后进入vendor\bin,将这个路径加入环境变量。
export PATH="$PATH:$HOME/.composer/vendor/bin"
echo 'export PATH="$PATH:$HOME/.composer/vendor/bin"' >> ~/.bashrc
source ~/.bashrc

输出

php [Symfony\Component\Process\Exception\RuntimeException] The Process class relies on proc_open, which is not availableon your PHP installation.
  • 仔细一看原来是php禁用了proc_open,开启这些函数:
  • 修改php.ini,查找 disable_functions 把proc_open去除即可

原来就是这样的

; passthru, proc_open,proc_get_status, ,popepassthru,stream_socket_server,fsocket,popen
disable_functions = exec,system,chroot,chgrp,chown,shell_exec,ini_alter,ini_restore,dl,readlink,symlink
[linjinyu@localhost deepmind]$ composer require stichoza/google-translate-php
PHP Warning:  PHP Startup: Unable to load dynamic library 'curl' (tried: /usr/local/php/lib/php/extensions/no-debug-non-zts-20180731/curl (/usr/local/php/lib/php/extensions/no-debug-non-zts-20180731/curl: cannot open shared object file: No such file or directory), /usr/local/php/lib/php/extensions/no-debug-non-zts-20180731/curl.so (/usr/local/php/lib/php/extensions/no-debug-non-zts-20180731/curl.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP Warning:  Module 'fileinfo' already loaded in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'curl' (tried: /usr/local/php/lib/php/extensions/no-debug-non-zts-20180731/curl (/usr/local/php/lib/php/extensions/no-debug-non-zts-20180731/curl: cannot open shared object file: No such file or directory), /usr/local/php/lib/php/extensions/no-debug-non-zts-20180731/curl.so (/usr/local/php/lib/php/extensions/no-debug-non-zts-20180731/curl.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP Warning:  Module 'fileinfo' already loaded in Unknown on line 0

我的问题也解决了

新的php已经不会有自己的curl.so, 从php7.0 7.1 升到 7.3 后
在去 /usr/local/php/etc/php.ini 搜 curl.so 注释
就没问题
重复加载fileinfo 也是这个问题 新的作了配置转移

/usr/local/php/etc/php.d/
├── 02-opcache.ini
├── 03-imagick.ini
├── 04-fileinfo.ini
├── 05-memcached.ini
├── 05-memcache.ini
├── 05-redis.ini
├── 06-swoole.ini
├── 07-mongodb.ini
└── 08-xdebug.ini

Original url: Access
Created at: 2020-01-09 17:48:14
Category: default
Tags: none

请先后发表评论
  • 最新评论
  • 总共0条评论