Change php.ini - amazon EC2. Problems with permissions

17,911

Solution 1

You should never do sudo chown -R ec2-user:ec2-user /etc. You have modified the permission settings of your entire /etc directory.

/etc is a very important folder for your operating system that's why you're getting the error.

launch a new instance and backup your source code from your previous instance and re-upload the code. let me know if you have any issues.

I'm not understanding why you can't modify your php.ini file? You need to ssh into the server and edit the file. If you can't do that, you need to move the file to the ftp folder where it's permissible, modify the file and put the file back to it's original location and restart apache.

Furthermore, I recommend you use Ubuntu for your Wordpress server rather than using Centos or Amazon Flavour of Linux.

Solution 2

log into putty as ec2-user

sudo su

[root@ip-yoursite- home]

now for php 5.0 sudo vim /etc/php.ini

for php 7.0 use sudo vim /etc/php-7.0.ini

press i and now search for upload_max_filesize =100M , post_max_size=100M (change as per your requirement)

press esc ,now save and exit use this command:wq

restart your apache server sudo service httpd restart

Share:
17,911
Marcin Kusuah
Author by

Marcin Kusuah

Updated on June 12, 2022

Comments

  • Marcin Kusuah
    Marcin Kusuah almost 2 years

    I don't have too much experiences with servers but I've tried to do something ;) I have my WP webpage on amazon EC2 and I wanted to edit some settings in php.ini through filezilla (sftp) But I had to set permissions to my user:

    sudo chown -R ec2-user:ec2-user /etc
    

    But now I can't even restart apache or set back permissions to root If i try to do something like this:

    sudo chown -R root:root /etc
    

    or

    sudo systemctl restart apache2.service
    

    I see this information: "sudo: /etc/sudo.conf is owned by uid 500, should be 0 sudo: /etc/sudoers is owned by uid 500, should be 0 sudo: no valid sudoers sources found, quitting sudo: unable to initialize policy plugin"

    What can I do?