I cannot save php.ini in ubuntu 12.04

33,003

Solution 1

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

Solution 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

Share:
33,003

Related videos on Youtube

Soosh
Author by

Soosh

A web developer from India, God's Own Country

Updated on September 18, 2022

Comments

  • Soosh
    Soosh over 1 year

    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

  • Javier Rivera
    Javier Rivera almost 12 years
    I have edited the answer. The root folder is /, the file is in another place.