Jump to content

shell script not running in php


raman

Recommended Posts

I have embedded a shell script within a php script.

 

The shell script runs correctly when I run it from the shell, however when I run it from the browser, only the first part of it runs while the second part does not. multiplets.o is a binary executable of c++ program. Can someone suggest? My machine is a Redhat eneterprise linux and php is 5.3.1

 




seqfile=$1;

#first part
cp $seqfile $seqfile.test;
perl -pi -e "s/\t/\n/" $seqfile.test;
perl -pi -e "s/>/>0/" $seqfile.test;
perl fast_betteramcomph.pl $seqfile.test $seqfile.aac;

  #second part
./multiplets.o $seqfile.test $seqfile.mp > waste;
cut -d ' ' -f 1-20 $seqfile.mp > $seqfile.mpc;
perl -pi -e "s/$/ /" $seqfile.mpc;
rm -rf $seqfile.mp;

Link to comment
https://forums.phpfreaks.com/topic/192897-shell-script-not-running-in-php/
Share on other sites

I would suggest making the paths to the files, full system path names. if they are not already. I would agree that it is odd that perl is finding the files in your first half, but I would certainly give that a try.

 

It is certainly going to be the case that the default path setup is going to be different for the user running the shellscript from the shell command line, then it is for the user running apache.

Then I would suggest that your executable is expecting something in its environment that it is not finding. I think you are going to have to put some extensive debug output in your executable, starting with a simple, 'yes I have started'

Yes you are right

The problem is with this line,

./multiplets.o $seqfile.test $seqfile.mp > waste;

 

when I put this as ./multiplets.o $seqfile.test $seqfile.mp , the script runs correctly, but the problem is that the useless information that I was directing to the file waste also appears on the browser, my output files is only $seqfile.mp, i need only that one.

 

 

can you suggest what should be done about this ?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.