如何在vagrant中更改php.ini?

时间:2018-04-24 08:04:32

标签: php vagrant yii2-advanced-app

我想改变Vagrant上的每台机器(sudo nano /etc/php/7.2/cli/php.ini更改当前机器)

upload_max_filesize
post_max_size
max_execution_time

请帮帮我。 附:我试过了

sudo bash -c \'echo export "max_execution_time = 60" >> /etc/php/7.2/cli/php.ini\'
      sudo bash -c \'echo export "post_max_size = 80M" >> /etc/php/7.2/cli/php.ini\'
      sudo bash -c \'echo export "upload_max_filesize = 80M" >> /etc/php/7.2/cli/php.ini\'

  sed -i.bak s/max_execution_time = 30/max_execution_time = 60/g 
  /etc/php/7.2/cli/php.ini

  sed -i.bak s/post_max_size = 8M/post_max_size = 80M/g 
  /etc/php/7.2/cli/php.ini

  sed -i.bak s/upload_max_filesize = 2M/upload_max_filesize = 80M/g 
  /etc/php/7.2/cli/php.ini

但它不起作用。 谢谢,任何帮助

P.S.S。答案(在Vagrantfile中):

 config.vm.provision "shell", inline: <<-SHELL
      sed -i.bak s/max_execution_time = 30/max_execution_time = 60/g /etc/php/7.2/cli/php.ini
      systemctl restart php7.2-fpm.service
  SHELL

1 个答案:

答案 0 :(得分:2)

你运行了systemctl restart php7.2-fpm.service

吗?