Fixing the error “cannot create /dev/null: Permission denied”, “Operation not permitted” restarting Apache

If you try to restart apache without sudo, like this:

sshuser@makingbeehives:~$ /etc/init.d/apache2 restart

You may receive the following error message:

/etc/init.d/apache2: 229: /etc/init.d/apache2: cannot create /dev/null: Permission denied
/usr/sbin/apache2ctl: 87: ulimit: error setting limit (Operation not permitted)
[Mon Feb 08 21:49:45 2016] [error] VirtualHost -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results
Syntax OK!

The solution is to simply sudo the command:

sshuser@makingbeehives:~$ sudo /etc/init.d/apache2 restart

Leave a Reply

Your email address will not be published.