Script help

client asked

Hey all… I need to run a shell script on Zoo via PHP, and was
trying to use the PHP exec() function.

The script will manipulate some images using ImageMagick. Everything
works fine when calling the script from the command-line. I’m having
trouble, however, running it via PHP

The .sh file is owend by the account that the PHP file resides under.

What should the path to the shell script be (relative vs. absolute),
and will I encounter any issues trying to use exec() once my path is
correct?

Best to use absolute path, so there is no ambiguity

Best to use alias of your script’s folder. In general, any users alias is formed using the convention

    /users/x/y/xyzzzzz

where x is the first letter of the use’rs NetID, y is the second letter of the user’s NetID, and xyzzzzz is the user’s netid.

here’s an example. No issues for me running this in my home directory

#!/usr/local/bin/php
<?
passthru("/users/w/a/waw/mysqltest.pl");
$dog=exec("/usr/bin/date");
print "dog=$dog";
?>

except he meant to run it via http://www.uvm.edu/

I sugegsted he try cgi.uvm.edu — no SAFE mode there

About Wesley Wright

Born on a mountain top near New York City, Craziest state in the land of the pretty. Raised in the woods so's he knew every tree, Killed him a bear when he was only three.
This entry was posted in Projects, Scripts - Programming. Bookmark the permalink.

Leave a Reply