Laravel: running artisan gives me “Unexpected character in input” error

与世无争的帅哥 提交于 2019-12-10 16:44:58

问题


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?


回答1:


So there's a parse error on this line:

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

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.

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

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


来源:https://stackoverflow.com/questions/14975613/laravel-running-artisan-gives-me-unexpected-character-in-input-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!