Automator app stopped working after updating to macOS Mojave
The issue seems to be related to running custom PHP + Apache versions on Mojave, there are a lot of issues open on Github regarding problems with PHP, Apache and Mojave on Github, and the solutions wouldn't work for me.

Since what I really wanted to do was to keep having a PHP server to automatically run on startup to later test PHP scripts and websites locally, I decided to fire up the local server using PHP's built-in server command instead of Apache.

I used this bash script on the Automator app, it uses Mojave's preinstalled PHP version (7.1.19) and it authenticates just fine using the same sudo trick:

echo mypassphrase | sudo -S php -S localhost:80 -t &lt;directory to serve from&gt;
killAll ScriptMonitor


The last line killAll ScriptMonitor just gets rid of the spinning cog in the menu bar as soon as the server is created, this won't affect PHP from running in the background and PHP will keep acting as a server until terminated via command line or Activity Monitor or system shut down.