Voyager: Artisan Commands Fail: Add ability to configure PHP Path in ENV file.

Created on 9 Nov 2017  路  6Comments  路  Source: the-control-group/voyager

  • Laravel Version: 5.5.*
  • Voyager Version: ^1.0
  • PHP Version: 7.1.*
  • Database Driver & Version: n/a

Description:

Voyager needs the ability to define the php path in the env file. Currently I can't use any of the artisan based features because both my local and remote environments use multiple versions of php. For example if I want to use php 7.1, I must specify a handler which uses a binary named php71.

If you could simply add the ability to define the php path in the env file that would help developers in my position. Thank you!

Steps To Reproduce:

Install on a server where php7 binary is not in expect path or uses unexpected file name.

Technical Debt help wanted open for suggestions possible bug

All 6 comments

This really isn't a Voyager issue, since default Laravel commands use the default php as well. You can try something like this: https://stackoverflow.com/a/31839067

This is as far as I can go since this issue isn't specific to Voyager.

That's actually Incorrect. Artisan commands can be run by specifying the php path in the command. "any/path/I/want/php artisan something". Laravel also allows us to change that in our composer file as well which is why I've had no issues up until now.

Your implementation of the Symfony process component assumes the php path when it can be specified easily with an ENV variable, literally less then one line of code. I would do it myself but I don't want to make a fork for one line of code.

Literally one function call to env() would solve the issue.

OLD
$process = new Process('cd '.base_path().' && php artisan '.$command.$args);

NEW
$process = new Process('cd '.base_path().' && '.env('PHP_PATH', 'php').' artisan '.$command.$args);

Wait, where are we creating a Process for an artisan call...? We can just call the Artisan facade...

Lol oh yeah, I forgot about that, obviously the best approach. Also there's two classes stuffed into one, might want to separate concerns.

VoyagerCompassController.php line: 70

yeah, just found it myself as well... hmm, okay. I agree that it could be a problem, but I don't necessarily agree with your env solution. I'll reopen this pending a solution.

Thanks for understanding. I appreciate all the effort that when into the package. Amazing work. Looking forward to having this as a replacement for my WP clients to get them onboard with the Laravel ecosystem :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

IvanBohonosiuk picture IvanBohonosiuk  路  4Comments

zzpwestlife picture zzpwestlife  路  3Comments

Nagendra1421 picture Nagendra1421  路  3Comments

wp-src picture wp-src  路  3Comments

TXRRNT picture TXRRNT  路  3Comments