I cannnot seem to get exec() or passthru() to execute a perl script;
here's the code snippet:
if ($debug) {
echo "username1 = ".$username1."< br>";
echo "dbname = ".$dbname."<br> ";
echo "SESSION[dbname] = ".$_SESSION['dbname']."<br>";
echo "Output file = ".$outputfile." <br>";
echo "Project name = ".$projectname. "<br>";
echo "Study name = ".$studyname."< br>";
echo "The command to be run is: ".$cmd."<br >";
}
// Run the command!
exec($cmd,$myou tput,$rtnvar);
echo "rtnvar = ".$rtnvar."<br> ";
foreach ($myoutput as $line) {
echo $line."<br>";
}
Which produces the results:
username1 = rick
dbname = cgb_lab_data
SESSION[dbname] = cgb_lab_data
Output file = myoutput
Project name = IBS11_1103
Study name = IBS 11
The command to be run is: perl
/home/caseyr/projects/LIMSScripts/3100DataIO/mk3100plt.pl -n 'IBS 11'
-b 1103 -o myoutput -p IBS11_1103 -i S
rtnvar = 13
The command looks perfectly legit, and will run at the command line if
I cut and paste it.
I do not understand the return value of 13.
I can get a simple perl script that takes no arguments to run ok; so I
think this has something to do with the arguments. I've used
escapeshellarg( ) to no avail. I've always tried the same with system()
and the backtick operator -- nada!
If anyone can spot what I might be doing wrong, I'd appreciate it!
Rick 2 1742
rickcasey wrote: I cannnot seem to get exec() or passthru() to execute a perl script; here's the code snippet:
if ($debug) { echo "username1 = ".$username1."< br>"; echo "dbname = ".$dbname."<br> "; echo "SESSION[dbname] = ".$_SESSION['dbname']."<br>"; echo "Output file = ".$outputfile." <br>"; echo "Project name = ".$projectname. "<br>"; echo "Study name = ".$studyname."< br>"; echo "The command to be run is: ".$cmd."<br >"; }
// Run the command! exec($cmd,$myou tput,$rtnvar); echo "rtnvar = ".$rtnvar."<br> ";
foreach ($myoutput as $line) { echo $line."<br>"; }
Which produces the results:
username1 = rick dbname = cgb_lab_data SESSION[dbname] = cgb_lab_data Output file = myoutput Project name = IBS11_1103 Study name = IBS 11 The command to be run is: perl /home/caseyr/projects/LIMSScripts/3100DataIO/mk3100plt.pl -n 'IBS 11' -b 1103 -o myoutput -p IBS11_1103 -i S rtnvar = 13
The command looks perfectly legit, and will run at the command line if I cut and paste it.
I do not understand the return value of 13.
I can get a simple perl script that takes no arguments to run ok; so I think this has something to do with the arguments. I've used escapeshellarg( ) to no avail. I've always tried the same with system() and the backtick operator -- nada!
If anyone can spot what I might be doing wrong, I'd appreciate it!
First I'd try changing the single quote to double quotes: "IBS 11"
....as well as providing the full system path to the perl executable.
(run "which perl" to find it on the system).
You may also want to check that there aren't any extra control
characters like tab or newline in the command variable just in case...
--
Justin Koivisto, ZCE - ju****@koivi.co m http://koivi.com
rickcasey wrote: rtnvar = 13
Hi Rick,
I see that the return value is 13. On Linux error 13 means:
13 (EACCES) - Permission denied
So the webserver user probably doesn't have the permission to execute perl.
HTH.
Peter.
-- http://www.phpforums.nl This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jerry |
last post by:
I've found a problem with exec, passthru, shell_exec & system.
I'm trying to run the following
exec("sort -r -n -k2,2 r1.txt > r2.txt")
with r1.txt being a numeric file. The file looks like this:
237 291 845 152 585 3
193 810 173 484 151 3
|
by: Piotr Wolski |
last post by:
can anyone help me:
using exec() function in PHP i can execute linux programms like ls,who
and other, however i can not execute C programms and i really don't know
why.
Please help me,
Peter
|
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");
|
by: Greg Chapman |
last post by:
I am at my wit's end trying to get information out of Streamline.net's
support dept about my problem. They reply quickly enough, but seem to try
and give out the least possible amount of info each time. The transcript so
far is reproduced for your amusement below.
To summarise:
I've put up a Sudoku-solving program called Sudoku.exe. I want to call it in
a php script to solve a puzzle and output the solution. It works fine with...
|
by: baustin75 |
last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie
only when debugging in php designer 2005
--------------------------------------------------------------------------------
Hello,
I have a very simple problem but cannot seem to figure it out. I have a
very simple php script that sends a test email to myself. When I debug
it in PHP designer, it works with no problems, I get the test email. If
| |
by: harisinfo |
last post by:
Hi everyone,
I have a very strange problem when trying to run a simple php script:
ob_start();
$e=chdir("/usr/lib") or die("Could not change directory");
echo getcwd();
ob_end_flush();
when I run it through command line, it gives me /usr/lib/ but when I run it through the browser it always shows my current web directory where the script is located. I tried using exec(), system(), passthru() etc. All work through command line but...
|
by: Tom |
last post by:
I have a script which allows a user to upload a file. The script does
some filename editing, mimetype checking, etc., and it's then supposed
to send the file to a remote server, without any username/password
prompt ( I have root access to both servers ).
I'm trying to run an exec/passthru command using scp or rsync, but
there's one fundamental question that I can't answer. When exec is
called from the command line, e.g. `php...
|
by: rickcasey |
last post by:
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).
|
by: dinek |
last post by:
I am trying to call a Matlab file from PHP. I beleive that using exec() I can call the matlab file. But this does not work
I tried
exec('matlab -r sample');
I also tried the same with the system() , passthru() and still not working.
I tried to write a .bat file and put the command in .bat file and that did not work too.
Can anyone help me. This question is already present in the forum but no answers given.
I use a Vista 64 bit and I...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |