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


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
    I have edited the answer. The root folder is /, the file is in another place. – Javier Rivera Jun 7 '12 at 7:12

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.


  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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.