Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. P.S. 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

P.S.S. 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
like image 776
Ksenia Subbotina Avatar asked Apr 24 '18 08:04

Ksenia Subbotina


1 Answers

did you run systemctl restart php7.2-fpm.service

like image 135
Masterton Avatar answered Oct 31 '22 04:10

Masterton