473,837 Members | 1,457 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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>Differ ence Report for Project: ".
$projectname."& nbsp;&nbsp;&nbs p;&nbsp;Gene: ".
$genename."&nbs p;&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=\"locat ion.href='saveT empDiff.php?cmd =".
$cmd."'\" >Save As Temp Comparison File</button>&nbsp;";
echo "<button onclick=\"locat ion.href='saveF inalDiff.php?cm d=".
$cmd."&gene=".$ genename."&snp= ".$snpname. "'\" >Make Final Calls</
button>&nbsp;";
echo "<input type='button' onClick='locati on.href=\"selec tProject.php
\"' value='Select Projects' class='btn'>&nb sp;";
echo "<button onClick='locati on.href=\"logou t.php\"'><butto n>Logout</
button><br>";
echo "<pre>";
// Now execute the PHP function that runs an external program and
capture the output
// in an array.
exec($cmd,$outp ut,$rtnvar);
if ($rtnvar) {
foreach ($output as $var) {
if ( (strcmp("seen before!!",$var) ==0) || (strpos($var,"C ALLS")>0))
{
continue;
}
echo $var."<br>";
}
} else {
echo "<h3>Execut ion 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 4141
On Apr 30, 5:36 pm, rickcasey <caseyr...@gmai l.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>Differ ence Report for Project: ".
$projectname."& nbsp;&nbsp;&nbs p;&nbsp;Gene: ".
$genename."&nbs p;&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=\"locat ion.href='saveT empDiff.php?cmd =".
$cmd."'\" >Save As Temp Comparison File</button>&nbsp;";
echo "<button onclick=\"locat ion.href='saveF inalDiff.php?cm d=".
$cmd."&gene=".$ genename."&snp= ".$snpname. "'\" >Make Final Calls</
button>&nbsp;";
echo "<input type='button' onClick='locati on.href=\"selec tProject.php
\"' value='Select Projects' class='btn'>&nb sp;";
echo "<button onClick='locati on.href=\"logou t.php\"'><butto n>Logout</
button><br>";
echo "<pre>";
// Now execute the PHP function that runs an external program and
capture the output
// in an array.
exec($cmd,$outp ut,$rtnvar);
if ($rtnvar) {
foreach ($output as $var) {
if ( (strcmp("seen before!!",$var) ==0) || (strpos($var,"C ALLS")>0))
{
continue;
}
echo $var."<br>";
}
} else {
echo "<h3>Execut ion 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_functio ns = 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
1678
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 program). With ps I can see the parent as a zombie, by the PHP code never reaps the exit code or returns from the exec. This was working fine yesterday and today suddenly stopped working. Does anybody have a suggestion what can be
14
11688
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 php script. The code is given below (with line numbers). 01 <?php 02 $output = exec("pwd");
6
8391
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 problem is this line: set oCommand = WshShl.Exec(sCommand) (it's about halfway down)  Is there a problem with the Exec method in some versions of VBS?  Is the problem Windows version I'm on, or is it something more obvious that I'm just not...
1
5876
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 to troubles. Things i tried is this : Exec ('USE <DB> ; SP_SpaceUsed '+ @table) -->not working (uncorrect
4
2071
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: proc_evaluate_results @StudentId = '222222', Course = 'PSY101' In order to obtain those values I run a cursor accross my records and SELECT THEM INTO 2 @variables, which then replace 222222 and PSY101 with dynamic values eg.
8
3327
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 to get done better. I notice on stack traces and tracebacks, an exec or execfile command appears as a stack entry -- probably as it should since it creates a new environment. However the frame information for exec or execfile looks like this:...
4
2377
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 which I mean here. Just for a moment, let's just take one definition for one of the
21
7873
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
9394
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 cd's I have an executable which I execute with exec(): $discOutput = exec('./discid /dev/rdisk2');
0
9682
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10875
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10566
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10623
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9401
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7001
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5848
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4474
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3124
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.