我看了一些类似的问题,除了他们的php -v
版本高于phpinfo()
报告版本之外,他们也有类似的问题。当我从PHP文件中调用phpinfo()
时,它显示5.5.25是正确的。在通过ssh的终端中,我运行php -v
,它给出了5.4.43。我正在使用GoDaddy托管,在cPanel上将其设置为5.5。我正在使用Composer和Laravel。当我创建一个新的Laravel项目时,它给了我这个错误:
[~/public_html]$ laravel new blog
Crafting application...
> php -r "copy('.env.example', '.env');"
> php artisan clear-compiled
Script php artisan clear-compiled handling the post-install-cmd event returned with an error
[RuntimeException]
Error Output:
run-script [--dev] [--no-dev] [-l|--list] [script] [args1] ... [argsN]
Application ready! Build something amazing.
最佳答案
您需要使用其他路径来获取正确版本的命令行PHP。
使用
which -a php
要获取可用PHP版本的路径,请使用完整路径名。
例如
/usr/bin/php5
关于php - 为什么我的php -v版本与phpinfo()不同?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32940844/