fixed several compatibility issues with windows and php-cgi, see #15 #20
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixed #15.
Also, it provides a potential approach to #16, #8, and #9.
The issue is mainly caused by Laravel and Symphony, in Symfony\Component\Process\PhpExecutableFinder, it uses
PHP_BINARY
to locale the PHP executable:Here
PHP_BINARY
is set during runtime and so didPHP_SAPI
. That works fine on normal conditions, but on conditions like running a command from the web interface, problems emerge.If you are using the web interface, PHP would use its CGI Server API instead of CLI Server API. On some Linux distributions this is fine (they share the same executable), but on Windows they are different, one is
php.exe
orphp-cli.exe
, anotherphp-cgi.exe
.Thus PhpExecutableFinder returns wrong PHP executable (
php-cgi.exe
) to Illuminate\Console\Application, in methodformatCommandString
andphpBinary
:And later
formatCommandString
is returned as command string to Illuminate\Console\Scheduling\Illuminate\Console\Schedule, of which build scheduling commands:Note that
Application::formatCommandString($command)
was called and at this stage the wrongly formed string is injected in a protected array defined$events = [];
.At last, in Encore\Admin\Scheduling\Scheduling, method
runTask
fetches that array by usingevent()
:The solution this PR proposed is simple, just add a
php-cgi
tophp
conversion, however, this approach is fraud on extreme conditions, but for most of the users, this approach would work fine.Also, Windows uses
"
, so this PR adds a small compatibility patch for that.Issue #16, #8, and #9 might also have something to do with Symfony\Component\Process\PhpExecutableFinder, I might look for that in the further.
Another patch fix might come out later this week, basically, Artisan::call() works fine because it just creates a container then run the class. But scheduling forms a command then runs it, that's why Artisan::call() is not affected. That patch would permanently resolve issues like #16, #8, and #9.