Skip to content

Commit d5f7a22

Browse files
committed
Added option to specify the full PHP binary path
1 parent 264c5c8 commit d5f7a22

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,14 @@ Please note that not all clients support direct SSE connections. For those situa
273273
274274
If you get this error, it likely means there's some error happening in your application. Check your applicationlogs for more details.
275275
276+
**Error: spawn php ENOENT**
277+
278+
This can happen when your "php" binary is not in the PATH. This can be solved in a few ways:
279+
280+
- Add the path to your `.bashrc` or `.zshrc` file. Sometimes it can be only in the `.zshrc` file but applications like Claude use `.bashrc`.
281+
- Use the full path of the PHP binary. You can get it by running `which php` in your terminal.
282+
* This can be a good option to ensure you always use the proper version of PHP for a given project. If you use Herd, for example, your `php` will change depending on the selected version.
283+
276284
**Make sure to check your application logs**
277285
278286
If you are getting an unkown error, check your application logs for more details.

src/Commands/LoopMcpConfigCommand.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
class LoopMcpConfigCommand extends Command
1010
{
1111
protected $signature = 'loop:mcp:generate-config
12-
{--url= : The base URL of your application (optional, defaults to config("app.url"))}';
12+
{--url= : The base URL of your application (optional, defaults to config("app.url"))}
13+
{--php-binary-path= : The PHP binary path to (optional, defaults to `php`)}';
1314

1415
protected $description = 'Generate MCP server configuration to configure Laravel Loop in your MCP client';
1516

@@ -149,7 +150,7 @@ private function generateCursorDeeplink(string $projectPath, ?string $userId, ?s
149150
}
150151

151152
$config = [
152-
'command' => 'php',
153+
'command' => $this->getPhpBinary(),
153154
'args' => [
154155
"{$projectPath}/artisan",
155156
'loop:mcp:start',
@@ -198,7 +199,7 @@ private function generateJsonConfig(string $projectPath, ?string $userId, ?strin
198199
$config = [
199200
'mcpServers' => [
200201
'laravel-loop-mcp' => [
201-
'command' => 'php',
202+
'command' => $this->getPhpBinary(),
202203
'args' => $args,
203204
],
204205
],
@@ -412,4 +413,13 @@ private function additionalHttpSetupMessages(): void
412413
$this->line('2. Configure an authentication middleware in config/loop.php');
413414
$this->line('3. Ensure your Laravel application is running and accessible through the configured base URL');
414415
}
416+
417+
private function getPhpBinary(): string
418+
{
419+
if ($this->option('php-binary-path')) {
420+
return (string) $this->option('php-binary-path');
421+
}
422+
423+
return 'php';
424+
}
415425
}

src/Concerns/LogsMessages.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ trait LogsMessages
1111
*/
1212
public function log(string $message, array $context = [], string $level = 'info'): void
1313
{
14-
if ($level !== 'error' && ! config()->boolean('loop.debug')) {
14+
if ($level !== 'error' && ! config()->boolean('loop.debug', false)) {
1515
return;
1616
}
1717

0 commit comments

Comments
 (0)