From 248848356d9c980d76d5065e7a9804b252d6e326 Mon Sep 17 00:00:00 2001 From: overtrue Date: Sun, 2 Apr 2017 10:24:26 +0800 Subject: [PATCH] :bug: Fixed error PHP binary path when running in cgi mode. #18 --- src/Linter.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Linter.php b/src/Linter.php index e152de5b..74e68488 100644 --- a/src/Linter.php +++ b/src/Linter.php @@ -87,6 +87,7 @@ public function lint($files = [], $cache = true) $errors = []; $running = []; $newCache = []; + $phpbin = PHP_SAPI == 'cli' ? PHP_BINARY : PHP_BINDIR .'/php'; while (!empty($files) || !empty($running)) { for ($i = count($running); !empty($files) && $i < $this->procLimit; ++$i) { @@ -94,7 +95,7 @@ public function lint($files = [], $cache = true) $filename = $file->getRealpath(); if (!isset($this->cache[$filename]) || $this->cache[$filename] !== md5_file($filename)) { - $running[$filename] = new Lint(PHP_BINARY.' -d error_reporting=E_ALL -d display_errors=On -l '.escapeshellarg($filename)); + $running[$filename] = new Lint($phpbin.' -d error_reporting=E_ALL -d display_errors=On -l '.escapeshellarg($filename)); $running[$filename]->start(); } else { $newCache[$filename] = $this->cache[$filename];