-3

I'm trying to restart my amazon EC2 Apache server, and I'm getting an error message that says

(13)Permission denied: AH00058: Error retrieving pid file /var/run/httpd/httpd.pid AH00059: Remove it before continuing if it is corrupted.

I'm trying to restart it using apachectl graceful.


Can't post an image due to rep, but here's exactly what Terminal is showing:

Last login: Thu Feb 25 21:53:05 on ttys001
Jeffs-MacBook-Pro:~ jeffArries$ ssh -i /Users/jeffArries/Desktop/jeffarries.pem ec2-user@ec2-54-213-219-247.us-west-2.compute.amazonaws.com
Last login: Fri Feb 26 05:53:07 2016 from 71.83.110.240

       __|  __|_  )
       _|  (     /   Amazon Linux AMI
      ___|\___|___|

https://aws.amazon.com/amazon-linux-ami/2015.09-release-notes/
[ec2-user@ip-172-31-31-54 ~]$ apachectl graceful
(13)Permission denied: AH00058: Error retrieving pid file /var/run/httpd/httpd.pid
AH00059: Remove it before continuing if it is corrupted.
[ec2-user@ip-172-31-31-54 ~]$ 

Thanks for your effort!

Emmet Arries
  • 117
  • 1
  • 8
  • 4
    This question is being voted for closure because the author does not show a level of technical understanding or appropriate due diligence in researching the topic that the community judges as being a minimum barrier to participate. – user9517 Feb 26 '16 at 06:17
  • 1
    You are not using an account with suitable privileges to delete the pid file. Perhaps use sudo instead. – user9517 Feb 26 '16 at 06:07
  • Why wouldn't I have the privilege? Why would I deleting the .pid file? And lastly, `sudo`-what? I'm really new to all of this, Thanks! – Emmet Arries Feb 26 '16 at 06:11

1 Answers1

0

Try this

sudo service apache2 restart
Tim
  • 31,888
  • 7
  • 52
  • 78
  • Thanks for something useful! when I put that in i get `To proceed, enter your password, or type Ctrl-C to abort.` I don't know what the password is, thanks for the effort! – Emmet Arries Feb 26 '16 at 06:25
  • Even though your post only kind of helped me. I really appreciate a positive, non attacking answer, thanks soooooo much! – Emmet Arries Feb 26 '16 at 06:42
  • Apache2 is system software, started as root. If you don't have root privileges you can't restart Apache. The thing is if you log in as ec2-user and the certificate sudo should work without a password, so I guess you're not authorised. You could restart the whole server from the AWS EC2 console if you have access. Why don't you have the password? – Tim Feb 26 '16 at 08:27
  • I don't know why I don't have the password, I think I have root access (I can edit the http.conf file), I will look into it, thanks! – Emmet Arries Feb 26 '16 at 18:21
  • 1
    EC2 instances don't usually have passwords, they have certificates. I think you really do need to learn the basics, I don't think we can help because you have so much to learn. I wrote a tutorial that covers EC2 and Nginx, you'd learn something from that https://www.photographerstechsupport.com/tutorials/hosting-wordpress-on-aws-tutorial-pt1-introduction-configuration-downloads/ – Tim Feb 26 '16 at 18:59
  • But when I used your code above the server said `To proceed, enter your password, or type Ctrl-C to abort. Password:`, I have the .pem file to access the server, is that what you mean by "certificates"? Sorry if I don't understand! – Emmet Arries Feb 26 '16 at 19:09
  • I can't help much until tomorrow. Read my tutorial about how to get an EC2 server set up, how to connect. A few hours of reading tutorials and documentation about Unix, shells, ssh, certificates, etc will help. If you need professional help try my profile, though beware I'm not a Unix expert, just someone who's read a lot of tutorials and documentation. – Tim Feb 26 '16 at 19:48
  • Thank you for you effort and time! I figured it out! P.S. I used `sudo /sbin/service httpd restart`. – Emmet Arries Feb 28 '16 at 21:57
  • Odd. You shouldn't need a path for "service" and I wonder why the service is called httpd instead of apache2. Anyway, glad you worked it out. Hit the link above that says "answered" so others don't have to bother looking :) – Tim Feb 28 '16 at 22:44
  • I didn't try removing the "service" or anything else, got what I said above from http://www.tech-problems.com/apache-not-using-htaccess/ and it worked. – Emmet Arries Feb 29 '16 at 00:12
  • I wonder if httpd is apache1. – Tim Feb 29 '16 at 00:57
  • @Tim It's called httpd because that is the name of the software. _Apache is not its name._ Apache is the organization which develops it (and many other projects). Naming httpd apache2 is a ridiculous Debianism, on par with calling vSphere "VMware". – Michael Hampton Apr 27 '16 at 06:03
  • @MichaelHampton thanks for the info, you're only two months late ;) I believe my question back then was wondering if the services for different versions of httpd have different names. If I'm restarting apache2 I use "service apache2 restart", I wondered if the command Jeff posted above "service httpd restart" indicated an earlier version of http or something, but the different Unix versions seems more likely according to a quick Google search. Always happy to be educated :) – Tim Apr 27 '16 at 09:23
  • 1
    Ah, I did not see this post again until today. Some distributions (Red Hat, etc.) always use the name of the package as it was chosen by the developers. Debian does not do this; they change the names of many packages; this is just the most well-known. – Michael Hampton Apr 27 '16 at 09:25