2

I'm using EasyApache 4 and Laravel 5.5 to deploy an API on a shared host. I got the project running at same level than public_html. In public_html, there's only project's public_html files. Now if I access my routes, they work fine. They where not, before, I was getting this error, which means it was not running on PHP7. So I fixed with EasyApache and run PHP 7 on that account.

The problem If I access server trough ssh, cd to project's folder and run:

php artisan db:migrate

I got the same error again:

Parse error: syntax error, unexpected '?' in /home/someaccount/project/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php on line 233

And if I google, that's the cause: the project is running on PHP < 7. So that's my question: does EasyApache only applies PHP versions on public_html folder?

UPDATE: I got full access to WHM and SSH, is there a way to make PHP 7 default?

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
Marcelo Agimóvel
  • 1,668
  • 2
  • 20
  • 25
  • It may be quite complicated to change default PHP in console. However it could be enough to use `ea-php70` or something instead of `php`. – Michas Nov 04 '17 at 02:15
  • @Michas I did. My account is running with php7 and laravel codes are running fine. However, php artisan throw's this error wich means php7 is not installed ?! – Marcelo Agimóvel Nov 04 '17 at 03:00
  • 1
    Do You have this error if You type in console `ea-php70 artisan db:migrate` and `ea-php71 artisan db:migrate` ? – Michas Nov 04 '17 at 21:02
  • @Michas that's right! But not only ea-php70, I'll post full answer. – Marcelo Agimóvel Nov 05 '17 at 11:33

2 Answers2

1

Go to root and create an .htaccess file with these lines in it:

<IfModule mime_module>
  AddType application/x-httpd-ea-php70 .php .php7 .phtml
</IfModule>

Then you can check in root from terminal to see result: php -v

0

Solution Call this /opt/cpanel/ea-php71/root/usr/bin/php artisan db:migrate

Marcelo Agimóvel
  • 1,668
  • 2
  • 20
  • 25