7

Does anyone know how to edit the mail setting in the php.ini file by using Vagrant.

so I would ssh in terminal like so:

cd myapp

vagrant ssh

then what>?

the_unforgiven_II
  • 361
  • 3
  • 10
  • 28
  • 1
    Depends a lot on how PHP is being installed and what OS your box is using. Seeing the vagrantfile and any scripts you use to configure the box after it's initialized would help. – tmountjr Apr 10 '14 at 20:36
  • its quite lengthy so pasted the full vagrantfile here > https://gist.github.com/lstables/10421433 – the_unforgiven_II Apr 10 '14 at 20:44

3 Answers3

22

Depending on your box, it might be

sudo nano /etc/php5/apache2/php.ini

then adopt you changes and restart with

sudo service apache2 restart
sinini
  • 1,403
  • 3
  • 19
  • 27
5

Without knowing what specific setting you want and what you want it changed to, you could try adding a shell script to the end of your Vagrantfile (in the "Local Scripts" area) to do a search and replace on the ini file.

#!/usr/bin/env bash

sed -i.bak s/STRING_TO_REPLACE/STRING_TO_REPLACE_IT_WITH/g /etc/php5/apache2/php.ini

Failing that, you can use ini_set in your project (preferably in a bootstrap) to change mail settings on a per-project basis.

tmountjr
  • 1,423
  • 2
  • 22
  • 38
  • Ok maybe i'll just use ini_set then nothing major just windered how to do with Vagrant – the_unforgiven_II Apr 10 '14 at 21:30
  • Have a look at Puppet - it's a little more complicated but you can make that kind of configuration change right in the Puppetfile without having to mess with shell scripts or remembering to set something in code later. A really good resource starting out is PuPHPet - https://puphpet.com/. – tmountjr Apr 11 '14 at 13:50
  • Yeah tried that but got a little confused.com over it! – the_unforgiven_II Apr 11 '14 at 20:04
2

In my case where I'm using scotchbox on vagrant, changing the php.ini file won't reflect changes in phpinfo() function output so I changed /etc/php5/apache2/conf.d/user.ini file which could be a bare file or a file with few lines declaring php error display, I add my configurations here e.g. upload_max_filesize = 64MSave the change and issue sudo service apache2 restart. Viewed the phpinfo page and I can see the updated filesize.

Devtype
  • 221
  • 2
  • 9