我在Ubuntu(版本16.04)中创建了一个Laravel项目(版本5.5),但是当我在浏览器上运行它时,得到的错误是这样的:
语法错误,意外'?'在 /opt/lampp/htdocs/lara1/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php 在第233行
我已经搜索了很多,并且发现存在一些版本问题(在浏览器上显示PHP版本5.6,在CLI中显示7.0版本)所以我试图通过使用删除PHP版本5.6命令
apt-get purge 'php5*'
但显示:
Package' php5.6-common'没有安装,所以没有删除
那么如何从cli中删除php 5.6并运行laravel项目而不会出现错误。
我是Laravel和Ubuntu的新手。
请帮我解决这个问题。任何帮助将不胜感激。
提前致谢。
已编辑:
运行sudo时删除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.
答案 0 :(得分: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或更高版本。祝你好运!