Closed captainhook closed 4 years ago
This is a known issue. For some reason, Compass is creating a Process
object to run Artisan commands instead of using the Artisan
facade directly (Ref). This means it's calling php
directly, which uses the version of php that's found on the system path (5.6 in your case). I think the correct solution is to require everyone to set up their servers correctly, but obviously that's not user-friendly, and won't win me any points. So instead, we're going to change the code to use the Artisan facade, so that it will use the same php instance that's already running the site.
Excellent!
Some servers do require varying PHP versions/have many software running on it simultaneously, so that would be an excellent solution.
This issue has been automatically locked since there has not been any recent activity after it was closed. If you have further questions please ask in our Slack group.
Description:
I am using Plesk, and have used PHP 7 to install Laravel and Voyager. By default any system with Plesk installed uses the core 5.6 version. So I am using
/opt/plesk/php/7.0/bin/php ...
to call the correct version each time.Voyager compass uses the fixed command,
php artisan
and so follows the system's built in config, and throws the errorPHP Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /var/www/vhosts/domain.com/laravel/artisan on line 33
Where in my case it should be/opt/plesk/php/7.0/bin/php artisan make:model ...
Suggestion:
To make Compass work for an instance with multiple PHP versions, could there perhaps be a config in config/voyager.php which allows the php pathto be modified from the default? I believe this scenario would be quite common.