简体   繁体   中英

How to change php.ini in vagrant?

I want to change for every machine on Vagrant (sudo nano /etc/php/7.2/cli/php.ini change for current machine)

upload_max_filesize
post_max_size
max_execution_time

Please, help me. PS I tried

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\'

and

  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

But it doesn't work. Thanks, for any helping

PSS Answer (in 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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM