Jump to content

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.

ok so 2 things.

 

1) I assume that your script does have the #!/bin/bash or whatever for the shell interpreter you wish to run.

 

2) Does your own executable have the appropriate execute permissions 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 ?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.