Help in executing a Unix CSH Shell Command through PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
maratmu
Forum Newbie
Posts: 2
Joined: Thu Sep 25, 2003 12:22 pm
Location: Auburn
Contact:

Help in executing a Unix CSH Shell Command through PHP

Post by maratmu »

Hi,

I wish to execute following unix CSH Shell command through

PHP. The Command is:

ansys70 -p ansysrf <inputfile> outputfile

Basically above command runs perfect on Unix Command Promt

but doesn't execute through the Script.

The command submits an "inputfile" for processing to a software called ANSYS, and should redirect the output to the "outputfile".

If i just execute the executable command of ANSYS that is just

ansys70 -p ansysrf through PHP it executes but i am afraid PHP is

not able to understand '<' sign which indicates some directional

input that should be given to the software and a further

redirection '>' to an "outputfile".

I am also using the PATH correctly where the ANSYS Software is

located.

I have tried with all the commands that PHP support for Unix shell execution.(system,passthru,exec,shell_exec)

If anybody could give me some hints, it would be great.
penguinboy
Forum Contributor
Posts: 171
Joined: Thu Nov 07, 2002 11:25 am

Post by penguinboy »

I'm really tired right now so I might be misunderstanding what you're trying to do, but....

shouldn't you have a '>' in there?

Code: Select all

<?php
system("ansys70 -p ansysrf ".$inputfile." > ".$outputfile);
?>
Another thing you might check, make sure your webserver has permission to write to whatever directory you're writing to.
maratmu
Forum Newbie
Posts: 2
Joined: Thu Sep 25, 2003 12:22 pm
Location: Auburn
Contact:

Runnin Unix Script

Post by maratmu »

Hey Penguinboy,

Thanks for caring to help me. i didn't set the permissions to read the inputfile.

I got the answer!

Thanks again
Post Reply