Setup Laravel project on cPanel

孤者浪人 提交于 2020-02-06 08:03:46

问题


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

  • 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

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

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

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

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?

EDIT: 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].


回答1:


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

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.

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

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

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

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



来源:https://stackoverflow.com/questions/60062542/setup-laravel-project-on-cpanel

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