8

I want to change the upload_max_filesize = 2M to 50M, then I started edit on php.ini, but when try to save it, it displays error message below

Could not create a backup file while saving /etc/php5/apache2/php.ini

gedit could not back up the old copy of the file before saving the new one. You can ignore this warning and save the file anyway, but if an error occurs while saving, you could lose the old copy of the file. Save anyway?

cannot save php.ini

3 Answers 3

22

You are opening that file in a folder owned by root! Hence you need root access to that file. Type this code in the terminal:

sudo -H gedit /etc/php5/apache2/php.ini

When the file opens edit the file and you can save it normally by pressing Ctrl+S

1
  • 1
    I have edited the answer. The root folder is /, the file is in another place. Jun 7, 2012 at 7:12
2

You don't have permission when your text editor creates a backup file.

You can either

  1. Run gedit using administrative permission.

    sudo -H gedit /etc/php5/apache2/php.ini
    

    In this part gedit will create a backup file with root permission. A new file will be created with root as owner.

or

  1. You can disable the gedit feature thats create backup copy before saving.

    Go to Edit > Preferences > Editor

    Uncheck Create a backup copy of files before saving

0

By default the file is read-only and you need admin powers for this

sudo -H gedit /opt/lampp/etc/php.ini

Now file will open in gedit and one can edit and save successfully. changes will be visible in you xamp local host info page only after you restart the servers.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .