cdromes Posted July 12, 2007 Share Posted July 12, 2007 Howdy I'm attempting to use the exec() in a Linux environment involving files in directories, all of which have been 'chmod 777'd. This is the function call that doesn't work: $result = exec('perl -S /home/fyejm5/PERL/GetSeq.p '.$Path.'/'.$GI.' '.$Upstream.' '.$len.' /home/websites/genework/html/DATA/'.$Sess_ID.'/'.$Sess_ID, $response, $return_code); print_r(array('result was'=>$result, 'response was'=>$response, 'return code'=>$return_code )); Here's the actual output off the command, which works like a champ when I run it from the command line: perl -S /home/me/PERL/GetSeq.p /home/me/GENOME/MOUSE/CHR_17/149313536 34324324 500 /home/websites/genework/html/DATA/07-12-07--12:03:49/07-12-07--12:03:49 The result is the creation of two files in the 07-12-07--12:03:49 directory, each named 07-12-07--12:03:49.txt and 07-12-07--12:03:49.out. This is the result from the print_r: result was => response was => Array() return code => 13 What does the response mean? What error does 13 represent? Is there something syntactically wrong with the exec()? This. Is driving me. Insane. I've gotten execs to work in the past, so that makes this one a little heavier on the soul-crushing side of things. Please help. Jason Quote Link to comment Share on other sites More sharing options...
trq Posted July 12, 2007 Share Posted July 12, 2007 Try putting your command into a variable first, then echo that to see what it actually looks like before execution. eg; <?php $cmd = 'perl -S /home/fyejm5/PERL/GetSeq.p '.$Path.'/'.$GI.' '.$Upstream.' '.$len.' /home/websites/genework/html/DATA/'.$Sess_ID.'/'.$Sess_ID'; die($cmd); $result = exec($cmd, $response, $return_code); ?> 13 could meen anything. Its not a reserved error code. Quote Link to comment Share on other sites More sharing options...
cdromes Posted July 12, 2007 Author Share Posted July 12, 2007 When I run your code, I get this output to the screen: perl -S /home/fyejm5/PERL/GetSeq.p /home/fyejm5/GENOME/MOUSE/CHR_17/149313536 34324324 500 /home/websites/genework/html/DATA/07-12-07--13:20:24/07-12-07--13:20:24 ...but it didn't actually work. When I copy this and paste it directly onto the command line and hit enter, it works perfectly. This screams "PERMISSIONS PROBLEM", but I don't know what other directories or file(s) need to be changed. Is it necessary to 'chmod 777' every directory in every path in this command? Quote Link to comment Share on other sites More sharing options...
trq Posted July 12, 2007 Share Posted July 12, 2007 Maybe you have safe mod enabled? From the man... Note: When safe mode is enabled, you can only execute executables within the safe_mode_exec_dir. For practical reasons it is currently not allowed to have .. components in the path to the executable. Quote Link to comment Share on other sites More sharing options...
cdromes Posted July 12, 2007 Author Share Posted July 12, 2007 Nope. That was the first thing I checked. So, in this one case, it isn't The Man that's keeping me down. Quote Link to comment Share on other sites More sharing options...
trq Posted July 12, 2007 Share Posted July 12, 2007 Sorry, i'm not sure what the issue is here. You might try looking in GetSeq.p to see if you can find out what an exit status of 13 actually is. Quote Link to comment Share on other sites More sharing options...
cdromes Posted July 12, 2007 Author Share Posted July 12, 2007 I was trying to execute stuff from directories that weren't specified in the OPEN_BASEDIR directive. Since I'm not the only user on the box, the solution was to create a directory structure on the web server and move all of the information from my personal directories over. Why is it that some solutions make you feel galactically stupid? Live. Learn. Yay. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.