Apache will not start. The command "sudo service apache2 status" lists these errors:

/usr/sbin/apachectl: 1: /usr/sbin/apachectl: id: not found
/usr/sbin/apachectl: 98: [: -eq: unexpected operator
/usr/sbin/apachectl: 147: /usr/sbin/apachectl: mkdir: not found
/usr/sbin/apachectl: 126: /usr/sbin/apachectl: mktemp: not found
/usr/sbin/apachectl: 127: /usr/sbin/apachectl: chmod: not found

I checked this against the version of apachectl on a test machine and it is the same code. I tried running with sh, bash and dash ... but none worked. I don't think there is anything actually wrong with apachectl but something in my setup must be wrong.

Any idea how I can fix this error?

System ubuntu 19.04, apache 2.4

  • what is the output of which mkdir or which \[ ? Oct 21 '19 at 20:19
  • It looks as Your path or access permissions are broken or even some basic commands are missing. How did You try to start explicitly with sh or bash? At that place, check whether You can execute or find the mentioned binaries (i.e. which id, which apachectl, echo $PATH, ls -l /usr/bin/id)...
    – EOhm
    Oct 21 '19 at 20:19
  • the first line is of apache2ctl is #!/bin/sh and ls -l /bin/sh lrwxrwxrwx 1 root root 4 May 20 2016 /bin/sh -> dash how does it look like at your system? Oct 21 '19 at 20:22
  • the trouble starts in envvars right after the line export PATH="/var/www/.local/bin"
    – zortacon
    Oct 22 '19 at 16:07

The trouble was I destroyed the path. The PATH export should have read

export PATH=$PATH:/var/www/.local/bin

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.