在cPanel上安装Laravel项目

问题描述:

我正在尝试将laravel项目设置为cpanel上的子域,但是却遇到了解析问题和错误.

I'm trying to set up a laravel project as a subdomain on cpanel but I'm getting parsing issues, and an error.

这些是我到目前为止已完成的步骤

These are the steps I've done so far

  • 压缩项目并将其上传到此目录public_html/encuestas
  • 解压缩内容并将其移动到上方的目录
  • 使用PuTTY获取ssh访问权限,并将cd进入目录
  • 在PuTTY composer install --ignore-platform-reqs
  • 中执行此命令
  • zip the project and upload it to this directory public_html/encuestas
  • unzip and move contents to the directory above
  • get ssh access with PuTTY and cd into the directory
  • do this command in PuTTY composer install --ignore-platform-reqs

我也通过PuTTY完成了所有工作,从bitbucket克隆了存储库,并得到了相同的结果.

I've also done it all through the PuTTY, cloned the repository from bitbucket with the same results.

命令执行后,我会收到此反馈

After the command I get this feedback

vc@un.net [~/public_html/encuestas]# composer install --ignore-platform-reqs
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump

Parse error: syntax error, unexpected '?' in /home/vc/public_html/encuestas/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php on line 500

当我转到子域encuestas.un.ac.cr时,这是我得到的错误

And when I go to the subdomain encuestas.un.ac.cr this is the error I get

Symfony \ Component \ Translation \ TranslatorInterface :: setLocale($ locale)的声明必须与Symfony \ Contracts \ Translation \ LocaleAwareInterface :: setLocale(string $ locale)兼容

Declaration of Symfony\Component\Translation\TranslatorInterface::setLocale($locale) must be compatible with Symfony\Contracts\Translation\LocaleAwareInterface::setLocale(string $locale)

我不确定这是否相关,但是我怀疑php版本是问题所在,在cpanel中,我将该域的php版本设置为PHP 7.1 (ea-php71),并且这些错误仍然存​​在,但是设置了PHP System Default作为5.6(我不知道如何更改它).这是我在网上找到的解析错误的解决方案,但这没有用.

I'm not sure if this is relevant but I suspect the php versions are the problem, in cpanel I have set the php version of this domain to PHP 7.1 (ea-php71) and these errors still persist, however the PHP System Default is set as 5.6 (I don't know how to change it). This was the solution I found online for the parsing errors but this hasn't worked.

我完全不知道可能发生什么情况或如何解决?

I'm completely lost as to what could be happening or how to fix it?

作曲家更新时,这就是结果

when doing composer update this is the result

vc@un.net [~/public_html/encuestas]# composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - This package requires php ^7.1.3 but your PHP version (5.6.40) does not satisfy that requirement.
  Problem 2
    - barryvdh/laravel-dompdf v0.8.5 requires php >=7 -> your PHP version (5.6.40) does not satisfy that requirement.
    - barryvdh/laravel-dompdf 0.8.x-dev requires php >=7 -> your PHP version (5.6.40) does not satisfy that requirement.
    - barryvdh/laravel-dompdf v0.8.5 requires php >=7 -> your PHP version (5.6.40) does not satisfy that requirement.
    - Installation request for barryvdh/laravel-dompdf ^0.8.5 -> satisfiable by barryvdh/laravel-dompdf[0.8.x-dev, v0.8.5].

在该cPanel子域上,请确保将php版本至少设置为7.1.3,这可以在cpanel本身的MultiPHP Manager

On that cPanel subdomain make sure to set the php version to at least 7.1.3 that can be done in cpanel itself in MultiPHP Manager

之后,您将获得子域的列表,将其选中,然后从右上角选择一个与该软件包至少兼容(7.1.3)的php版本,单击Apply.

After that you will get a list of your subdomains, select it and from the top right choose a php version that works with that package at least(7.1.3) in your case, Click Apply.

如果您的服务器上未安装该php版本,请与管理员联系以激活或安装它.

If you don't have that php version installed on your server then contact the Admin to activate or install it.

如果这不起作用,则对于子域,请尝试将该PHP版本设置为根域.

If that didn't work, for the subdomain, try to set that PHP version to the root domain.

如果您有权访问WHM,则可以通过easyApache面板安装新的PHP版本.

If you have access to WHM you can install a new PHP version through the easyApache panel.

有时您必须重新启动Apache服务器,以使新php正常工作.

Sometimes you have to restart Apache server in order for the new php to work.