0
votes

I am deploying a laravel 5.5.12 app on WHM cpanel. As per laravel documentation (https://laravel.com/docs/5.5/installation#server-requirements) all the server requirements are okay: phpinfo(); results in following:

PHP >= 7.1.3
OpenSSL support enabled
PDO support enabled
Multibyte Support   enabled (mbstring)
Tokenizer Support   enabled
XML Support active
Ctype PHP Extension enabled
JSON PHP Extension  enabled

i have done following steps (https://crescentke.com/uploading-laravel-5-to-cpanel-server/)

  1. uploaded laravel folder to /home/mylaravel (except public and node_modules)
  2. uploaded public folder contents to /home/public_html
  3. changed permission of storage, vendor and bootstrap/cache to 777.
  4. changed following lines in /home/public_html/index.php

    require DIR.'/../mylaravel/bootstrap/autoload.php';

    $app = require_once DIR.'/../mylaravel/bootstrap/app.php';

  5. changed following line in /home/mylaravel/server.php

    require_once DIR.'/public_html/index.php';

  6. create a database and added a user to it will full rights, this database, user name are updated in /home/mylaravel/.env file

  7. updated the .env file with live server URL
  8. for storage folder link inside the public_html, created a php file inside pulic_html will following content and accessed it via URL to create the symlink

    symlink('/home/gfree/go4ree/storage/app/public','/home/gfree/public_html/storage');

NOW at last when i visit the webpage it gives http 500 error. in log file following log is created:

[11-Jun-2018 11:37:57 UTC] PHP Parse error:  syntax error, unexpected '?', expecting variable (T_VARIABLE) in /home/gfree/go4ree/vendor/symfony/finder/Comparator/NumberComparator.php on line 42
[11-Jun-2018 11:37:57 UTC] PHP Fatal error:  Exception thrown without a stack frame in Unknown on line 0

whats (on earth) left to do?

1
As this is a parse error, could you post the code around line 42 in that NumberComparator file?Niels
There's an issue posted for Laravel 5.6 github.com/laravel/framework/issues/23069. The solution is "use php 7.1" but unsure if that will fix your issue as 5.5 only requires 7.0IsThisJavascript
Are you sure you're deploying laravel 5.5 because this issue should not persist if that's true..IsThisJavascript
@Niels its following code on line 42: public function __construct(?string $test) yes, there is a ? on it but where it comes from?mhk
@IsThisJavascript yes mate, my bad its 5.6.12... i update the question... sorry for inconvenience... ?mhk

1 Answers

2
votes

The errors appeared because of misunderstanding of laravel version, i have updated the question for any future reference or for some novice like me.

The following artisan command gives you the laravel framework version:

php artisan --version

visit this page to check the server requirements : https://laravel.com/docs/5.6/installation#server-requirements (please note the version)

just make sure the live server met all the prerequisites... rest of the steps of configuration are already stated in question...