2012-03-20 71 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