473,387 Members | 1,453 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

exec stopped working?

I wonder if anyone has experienced something like this, as it seems
truly bizarre and is causing me to tear out my hair (what little there
is left of it)....

The exec() function just suddenly stopped working, for no discernable
reason. Here is the code:

$execdir = $homedirectory."/".$genename."/".$rundir;

// Run the Python script on the Exported text file(s).
$cmd = "/home/ehringer/MAELab/bin/Parse_AD_Output.py --FinalCall ".
$execdir;

$debug = 0;
if ($debug) {
echo "<brcmd = ".$cmd."<br>";
}

echo "<h3>Difference Report for Project: ".
$projectname."&nbsp;&nbsp;&nbsp;&nbsp;Gene: ".
$genename."&nbsp;&nbsp;&nbsp;&nbsp;SNP: ".$snpname."</h3>";
// echo the selected filenames here as a record:
echo "<h4>Files compared in this run:<br>";
foreach ($filename_arr as $file) {
echo $file."<br>";
}
echo "</h4>";
echo "<button onclick=\"location.href='saveTempDiff.php?cmd=".
$cmd."'\" >Save As Temp Comparison File</button>&nbsp;";
echo "<button onclick=\"location.href='saveFinalDiff.php?cmd=".
$cmd."&gene=".$genename."&snp=".$snpname."'\" >Make Final Calls</
button>&nbsp;";
echo "<input type='button' onClick='location.href=\"selectProject.php
\"' value='Select Projects' class='btn'>&nbsp;";
echo "<button onClick='location.href=\"logout.php\"'><button>Log out</
button><br>";
echo "<pre>";
// Now execute the PHP function that runs an external program and
capture the output
// in an array.
exec($cmd,$output,$rtnvar);
if ($rtnvar) {
foreach ($output as $var) {
if ( (strcmp("seen before!!",$var)==0) || (strpos($var,"CALLS")>0))
{
continue;
}
echo $var."<br>";
}
} else {
echo "<h3>Execution of Parse_AD_Output failed!</h3><br>";
}
echo "</pre>";
?>
If I set debug true, and output the cmd variable, I can cut-&-paste
the cmd, and it executes fine at the command line in the target
directory. (The command is a Python script that takes as input all
files in the target directory.)

This was working fine for weeks. My sysadmin says nothing has changed
in the webserver or php installation.

If anyone has *any* insights as to why exec() would just stop working,
*please* respond here; this is holding up a critical project!

Thanks much,
Rick

Apr 30 '07 #1
1 4121
On Apr 30, 5:36 pm, rickcasey <caseyr...@gmail.comwrote:
I wonder if anyone has experienced something like this, as it seems
truly bizarre and is causing me to tear out my hair (what little there
is left of it)....

The exec() function just suddenly stopped working, for no discernable
reason. Here is the code:

$execdir = $homedirectory."/".$genename."/".$rundir;

// Run the Python script on the Exported text file(s).
$cmd = "/home/ehringer/MAELab/bin/Parse_AD_Output.py --FinalCall ".
$execdir;

$debug = 0;
if ($debug) {
echo "<brcmd = ".$cmd."<br>";
}

echo "<h3>Difference Report for Project: ".
$projectname."&nbsp;&nbsp;&nbsp;&nbsp;Gene: ".
$genename."&nbsp;&nbsp;&nbsp;&nbsp;SNP: ".$snpname."</h3>";
// echo the selected filenames here as a record:
echo "<h4>Files compared in this run:<br>";
foreach ($filename_arr as $file) {
echo $file."<br>";
}
echo "</h4>";
echo "<button onclick=\"location.href='saveTempDiff.php?cmd=".
$cmd."'\" >Save As Temp Comparison File</button>&nbsp;";
echo "<button onclick=\"location.href='saveFinalDiff.php?cmd=".
$cmd."&gene=".$genename."&snp=".$snpname."'\" >Make Final Calls</
button>&nbsp;";
echo "<input type='button' onClick='location.href=\"selectProject.php
\"' value='Select Projects' class='btn'>&nbsp;";
echo "<button onClick='location.href=\"logout.php\"'><button>Log out</
button><br>";
echo "<pre>";
// Now execute the PHP function that runs an external program and
capture the output
// in an array.
exec($cmd,$output,$rtnvar);
if ($rtnvar) {
foreach ($output as $var) {
if ( (strcmp("seen before!!",$var)==0) || (strpos($var,"CALLS")>0))
{
continue;
}
echo $var."<br>";
}
} else {
echo "<h3>Execution of Parse_AD_Output failed!</h3><br>";
}
echo "</pre>";
?>

If I set debug true, and output the cmd variable, I can cut-&-paste
the cmd, and it executes fine at the command line in the target
directory. (The command is a Python script that takes as input all
files in the target directory.)

This was working fine for weeks. My sysadmin says nothing has changed
in the webserver or php installation.

If anyone has *any* insights as to why exec() would just stop working,
*please* respond here; this is holding up a critical project!

Thanks much,
Rick
I dont believe nothing has changed!
functions can be prevented from being used in the php.ini using
disable_functions = exec
for instance.

When you say stopped working, does it just not return anything, is it
the call to exec which is not happening or the output from your
script. Try using &2>1 to redirection the errors

Is there no chance of using passthru or system instead?

has there been any system wide security changes? has the kernel on the
machine change over to secure Linux,
are there simply no errors outputted form the php script at all?

Thats all I have right now.

Apr 30 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: SM Ryan | last post by:
On Unix (MacOSX 10.3), I have an exec $rs = array(); $rc = 0; exec("program yadda yadda yadda",$rs,$rc); and the program does a fork with parent exitting immediately (to daemonise the...
14
by: Hemanth | last post by:
Hello there, I'm new to PHP. I'm trying to run a simple php script (on a Red hat linux machine with apache web server ) through a windows web browser (IE). I'm using an exec() function in my...
6
by: Hal Vaughan | last post by:
I have a script used to find and run Java on a Windows system.  It worked fine on original tests (on a Windows XP system).  It's now running on a Windows 2000 (sp3) system, and it won't work -- the...
1
by: Hennie de Nooijer | last post by:
Hi I'm executing SP_SpaceUsed in a stored procedure like this : Exec ('SP_SpaceUsed '+ @table) This works great but when i want to execute it for a table in a other database i'm running in...
4
by: R. Z. | last post by:
I 've have a stored procedure that compares fields across databases. In order to do so it requires 2 values it acquires from 2 tables. The search is based on the ID of the data owner and a subject:...
8
by: R. Bernstein | last post by:
In doing the extension to the python debugger which I have here: http://sourceforge.net/project/showfiles.php?group_id=61395&package_id=175827 I came across one little thing that it would be nice...
4
by: Michael | last post by:
Hi, I'm having difficulty finding any previous discussion on this -- I keep finding people either having problems calling os.exec(lepev), or with using python's exec statement. Neither of...
21
by: comp.lang.tcl | last post by:
set php {<? print_r("Hello World"); ?>} puts $php; # PRINTS OUT <? print_r("Hello World"); ?> puts When I try this within TCL I get the following error:
23
by: Maarten | last post by:
Howdy, Recently I switched from a Windows PC to Mac OS-X 10.5 (php v5.2.6) and I have a little problem with one function within my cd-management script. For extracting a bit of info from my...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.