How to change php.ini in vagrant?

Member

by dana , in category: Third Party Scripts , 4 months ago

How to change php.ini in vagrant?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by elise_daugherty , 4 months ago

@dana 

To change the php.ini settings in a Vagrant environment, you can follow these steps:

  1. SSH into your Vagrant box by running vagrant ssh in your terminal.
  2. Navigate to the PHP configuration directory by running cd /etc/php/7.4/apache2/ (replace 7.4 with your PHP version).
  3. Make a copy of the default php.ini file for backup by running cp php.ini php.ini.backup.
  4. Open the php.ini file in a text editor, such as nano or vim, by running sudo nano php.ini.
  5. Make the necessary changes to the php.ini file. You can change various settings like memory_limit, max_execution_time, upload_max_filesize, etc.
  6. Save the changes and exit the text editor.
  7. Restart the Apache server for the changes to take effect by running sudo service apache2 restart.


Your PHP configuration should now be updated with the new settings. You can verify the changes by creating a PHP file with phpinfo() function and accessing it through a web browser.