找不到PHP命令 [英] PHP Command, not found

查看:77
本文介绍了找不到PHP命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过PHP命令(如getcomposer网站中所述)安装 composer
但是bash抛出错误:

I tried to install composer via PHP command like said in getcomposer site,
But the bash throw an error:

 bash: php: command not found

所以我在google中进行了搜索,然后我想出了一些答案,1)将php二进制文件路径添加到 $ PATH 变量
问题是我何时跑步:

So I did a search in google , and I came up with some answers, 1) to add php binary file path to $PATH variable
The problem is when I run:

 find / -name php -type f

我收到此错误:

find: ‘/run/user/1000/gvfs’: Permission denied

即使使用sudo并以root为根

Even with sudo and as a root

2)要安装php-cli软件包,因此我运行

2) To install tht php-cli package, so I run

 pacman -S php7-cli

但是我得到这个错误:

error: target not found: php7-cli

那对我不起作用吗?

我通过XAMPP安装程序安装了php,然后使用manjaro

I installed php via XAMPP installer and I', using manjaro

推荐答案

无论何时安装XAMPP,您都将获得所有的Apache,MySQL和PHP堆栈.问题是,XAMPP不会将二进制文件链接到您的PATH,因为您可能已经安装了该软件的另一个版本.

Whenever you install XAMPP, you get all of the Apache, MySQL, PHP stack. The problem is, XAMPP won't link binaries to your PATH, because your could have another version of that software already installed.

Composer需要PATH上有可用的PHP版本,因此更简单的选择是链接已安装的PHP版本.

Composer needs a PHP version available on your PATH, so the easier option is to link your already installed version of PHP.

我认为您可以在/opt/lamp/bin 中找到您的PHP二进制文件,因此可以通过以下方式进行链接:

I think you can find your PHP binary in /opt/lamp/bin so you can link it this way:

sudo ln -s/opt/llamp/bin/php/usr/bin/php

希望它能起作用!

如果要再次检查PHP二进制位置,则可以转到文件,最后找到其他位置",请单击它,然后再进行检查.

If you want to double check your PHP binary location you can go to files then at the end you can find "other locations" click it and then go and check it.

这篇关于找不到PHP命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆