Exec Command Executing The Program In The Background
i am running xampp on my computer from apachefriends.org, it's a apache server
this is the php script
<html>
<head>
<?php
exec ('notepad');
?>
</head>
</html>
but when i execute the php script on my computer , notepad doesnt not run
i used a process viewer and discovered that notepad is running in the background and i cannot see it
does anyone know how NOT to make it run in the background? i wan to see the notepad window on the apache server (my computer)
View Complete Forum Thread with Replies
Related Forum Messages:
Executing A Script In The Background
I want the user to be able to click the button to execute a PHP script without the screen refreshing. What will happen is that the PHP script does some stuff to create a file, and then sends back a file to the user. How do I: A: Allow the button to be clicked and the form fields to be sent to a PHP without the screen trying to refresh to a new page. B: From that background script, get PHP to send a file from the server to the user, again without refreshing to a new page. Instead it would just bring up a file requester to allow the user to save the file.
View Replies !
Tracert :: Passing Command To Command Prompt Via Exec
I want to execute a "tracert" command in the command prompt via php (using windows) I've managed to use passthru() to open the command prompt (but it doesn't allow me to use it) and when I close it, it outputs the command prompt output in the browser. I don't mind whether the result is passed back to the browser to stays in the command prompt window (but that would use exec() I would think). So how can I tell the command prompt that launches to execute the line tracert 192.190.201.273 So far my experimental code is: <?php passthru("c:windowssystem32cmd.exe"); ?> EDIT: my backslashes have been stripped from the path, but you know what I mean!
View Replies !
Exec In Background On Windows
How can I get an /exec'ed/ process to run in the background on an XP box? I have a monitor-like process which I am starting as 'exec("something.exe");' and, of course the exec function blocks until something.exe terminates. Just what I /don't/ want. (Wouldn't an & be nice here! Sigh) I need something.exe to disconnect and run in the background while I continue on with my script.
View Replies !
Exec Background Process
I want have PHP call another process (another PHP script at the moment but it may end up being a binary) in the background and not wait for process to complete, but rather instantly jump the the next line of code. I've tried things like: exec("./script.php &"); // script.php has executable permissions set exec("at -f ./script.php now"); // and #!/usr/bin/php at the top of the code Neither seem to work. They both execute script.php, but both hang around until script.php has completed.
View Replies !
XP Exec Background Process
I was trying to exec a background process on XP using PHP CLI, but could not get it to work. Suppose the command I want to spawn off is "cmd". On *nix, it is as easy as putting ampersand "&" at the end of the command. I tried the following on XP without working. exec("cmd"); exec("cmd >NUL"); exec("cmd /c cmd"); exec("start /b cmd"); I tried many combination, but on each one, PHP waits for cmd to exit before continuing. Doing this in Windows script host (cscript) is simple: Set objShell = CreateObject("WScript.Shell") objShell.Run "cmd", 0, False The "False" parameter causes the Run method to continue immediately without waiting for the command to finish. So I could make my PHP file exec a VBS file that does the actual background execution of my command. PHP exec documentation says it will not wait if output of the command is redirected somewhere, but this didn't seem to work for me. If anyone has experience in doing something like this on Windows XP SP2,
View Replies !
Executing A Program
I am trying to run a console application which needs to keep running even after the php script has finished executing. I also need the PID or some sort of handle I can use to kill the program at a later stage.
View Replies !
How To Start Script In The Background (using Exec())?
I have some troubles trying to start php script using exec() and leave it running in the background. Manual says: "If you start a program using this function and want to leave it running in the background, you have to make sure that the output of that program is redirected to a file or some other output stream or else PHP will hang until the execution of the program ends." So, I'm doing this: exec("/usr/local/bin/php /mydir/myscript.php >/dev/null 2>/dev/null &"); I don't recieve any output from "child" script, but "parent" script waits until "child" is doing its work.
View Replies !
EXEC() Runs Process In Background
Exec, shell_exec, system, popen functions all run the process in the background. how can i get it to run the process normally. my code looks like this: <? exec("batch_file.bat"); ?> am i doing anything wrong?
View Replies !
Executing A Program Remotely With PHP
I need to be able to make the user be able to click a button, which then launches a batch file on my computer.. But passthru() doesnt do the job anymore. And is faulty.. My computer is the server, so it'd also be nice if the command could launch it in a windowed form instead of a background process Here's my code:
View Replies !
Executing A Remote Program
it involves a game server a remote database server (running PHP 4 and Mysql latest). The problem is - we have a coded plugin for the game server to run a PHP script on the remote server and save some data to the mysql. What I then need to do is send the data back by running a program with a command string on the game server via the PHP. If that nmakes sense. Code:
View Replies !
Invoke Command In BACKGROUND
I have a php program that calls an expect script. The problem I am having is that my script takes an hour or so to complete. I do not know how to call it to run in the background like we do when we execute a unix command an use I tried commands such as system, exec and passthru. Here is what i am doing now foreach($build_commands as $cmd){ system("./$cmd"); //cmd: "diag.exp parm1 parm2 parm3 &" }
View Replies !
Problems With Executing Binaries With Exec()
I have problems with executing external programms in php with exec() and system(). When i am trying to execute some shell commands eg system('ls'), exec('whoami') there is no problem , with my binaries (the simplest hello world program in c++) - no problem. But programms, which i've installed(./configure make make install) before, don't work.' For example i've installed cvs. Code:
View Replies !
Executing A Shell Command
I try to use the backtick "`" to exacute a shell command from a PHP script. However, `touch file`; doesn't make the file. Neather does exec(), system(), etc. They all work when is used a different command, such as pwd, or ls. So what's a brotha gotta do to creat a file?
View Replies !
Executing Command Lines...
I'm trying to execute a command line through ffmpeg.exe in php. Can anyone tell me how this is done. Also where should I have such an application installed relative to the root of the site?
View Replies !
Executing Multiple Shell Commands Via One Exec()-call
I wrote a PHP shell script under Linux which puts all existing [E]PS-Files within a directory into a list and should then start a single Ghostview window for each file. Sounds simple, but it's not: The following code provides for about half of the functionality I wanted: ==============code starts $bla = array(); foreach ($filelist as $file) { $bla[] = fopen("./trash/".$file.".tmp", "w"); exec ("gv ".$file." &", $bla); } ===============code ends Here, all files are opened one after another. The next file opens only after closing the current one. Actually I don't know whether the redirection of the output towards .tmp-files complies with the intended purpose of the redirection. The PHP manual states that when starting programs in background, the output would have to be redirected to a stream or file, otherwise PHP would continue to run until the respective program is terminated (which I really wouldn't care about at all, if it did so...). Then I thought about writing the line I would type manually for opening all ps-files ('gv bla1.ps & ; gv bla2.ps&; ...') into a string and then executing that string: ===============code starts $command=""; $bla = fopen("./trash/tmp", "w"); foreach ($filelist as $i => $file) { if ($i < count($filelist) - 1) { $command = $command."gv $file & ; "; } else { $command = $command."gv $file &"; } } exec ($command, $bla); ===============code ends sadly I get an error message from the shell: ================ error message starts sh: -c: line 1: syntax error near unexpected token `;' sh: -c: line 1: `gv uges_Boden.ps & ; gv ux_Boden.ps & ; gv uy_Boden.ps &' ================ error message ends
View Replies !
Exec And Shell_exec Not Executing Batch File Properly
I am running Apache and PHP on windows XP. Latest versions of them all. I am trying to execute a simple .bat batch file that simply copies 4 files from one location to the batch files location. The php exec command runs like this: V:Corehtdocswp ransfer.bat Y:folder here the batch file is executed and the command following is thrown into the batch file to specify where the files that need to be copied are. The Y: directory is in windows considered to be a network drive, although it is really just a folder on the same machine, i did this because there are spaces in the folder names on its way to where I need the information copied from i.e. "Program Files" When I run this in the command prompt by entering this in manually it runs perfectly. However when running exec in the PHP script nothing happens; when I run shell_exec it gives me the output and it shows that every line in the batch file is executed however it does not actually copy anything. Looking into my apache error log I see that this is related: "The system cannot find the drive specified." Now what I am wondering is, how is it that I can run this script manually but apache tells me I cannot. My permissions are set to allow all and deny nothing since it is a machine well tucked into a safe place. Apache resides on the machine in C: eactorcore and it also setup a virtual drive as v:core. Trying both does not work.
View Replies !
Cannot Get The Program To Run At All Through Exec
I downloaded the program called Snapshotter which allows you to take screenshots of webpages through the command-line. Server is Win2k3/XP (live/local). I cannot get the program to run at all through exec while the same directory/permissions for ffmpeg run fine. I cannot even get it to spit out the default output you get if you run it without arguments. exec("dir") works fine, but exec("c:lahSnapshotter") doesnt return anything. Registered the path in the PATH environment and still no luck, yet exec("c:lahffmpeg") works fine and returns data.
View Replies !
Problem With Executing A Command From Within My Script
I'm working on a web-based mail quarantine management system, and am running into some problems getting it to run the command to release a message. The main exertp of the script is below: <?php echo "Releasing /var/amavis/quarantine/" . $_POST['release'] . " to user " . $_POST['user'] . "<br><br>"; $command = "/usr/sbin/amavisd-release " . $_POST['release'] . " " . $_POST['secretid']; echo $command . "<br>"; passthru($command, $return_val); echo "<br>" . $return_val; ?> End script This command works fine from the command line, but won't run using this code. It comes back with a return code of 13 each time. I've also tried the exec and popen functions in place of passthru() with no luck. If it matters any, amavisd-release is an executable Perl script.
View Replies !
Exec Wont Run A Cpp Program
I'm trying to get Zonminder up and running on FC4 One of the asso programs is zmu.cpp - compiles fine. And runs from the command line IE. /u/l/b/zmu -help returns Usage. zmu -m 2 -z (real cmd) from cmd line does what it should do. However (in xx.php) exec ("/usr/local/bin/zmu -m 2 -z", $ret); doesn't. From what I can tell it doesn't even enter the program. Permissions are 755. If I change the exec to ("ls") - works, date - works. I've compared "env" - nada. SafeMode = Off. Is there ?anything? else that might cause my problem?
View Replies !
Exec A Commandline Program
I made a topic about this before, but got one post helping, and nothing more, even though the post did not solve the problem. I need help uploading a file and sending it to a commandline windows executable. The program is called nconvert.exe, I will be uploading dds textures and converting them to bmp pictures, then immediately offering them back for download, not storing them on the server. The command to convert a file is this: nconvert -out bmp %1 %1 being the file passed to the executable.Â
View Replies !
Including External Php File And Executing A Command
I have two different servers, and i need to call a php of server B from server A, so i did this: SERVER A: index.php has: include('http://server-b/file.php'); The content of file.php is: phpinfo(); ... but phpinfo() throws info about server B instead of its parent file SERVER A.
View Replies !
Permission Denied Executing Shell Command
I am getting following error when executing shell command from PHP, where PHP/Apache is running as "nobody". du: '/home/example/mail': Permission denied du: cannot access '/home/example/mail/example.com/demo/': Permission denied.
View Replies !
Exec() Call To External Program
We are trying to use the exec() or system() calls in a php script. The program we are trying to call takes 1 parameter in the form of: email@domain.com[usercode] There are no spaces in the parameter at all and we have tried placing quotes around just to see if it mattered. We have also modified the parameter just to send it hello. Here is what we get: With no parameters the php script executes the program where it displays the error message from the program stating that not enough parameters were supplied. We then add the word "hello" to the end after a space so the command looks like this: command "hello" and the program no longer executes at all. No matter what we do, if we supply an argument to the command the php code will not execute the program.
View Replies !
Php Exec To C Program That Writes File
I'm trying to use the exec() call in php to run a program that I've written and compiled from C. This program attempts to create a new file and write data into it. If I simply run the program from the shell, it writes the file no problem. If i run the program through an exec call in a php script, however, the program executes but it seems to not have the correct permissions to be able to write the file.
View Replies !
Use Exec To Run The Program Directly From The Server.
I have an image manipulation program that is run from commandline, I have never used exec before and I'm scared to becuase I don't want to mess up my server or anything. Basically, I want people to be able to upload an image, then arrange for some manipulations to take place on the file in a temporary batch file, then use exec to run the program directly from the server. The program is called nconvert.exe, and the main thing I want to do is convert DDS textures into BMP files, the command, from Windows "cmd" is: nconvert -out bmp %1 %1 being the dds file to be manipulated. How would I go about doing the exec part? I know how to do the upload, but not the exec.
View Replies !
Better Exec() Command
I work in a network support office which uses a web form to receive network related problem reports from our end users. The web server is IIS 5.0 on win2k server, and we use PHP and MySQL to handle the form and tracking. I'd like this setup to launch an mp3 player on the web server when a problem report is sent in. I've tried exec("little mp3 player i wrote"), but there are two issues with it: 1) I think the mp3 player runs as the user who sends in the report. If the report is sent from the web server itself, everything works fine. Otherwise, the mp3 player runs in the background and can't be shut off. 2) The script waits for the mp3 player to be closed to finish. I'm guessing there's a different command that will solve problem 2, but I'm stumped on problem 1. It's more of an IIS/windows issue, probably,
View Replies !
Securing Data Between PHP Script And Exec'd Compiled 'C' Program
I'm using RSA Securid Tokens, and I'm going to write a little 'C' program that takes as input the userid (i.e. "jsmith") and the number displayed on the token (i.e. "123456") and returns a result code indicating whether authentication is successful. The compiled 'C' program will be called from a PHP script. I know that if I pass the parameters on the command line, i.e. authenticator jsmith 123456 the parameters are world-visible (via "ps -Af", for example) and this is an information leak. <BEGIN QUESTION> How can I pass things securely between the PHP script and the exec'd program? <END QUESTION> One way I suppose I could always use is to create a file from the PHP script and then just pass the filename to the program (assuming permissions and UID/GID were all set up correctly). But is there a more elegant way that doesn't create files, such as pipes or shared memory?
View Replies !
Problem With Exec Command
I'm having a problem with the exec command. Well, my application has a text to speech converter.it is working fine when i try to run it through command prompt. it is successfully converting the text file to audio file(mp3). but when i'm trying to convert through my application using exec command it is unable to execute the command. can you please tell me the reason why it couldn't. are there any permission issues as far as exec concern. i tested it on the live server using remote desktop connection. My Server Configuration is: OS : windows 2003 standard edition 64 bit. web server: iis6 php version: 5.1.4 safe_mode is off in the php.ini file given write permissions to the site (the converted file will be created in the site folder only)
View Replies !
Just One Line ! (exec Command)
I would most like to just get the first line from exec result. The last line just isn't what I want. When I use passthru it doesn't allow me to store the results in a variable, so that's no good.
View Replies !
Exec() Command Not Functioning In Php
I have the following HTML code, which executes a PHP script. ================================================== <!--HTML CODE--> <html><head><title>Vulneraility Scan</title></head> <body><form method="POST" action="n2.php"> Host<input name="address" type="text" value="IP Address"> <input type="submit" name="Submit" value="SCAN"> </form></body> </html> <!--END OF HTML CODE--> ================================================== The PHP script is ================================================== <?php $ip = $_POST['address']; $com2="echo $ip > targets.txt"; exec($com2); $com3="rm -rf results.html"; exec($com3); echo "<br>This May Take Time"; $com4="nessus -q -T html localhost 1241 j1 abcd targets.txt results.html"; exec($com4); echo "<br>Finished"; ?> ================================================== I only see "This May Take Time " and "Finished" words on the screen, the exec() commands do not execute.
View Replies !
Simple Php Exec Command
I have made a php script that at first loads rtorrent in a bash file which starts and boots up a torrent. Well for some reason it worked on my Gentoox (xbox linux) but not any of the other linux os I tried from Fedora core 4 and centos 3. Now I moved on to ctorrent and I run the same thing and it loads the torrent from what I see on the tracker but it does not upload. What is crazy is if I use ssh and run the bash script it boots up fine. let me show you what I'm saying. Code:
View Replies !
Problem Executing Command Line Scripts On Win2003 IIS6 PHP4 Box
we're running an Win2003server with IIS6 and PHP4 in fastCGI config. When i try to use system() command to execute ffmpeg.exe it works ok when i run the PHP script from the commandline on the server, but when i run it from the webbrowser i get a return value: 128 and nothing happens. I checked for all the security settings, and everything seems fine. Does anybody have a clue where i should be looking?
View Replies !
Windows Program Command Exists
I can do this so easily in Unix: PHP Code: $msg = exec('whatis convert 2>&1'); echo $msg; However, in Windows using MS-DOS, I'm utterly lost. I am having to find out if ImageMagick is installed on a system for a function to operate (ImageMagick is required), and since this is a portable web application, you simply can't install ImageMagick everywhere you go. Therefore I need to know if the system home has ImageMagick or not, and in Unix, I simply do a "whatis convert" and I can tell, but since MS-DOS has no equivalent to "whatis" I can't figure it out, and just running the "convert" command within a recursive function onto thousands of images is just not a good idea.
View Replies !
Exec Command Doesn't Work
I'm trying to create a script which my cron will run once a day to backup my MySQL database, but the exec command doesn't want to work no matter what I try... exec("mysqldump -h localhost -u user -p pass --opt DataBase > BACKUPS/backup.mysql") or die("Problem"); I have tried adding the full path to mysqldump, I have tried using my root access, I have tried using a different dir to store the files, changed permissions all sorts and nothing works. It always returns "Problem" and if I take out the or die then it just returns a blank screen. I also tried system () and that gave the same results.
View Replies !
Command Window - Exec/system
I'm in the process of developing a script in Windows where I need to use exec/system. Whenever I execute either, Windows spawns a command window which automatically sappears. Is there a clean way to force Windows to NOT display the command window? I've seen this discussed a few times previously, but, none of the solutions seem to be working (tried both exec and system; tried using cmd /c, tried using start /B, etc.)
View Replies !
ProgressBar For A Shell Exec Command
I am executing a shell command through php $command = "some mathematical calculations": $output = exec($command); The $output takes approximately 10 - 40 sec for its execution every time. I wanted to show a progress bar proportionate to the time of execution. Code:
View Replies !
How Do You Do TCL Exec Command On PHP Script That Uses User Input?
The TCL command I am using will do a command-line action on a PHP script: set cannotRunPHP [catch { eval "exec php -q $root/scripts/info/php/info.php" } errMsg] I have to do it this way as both the TCL script and the PHP script run as CLI. However, "info.php" requires user input to run; this causes the TCL script calling the PHP script to hose up and die. Is there a way I can do this so that the TCL script can call the PHP script without any problems? Is there an alternate way of calling the PHP script other than using exec were that to solve this issue?
View Replies !
GLOBAL OBJECT IN EXEC COMMAND CALL
I have an object: $special = new special; Let's say I have a function: class special { function outputtext() { return "test"; }} now let's say I want to use the exec command to output that text: exec("/usr/local/bin/php -r 'echo $special->outputtext();'",$returnarray,$returnvar); I get an error call to a member function on a non-object. Any ideas how to pass teh GLOBAL OBJECT var into the shell exec command? I am haivng a terrible time figuring out what to do.
View Replies !
System Command :: Creating A Password Using The Htpasswd Program
I'm having trouble creating a password using the htpasswd program with the PHP systems command. Here is my code: //CREATE THE HTPASSWD FILE echo "running command..."; $command = "c:program filesapache groupapache2 inhtpasswd -c .htpasswd david"; $test = system($command, $returnvalue); echo "executed command: ".$command; echo "<br>"; echo "here are the results: "; echo $test; echo $returnvalue;
View Replies !
|