2012-03-20 75 views
0

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

感谢

# 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 
+1

检查您的搜索路径任何调用自己的PHP不是 – 2012-03-20 09:58:03

回答

0

类型which php上你的shell中找到您的搜索PATHphp执行你的shell选秀权。

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

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

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

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

编辑: 更改whereiswhich在上面的命令。

+0

试图做哪个php。我获得以下 []#的PHP 的/ usr/bin中/ PHP的 []#LS -l $(其PHP) -rwxr-XR-X 1根根5843 2010年9月3日的/ usr/bin中/ PHP的我们可以使用/ usr/kerberos/bin:/ usr/local/sbin:/ usr/local/bin:/ sbin:/ bin:/ usr/sbin:/ usr/bin:/ root/bin 似乎没有符号链接,它指向正确的php cli。 :confused – user1280545 2012-03-20 13:38:32

+0

@ user1280545:最新输出为'/ usr/bin/php -v'吗?如果它相同,那么可能有人(你?)用'piconv'的内容覆盖了'php'二进制文件。如果你编辑该文件,你应该看到一些Perl代码。 – Kaii 2012-03-20 13:40:32

+0

是的,我认为是这样。我只是做了/ usr/bin/php -v并得到了相同的输出,然后做了nano/use/bin/php,并在文件中找到了ipconv perl代码。我现在怎样才能修补这个问题,并将php cli放回原处。我不知道这是怎么发生的....顺便说一句,非常感谢你的帮助到目前为止 – user1280545 2012-03-20 14:14:13