vendredi 15 juin 2018

Laravel use custom php.ini with artisan serve

Is there a way to pass a custom php.ini to artisan serve?

I've tried

php -c path/to/my/custom/php.ini artisan serve

This does not seem to affect the web server though?

I know where my .ini files are, and I know how to edit them. I just can't seem to make artisan serve use a custom .ini.

I also looked at:

php artisan serve --help 

and it didn't seem to list any options for setting the .ini.

My reason is that I have a customize .ini file with XDebug enabled. I want to be able to use it when debugging my Laravel app, but I don't want it enabled in my default php.ini

UPDATE

I've looked in

vendor\laravel\framework\src\Illuminate\Foundation\Console\ServeCommand.php

for Laravel 5.6.25 at lines 49-57 and they have this:

 /**
 * Get the full server command.
 *
 * @return string
 */
protected function serverCommand()
{
    return sprintf('%s -S %s:%s %s',
        ProcessUtils::escapeArgument((new PhpExecutableFinder)->find(false)),
        $this->host(),
        $this->port(),
        ProcessUtils::escapeArgument(base_path('server.php'))
    );
}

So it looks like it is not possible to pass in a custom .ini unless the PhpExecutableFinder would include the -c argument for the .ini path?

UPDATE 2

I looked in the PhpExecutableFinder, and it looked as if you could set a PHP_BINARY environment variable to override, however this did not work. It would be possible to have another complete copy of PHP that was configured for testing, but I'd rather have one PHP and just pass in my custom .ini.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2LTwSH7
via IFTTT

Aucun commentaire:

Enregistrer un commentaire