php - Laravel 5.5 and PHP incompatibility
问题描述
I was trying to setup a Laravel project in a server which I don't have ssh access, just cPanel access, so I came in with the problem that it seems that the server is not recognizing the right PHP version, Laravel's version I was trying to setup is 5.5. phpinfo()
outputs version 7.0.22.
Inside cPanel there's a module called "PHP configuration" and it is set to version 7.
How can I solve this problem, I really want to use Laravel 5.5 or above, it is worth mentioning that I don't have contact with the server owner, I'm limited just to cPanel.
It is throwing the following error:
Parse error: syntax error, unexpected '?', expecting variable in /vendor/symfony/translation/Translator.php line 79
which is
public function __construct(?string $locale, ...
That is how I know it is not recognizing the right php version.
EDIT:
Just to clear out, I just thought that was the problem because I have had already that issue sometime in the past and read similar posts, but if that's not the case, I would appreciate that to be pointed out and not just silly jokes like "a bird flew", maybe other people are in the same problem and think of the same reason and this question could be useful to them.
解决方案
原来是服务器的PHP版本与问题无关,问题是,由于我无法访问SSH,我必须在本地计算机上安装Laravel,然后将所有文件复制并放入服务器中, 但是我的电脑是 PHP 7.1,虽然 Laravel 的版本确实是 5.5,但 PHP 7.1 的一些特性被应用到了 Laravel 安装上。
所以解决方案就是在 PHP 7.0.* 安装中安装 Laravel 5.5,以使其在 PHP 7.0.22 的服务器中工作
相关 GitHub 问题 ~ https://github.com/laravel/framework/issues/23559
推荐阅读
- php - 使用 ImageMagick 使用图像数据库比较图像?
- python - 如何编写正则表达式以返回 url 中的关键字?
- python - 为什么 xlrd 将文本格式的数字读取为浮点数?
- javascript - 如何将 div 位置传递给子元素
- java - 使用 Keyclock Tomcat 客户端适配器 ACS 的问题
- python - 在 Python 中将值设置为全局变量
- c# - 如何使用asp.net核心中的SQL数据填充pdf中的复选框,c#
- html - 如何实现多行文本加载动画?
- c# - Xamarin 表单中的 SqlDependency
- azure-sql-database - 使用 Azure 数据工厂在 sql azure 中移动数据库的一部分