Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change php.ini - amazon EC2. Problems with permissions

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?

like image 466
Marcin Kusuah Avatar asked Jun 02 '16 11:06

Marcin Kusuah


People also ask

Where is PHP ini in EC2?

It is located at /opt/bitnami/php/etc/php. ini. For example, to modify the default upload limit for PHP, update the PHP configuration file following these instructions.

How do I change my EC2 instance configuration?

To edit an instance's configurationStop the instance, if it is not already stopped. On the Instances page, click an instance name to display the Details page. Click Edit to display the edit page. Edit the instance's configuration, as appropriate.

Can we change the RAM of EC2 instance?

Changing the instance type of your EC2 Linux instance allows you to change the following: Number of CPU cores. Amount of RAM. Amount of assigned instance store space.


2 Answers

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.

like image 131
unixmiah Avatar answered Oct 25 '22 22:10

unixmiah


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

like image 39
sumu kuma Avatar answered Oct 25 '22 22:10

sumu kuma