Laravel 5.5:创建项目时出错

问题描述 投票:0回答:1

我在Ubuntu(版本16.04)中创建了Laravel(版本5.5)的项目,但是当我在浏览器上运行它时,得到如下错误:

语法错误,意外'?'位于第233行的/opt/lampp/htdocs/lara1/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php

我已经搜索了很多,并得到了一些版本问题(在浏览器上显示PHP版本5.6,在CLI中显示为7.0)所以我试图通过使用命令删除PHP版本5.6

apt-get purge 'php5*'

但它显示:

软件包'php5.6-common'未安装,因此未删除

那么如何从cli中删除php 5.6并运行laravel项目而不会出现错误。

我是Laravel和Ubuntu的新手。

请帮我搞定。任何帮助将不胜感激。

提前致谢。

编辑:

同时运行sudo apt删除php5.6获取

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'php5.6-json' for regex 'php5.6'
Note, selecting 'php5.6-common' for regex 'php5.6'
Package 'php5.6-common' is not installed, so not removed
Package 'php5.6-json' is not installed, so not removed
The following packages were automatically installed and are no longer required:
libllvm3.8 libllvm3.8:i386 libmircommon5 libpango1.0-0 libsnapd-glib1
linux-headers-4.4.0-71 linux-headers-4.4.0-71-generic linux-headers-4.4.0-72
linux-headers-4.4.0-72-generic linux-headers-4.4.0-75
linux-headers-4.4.0-75-generic linux-headers-4.4.0-78
linux-headers-4.4.0-78-generic linux-headers-4.4.0-79
linux-headers-4.4.0-79-generic linux-headers-4.4.0-81
linux-headers-4.4.0-81-generic linux-headers-4.4.0-83
linux-headers-4.4.0-83-generic linux-headers-4.4.0-87
linux-headers-4.4.0-87-generic linux-headers-4.4.0-89
linux-headers-4.4.0-89-generic linux-headers-4.4.0-92
linux-headers-4.4.0-92-generic linux-image-4.4.0-71-generic
linux-image-4.4.0-72-generic linux-image-4.4.0-75-generic
linux-image-4.4.0-78-generic linux-image-4.4.0-79-generic
linux-image-4.4.0-81-generic linux-image-4.4.0-83-generic
linux-image-4.4.0-87-generic linux-image-4.4.0-89-generic
linux-image-4.4.0-92-generic linux-image-extra-4.4.0-71-generic
linux-image-extra-4.4.0-72-generic linux-image-extra-4.4.0-75-generic
linux-image-extra-4.4.0-78-generic linux-image-extra-4.4.0-79-generic
linux-image-extra-4.4.0-81-generic linux-image-extra-4.4.0-83-generic
linux-image-extra-4.4.0-87-generic linux-image-extra-4.4.0-89-generic
linux-image-extra-4.4.0-92-generic snapd-login-service ubuntu-core-launcher
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 212 not upgraded.
php laravel
1个回答
0
投票

你不需要删除旧的PHP.It表示php解释器是7但php-fpm是5.6。这是因为端口9000是由属于php56的php-fpm监听的。所以你应该停止关于php-fpm的所有过程

sudo killall php-fpm  // or sudo pkill -9 php-fpm

然后转到php7文件夹并运行php-fpm进程。希望能帮助到你。更重要的是,你有正确的方向。 Laravel5.5需要php7或更高版本。祝你好运!

© www.soinside.com 2019 - 2024. All rights reserved.