gpt4 book ai didi

php - 无法 self 更新 Composer ?

转载 作者:可可西里 更新时间:2023-11-01 12:42:13 25 4
gpt4 key购买 nike

我已经使用 composer 大约一个月了。然后有一天 composer 向我展示了这条消息:

Warning: This development build of composer is over 30 days old. It is recommended to update it by running "/usr/local/bin/composer self-update" to get the latest version.

我已经按照文档全局安装了 composer

which composer
/usr/local/bin/composer

运行 sudo composer self-update 给我这条信息:

/usr/bin/env: php: No such file or directory

我检查过/usr/bin/env使用此命令:

whereis /usr/bin/env
env: /usr/bin/env /usr/bin/X11/env /usr/share/man/man1/env.1.gz

我的 php 版本:

PHP 5.5.1 (cli) (built: Jul 26 2013 19:50:47) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans

看起来 /usr/bin/env 确实存在。

我正在使用 ubuntu 12.04LTS

更新

strace sudo composer self-update 2>&1 | grep open

open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
open("/lib/i386-linux-gnu/libutil.so.1", O_RDONLY|O_CLOEXEC) = 3
open("/lib/i386-linux-gnu/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
open("/lib/i386-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/locale/locale-archive", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
open("/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3
open("/usr/share/locale/en_PH/LC_MESSAGES/sudo.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/sudo.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_PH/LC_MESSAGES/sudo.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en/LC_MESSAGES/sudo.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/var/run/utmp", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3

顺便说一句,我正在使用安装在 /opt 的 xamppphp 在我的PATH 中。

echo $PATH

/home/chanhxc/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/chanhxc/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/lampp/bin:/home/chanhxc/pear/bin:/home/chanhxc/.composer/vendor/bin:/opt/lampp/bin

最佳答案

错误信息:

/usr/bin/env: php: No such file or directory

告诉您未找到 php,即 php-cli 未安装或 php 命令不在您的 PATH 环境变量中。

所以你需要安装(sudo apt-get install php5-cli)或者把它放在你的路径中:

vim ~/.bashrc

PATH=$PATH:/path/to/php-cli/bin
export PATH

更新

根据Composer with XAMPP for Linux问题符号链接(symbolic link) php 可执行文件应该可以解决您的问题:

ln -s/opt/lampp/bin/php/usr/local/bin/php

关于php - 无法 self 更新 Composer ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20092148/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com