问题
Is there anyway to change the php.ini file on Laravel homestead? For instance, I want to have the short_open_tags set to On - however I can't see an easy way to do this - Apart from going into the php.ini file and changing it every single time I boot homestead?? I can't be doing that each time.
There has to be an easier way to simply override some settings in Laravel homestead. What if I want larger file uploading, different time local etc?
How can I achieve this? I've tried using the ini_set()
command at the top of my php files, but that changes nothing.
回答1:
You shouldn't need to modify php.ini
to enable <?=
on any version of PHP Homestead supports.
http://php.net/manual/en/language.basic-syntax.phptags.php
5.4.0 The tag <?= is always available regardless of the short_open_tag ini setting.
If you do want to change ini settings you should do that in your after.sh
script and use the style we use in settler via sed
commands: https://github.com/laravel/settler/blob/master/scripts/provision.sh#L107-L125 Just make sure you're editing the right php.ini
, there is one for each version of PHP in Homestead (5.6, 7.0, 7.1, 7.2) You'll also want to restart the FPM service after changing any values.
来源:https://stackoverflow.com/questions/49132132/modify-php-ini-on-laravel-homestead