Modify php.ini on Laravel Homestead

放肆的年华 提交于 2020-01-06 06:40:48

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!