Laravel:熟练的工匠会给我“输入中的意外字符"错误 [英] Laravel: running artisan gives me "Unexpected character in input" error

查看:95
本文介绍了Laravel:熟练的工匠会给我“输入中的意外字符"错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在生产环境(Debian Linux,私有服务器)中运行php artisan list时,出现以下错误:

When I run php artisan list in my production environment (Debian Linux, private server), I get the following error:

Warning: Unexpected character in input:  
'\' (ASCII=92) state=1 in /home/user/app/artisan on line 46

Parse error: syntax error, unexpected T_STRING in 
/home/user/app/artisan on line 46

那是为什么,我该如何解决?

Why is that and how can I fix this?

推荐答案

因此此行存在解析错误:

So there's a parse error on this line:

$artisan = Illuminate\Console\Application::start($app);

PHP解析器不希望在那里有\,该\用于命名空间,这是PHP 5.3中引入的,这意味着您正在运行旧的PHP版本.您应该将PHP安装至少更新为PHP 5.3.

The PHP parser didn't expect a \ there, which is used for namespaces, which were introduced in PHP 5.3, which means that you're running an older PHP version. You should update your PHP instalation to at least PHP 5.3.

我的托管公司同时安装了PHP 5.2和5.3,因此我只运行:

My hosting company has both PHP 5.2 and 5.3 installed, so I just run:

/usr/local/php53/bin/php artisan migrate

这篇关于Laravel:熟练的工匠会给我“输入中的意外字符"错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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