In a shell I do simple whoami and I get geoff, which is good, since that’s who I am.
In a php file I have shell_exec(‘whoami’); and I get nobody.
This seems to me to be a difference that could be explaining my original problem: imagemagick works from a shell but doesn’t work from within a php script.
Now from working through this site I think this means that my apache xampp assigns a different user name rather than using my usual user name.
I have tried to change my login within the php by way of sudo but this isn’t working for me as of yet.
Can anyone help?
@anubhava is correct about why you get two different answers when you run
whoami. However, if you’re trying to convert a PDF to a PNG using ImageMagick (like in your comment on the question), even using the full path to ImageMagick’sconvertwon’t work if the script’s PATH doesn’t contain the path location to Ghostscript also. Without messing with any user paths, you could add:Or something similar depending on your setup. The
gsexecutable has to be in your script user’s path somewhere or ImageMagick will fail to convert PDF or EPS files.