Score:0

Why can't I change php.ini?

cn flag

I hosted a WordPress website on Ubuntu 20.04 via LAMP. Now when I try to install a theme, "The uploaded file exceeds the upload_max_filesize directive in php.ini." this error occurs. I can't save by changing upload_max_filesize in /etc/php/7.4/cli/php.ini.

As you can see in the image below, it says Read Only next to the name of the php.ini file.

Now how can I edit this file?

Score:0
mx flag

You should edit this file as root user. From terminal:

sudoedit /etc/php/7.4/cli/php.ini
Score:0
in flag

Unless you are uploading files via the command line interface (CLI), this may not be the file you’re looking for. Apache uses the php.ini file found in /etc/php/7.4/apache2.

  1. SSH into to your server (if you’re not already connected)

  2. Edit the file with your preferred text editor and sudo:

    sudo vi /etc/php/7.4/apache2/php.ini
    

    If you choose to use vi like in the example above, you can:

    1. find the configuration value quickly by typing ?, then the value name: upload_max_filesize
    2. Set vi to “edit mode” by pressing I
    3. Change the value to something you prefer, such as 128M
  3. Save the file

    If you are using vi, you can:

    1. Exit “edit mode” by pressing Esc
    2. Issue the command to Write the file and Quit the editor: :WQ
  4. Restart the web server:

    sudo service apache2 restart
    

That’s all there is to it

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.