Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

manoaratefy's avatar

Preserve PHP parameters when running Artisan call from schedule

Good morning, At this time, I'm facing an issue with PHP parameters. I'm tying to run $schedule->command from schedule. The problem is that due to the custom PHP implementation in my server, I have to enable manually extensions using php -d extension=json.so -d extension=pdo.so ...

These settings seems not be preserved at the Artisan command level. Each command I run with $schedule->command states that there are some missing extension.

How to push these PHP binaries parameters to the Artisan command? Note that I can't change php.ini to pre-enable these extensions without using PHP binary parameters.

0 likes
8 replies
manoaratefy's avatar

@bugsysha I'm running this on my own hosting platform (we own the server, the network and the datacenter). As stated before, I don't want to change any environment variable in the server. I need to keep these extensions disabled outside Laravel.

manoaratefy's avatar

@martinbean This is already in place. Extensions is effective inside the App/Console/Kernel.php, but once I call $schedule->command('foo:bar'), extensions specified above is not anymore effective within the Artisan command foo:bar.

martinbean's avatar

@manoaratefy Then set up your server properly. You’ve already mentioned you’re self-hosting this website. So just enable the extensions that this website actually needs.

manoaratefy's avatar

@martinbean Yes but no. I'm self hosting the Laravel instance, but the Laravel project itself is a control panel for PHP. It allows admin to enable/disable some PHP extensions. It should be able to re-enable his required PHP extension by itself, and should not affect any other app's PHP extension in the server by enabling extension for himself.

Snapey's avatar

I think I read that schedule command is running exec artisan

since you cannot add the parameters you need to the exec, I would convert the command to a class that can be called direct from the scheduler, or a closure

Please or to participate in this conversation.