(Sent on behalf of OP).
This seems to be a permissions issue. It seems that Apache can be viewed somewhat differently than other users? Despite the fact that standard permissions will allow any user to access the PhantomJS application, apache still could not.
Anyone who has similar problems should read this question and answers .
Here is my slightly adapted solution for my specific case (on a Linux server). Modify the sudoers file (/ etc / sudoers) to include the following line:
apache ALL=NOPASSWD: /usr/bin/phantomjs
I did this with emacs (Cx Cq to enable read-only file editing). I had no problems with this, but I suggest that for editing sudoers it is recommended to use something called visudo. Emacs worked for me, but you should look at it.
This gave the apache user explicit access to the PhantomJS application, giving him access to sudo, limited only to the PhantomJS application.
source share