php-cli在linux上不工作


php cli on linux not working

PHP CLI已突然停止在服务器上工作。当运行任何php文件甚至php-v来获取php版本时,我会得到以下错误。

感谢

# php -v
Unknown option: v
php [-f from_encoding] [-t to_encoding] [-s string] [files...]
php -l
php -r encoding_alias
  -l,--list
     lists all available encodings
  -r,--resolve encoding_alias
    resolve encoding to its (Encode) canonical name
  -f,--from from_encoding
     when omitted, the current locale will be used
  -t,--to to_encoding
     when omitted, the current locale will be used
  -s,--string string
     "string" will be the input instead of STDIN or files
The following are mainly of interest to Encode hackers:
  -D,--debug          show debug information
  -C N | -c | -p      check the validity of the input
  -S,--scheme scheme  use the scheme for conversion

在shell上键入which php,以查找shell从搜索PATH中选择的php可执行文件。

使用ls -l $(which php)查看它是否是指向其他可执行文件的符号链接。

运行php -v时所看到的实际上是piconv命令的输出。

最有可能的是,在您的搜索PATH中,有一个名为php的符号链接指向piconv

键入echo $PATH以查看shell搜索可执行文件php的目录顺序。

编辑:在上面的命令中将whereis更改为which