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 Complete Forum Thread with Replies
Related Forum Messages:
- Tracert :: Passing Command To Command Prompt Via Exec
- System(); Command Not Working On Remote System. Windows.
- Exec Shows Window
- Better Exec() Command
- Problem With Exec Command
- Just One Line ! (exec Command)
- Exec() Command Not Functioning In Php
- Exec() Command Doesn't Do Anything
- Simple Php Exec Command
- PHP Command Line Called Via Exec();
- Exec Command Doesn't Work
- ProgressBar For A Shell Exec Command
- Folder Zip - Execute Unix Zip Command Exec()
- How Do You Do TCL Exec Command On PHP Script That Uses User Input?
- GLOBAL OBJECT IN EXEC COMMAND CALL
- Exec Command Executing The Program In The Background
- Keeping Window Open After Running Php File From The Command Line?
- PHP System() And Exec()
- System() And Exec()
- Exec(), System()
- Bug In System And Exec Commands
- System() Or Exec() And Permissions
- Exec() And System() Problems
- Using Passthru(), Exec(), System() Etc.
- System/shell/exec/etc
- Exec(), System() And Win 2003
- Use Exec() In PHP 5.2 On A Windows XP Pro System
- Problem Using System/exec Function.
- Using System/exec, How To Backup Database?
- Exec(), System(), Shell_exec(), Etc + Nmap
- System/exec Not Working In Browser
- Exec, Shell_exec, System, And Passthru Not Working At All
- Exec And System Commands Blocked By Host
- Alternates To System() And Exec() In Order To Use ImageMagik?
- System() Command
- Exec - Create An Executable That Return The System Drives
- Execute System Command
- Gzip And System Command
- Running System Command
- Running An .exe File Using Exec() Or System(), Unable To Fork Error
- Using The SYSTEM() Command W/ MySQL - Animated Radar .GIFs
- System Command :: Creating A Password Using The Htpasswd Program
- Apache Conf To Make The PHP's System Command Works On Linux.
- System(), Exec(), Shell_exec(), But "Permission Denied"
- Wait $x Seconds, Or Wait Until The "exec" Command Is Finished?
- Warning: Ftp_exec() [function.ftp-exec]: SITE EXEC Is An Unknown Extension
- Make A Popup Window That When I Click On A Picture It Pops Up A New Window
- Populating Form In Parent Window With Value From Popup Window
- Can A Popup Window Return Data To Parent Window?
- Popup Window That Darkens The Window That Opened It
- Way I Can Stop The 'message Sent' Window Opening In Another Window?
- Warning: Exec() [function.exec]:
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 !
System(); Command Not Working On Remote System. Windows.
My server is a windows machine, on the same domain as python(also a windows machine). Apache is running as a service as an administrator. This is a test only environment to whom it may concern(I hate people telling me how insecure my system is) I'm just trying to run: $last_line = exec('dir pythonc$', $retval, $g); print_r($retval); echo '<br>'.$g.'<br>'; echo '$last_line= '.$last_line.'<br>'; Which outputs: Array ( ) 1 $last_line= The command from the command line works fine. And apache can access directories that only administrators can access on the local machine.
View Replies !
Exec Shows Window
I exec programs like imagemagick and others it used to execute in the backround, now it shows a black cmd.exe dos window each time. I do not know what I changed is there anyway to change it back so it wont show the command window? Windows XP.
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 !
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 !
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 !
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 !
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 Replies !
Keeping Window Open After Running Php File From The Command Line?
I was getting a 500 error and someone adviced me to run the php file from the command line to check what errors that would come up with. Great idea which I'd like to use, but when I use the Windows "run" box to do this, I see a window open and close so quickly that there's no way for me to read what's come up. How can I force the window to stay open after the program has finished ? Just in case it's needed, I run the tests on a Win XP machine with Apache.
View Replies !
PHP System() And Exec()
Background: I am trying to execute a binary on the server located in the current directory where the php script is being run. The server is a linux (debian based). I am having trouble getting php to execute the binary properly, below is my code. Code:
View Replies !
System() And Exec()
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. I have tried numerous time by redirecting to a file or other stream to free up a php web page that called a perl script for example, but the php script always hangs...has anyone had any luck freeing up a calling php script from a process, or program that it launched in the background? Code:
View Replies !
Exec(), System()
I write very, very simple script who call external program. The script is run on Linux Slackware, Apache/1.3.37 (Unix) mod_ssl/2.8.28 OpenSSL/0.9.8b PHP/4.4.4 here is my script: <?php echo exec('ls'); ?> this work properly. but if i write: <?php echo exec('xine'); //xine is a multimedia player ?>
View Replies !
Bug In System And Exec Commands
If PHP is running via a web server, and mutiple system calls are made within the script to another script, hundreds of processes are created. Here is an example: Script 1: <?php for ($i=1; $i<=5; $i++) { system("php script2.php"); } ?> Script 2: <?php exit; ?> The effect is the same (and more difficult to stop) when the system calls are made in the background. e.g. system("php script2.php >>/dev/null 2>>/dev/null &"); system("php script2.php >/dev/null 2>&1"); I have even tried calling a shell script, which in turn calls the second PHP script (both in the background), but it still causes lots of processes. The "exec" command is also affected. At first, I thought this was a problem with either Zeus web server of Fast CGI, but I have since tried it with Apache and normal CGI with the same effect. Does anyone have any idea why this happens and whether there is any way to prevent it? I have posted a bug report to bugs.php.net (ID 14997), but so far to no avail.
View Replies !
Exec() And System() Problems
I am trying to use php's exec() or system() to execute a shell script that I wrote. exec and system() work fine with a simple command like ls, but nothing happens when I point it at the shell script. The shell script works fine from my shell login. Can't figure out what tho problem is. Is php just incapable of running shell scripts?
View Replies !
System/shell/exec/etc
I've got PHP 5.1.6, Apache 2.2.2, on Fedora 5. Everything is great except that when I use an of the external launching commands, persistent apps dont stay open. I have a simple shell script set up to load an app, and I have it write a PID file. Immediately after calling exec (milliseconds later) the PID is alive. However, within a few more milliseconds it seems to close. I've made sure that the apache uid/gid have full access to the script and the apps it calls. When sudo'ing manualy in a shell with the apache uid, the script works flawlessly and loads the program, and stays open, as it should. I've verified that the app loads under the uid 'apache' with ps. When running it through PHP, it seems to close almost immediately after succeeding. Is there some fundamental issue with how this works that I'm missing? I can't seem to get any real errors out of php, apache, or even the shell when redirected to a file. Should I try PHP4? Is PHP5 buggy with this kind of thing? I even tried running 'at' to schedule the script (so that it'd be invoked by at instead of the shell itself) but that failed, silently, as well.
View Replies !
Exec(), System() And Win 2003
I have searched high and low for the past 2 days for an answer to my problem. I have found a few references, but nothing has helped me. My problem is this: I am trying to ping a remote server from a PHP script in IE 6.0. When I load the page, the cmd.exe loads on the server and takes up all my CPU. I have to manually stop the process for it to go away. My setup is this: Windows 2003 Server PHP 5.0.1 I have tried - giving my system32cmd.exe full IUSR_%machinename% rights - moved the cmd.exe to the script folder, to the PHP folder And about a million other things that I can't remember =(. I have tried multiple functions, written in mulitple ways and the outcome is always the same. when the cmd.exe is opened it hangs on the 2003 server.
View Replies !
Use Exec() In PHP 5.2 On A Windows XP Pro System
I'm trying to use exec() in PHP 5.2 on a Windows XP Pro system. What I'm trying to do is use it to tell an already running program what to. For example: X:pathprogram.exe /something or X:pathprogram.exe /something_else If I do the command through the command line, it works, but so far I have been unsuccessful in PHP. Usually it PHP just hangs, and give no error message, and does nothing to the program.
View Replies !
Problem Using System/exec Function.
I am faced with strange problem. Basically I want to make a script which would take mysql back up for me. I have come up with following. [ basically code is borrowed from some other place ] PHP Code:
View Replies !
Using System/exec, How To Backup Database?
system("mysqldump --opt myDatabase > backup.sql"); here are my problems, i don't think it works on the webserver. next, where exactly the file, backup.sql be place if it does succeed. i believe we just can't execute commands on the webserver can we? i also tried using the sql query BACKUP TABLE ... TO .. but i'm guessing the problem lies with the TO... how do i know what directory shall i place it therE? for instance, my pages are placed in, home/myname/public_html/... i tried to put home/myname/public_html/backup in the TO but nothing happens.
View Replies !
Exec(), System(), Shell_exec(), Etc + Nmap
i'm trying to create a script that executes nmap from my server, then displays the output. i've tried: $output = passthru('nmap -v -A'.' $ip'); $output = shell_exec('nmap -v -A'.' $ip'); system('nmap -v -A'.' $ip'); the problem i'm having is that using the above methods i only get the first line of output, ie. Starting Nmap 4.20 ( http://insecure.org ) at 2007-08-31 21:46 CST and nothing else. i've managed to find a way around it by sending the nmap output to a textfile, the using file_get_contents() to pull the data back in: exec('nmap -v -A '.$ip.' > /usr/local/www/apache22/data/nmap/'.$ip.'.html'); $file = "/usr/local/www/apache22/data/nmap/$ip.html"; $result = file_get_contents($file); echo "(pre)$result(/pre)"; that works perfectly, but i'd rather not be writing anything to the drive. i guess the problem might be that nmap takes about 5-10 seconds to do its scan, and for some reason php doesn't want to wait that long, i really have no idea. can it be made to work without needing to write to files? and for the curious minds, i'm not doing anything dodgy, i just wanted an online tool i could access from any computer to test networks i support .
View Replies !
System/exec Not Working In Browser
In two files, and I serve foo.php then I notice If I use commandline execution i.e. php foo.php then foo.txt is touched/created all right. i.e. system command is executed as expectedBut If I use browser then I notice that the shell command in config.php is *not* executedAny ideas as to why this might be happening? Code:
View Replies !
Exec, Shell_exec, System, And Passthru Not Working At All
Can't get these commands to work! The following page simply doesn't finish loading ( Waiting... Opening... :-( ) <?php echo system("dir"); ?> The same for <?php echo exec("dir"); ?> or <?php echo shell_exec("dir"); ?>, etc... I'm running Apache 2.0.55 & PHP 5.0.5 with Zend Optimizer v2.5.10 on windows XP SP2.
View Replies !
Exec And System Commands Blocked By Host
I've got this code, its the simpliest example I could make. It works perfectly on my windows xp/apache/php box, but doesn't do anything on a commercial website host. The actual code should use gzip to compress a folder but that doesn't work either. Anyone know the reason why they would be blocking these commands? I suspect the problems with commonly used php apps like phpBB to be the real reason. <? exec("ping 127.0.0.1 > test.txt") or die(); // get contents of a file into a string $filename = "test.txt"; $fd = fopen ($filename, "r"); $contents = fread ($fd, filesize ($filename)); fclose ($fd); echo $contents; ?>
View Replies !
Alternates To System() And Exec() In Order To Use ImageMagik?
My Web host apepars to not allow exec() and system(), as a line in my script: system("convert -scale 100x100 $uploadfile $toimage"); gives the error: "Warning: system() has been disabled for security reasons" Is there some other way to use ImageMagik (or is it GhostScript?)'s "convert" command in PHP that may be safer and generally allowed by Web hosts?
View Replies !
Execute System Command
I need to execute a system command using admin rights, but even if i have the apache service started under an admin account, php scripts don't get executed with the proper rights. Is this a php configuration, or do i need to look elsewhere?
View Replies !
Gzip And System Command
Is it possible to create a button that will gzip a file from a web page? The have the page display another button, when the gzip is complete? The button should allow us to issues a system command.. ie: power off!
View Replies !
Running System Command
I'm using shell_exec to run a system command which should generate a file that i want to read, however the file isnt generated. I have safemode disabled and if i echo out the command and paste it into SSH the command executes fine. I have checked out the error log and there are no errors. This is an example of the command i'm running: Code: echo 'passphrase' | /home/website/gnupg-1.4.2/g10/gpg -u JON --passphrase-fd 0 --clearsign --force-v3-sigs -o /home/website/temp_dir/8edef434308edfa0fd804cfd6d139512.asc /home/website/temp_dir/8edef434308edfa0fd804cfd6d139512.txt I've tried executing this with system(), shell_exec() and popen() to no avail.
View Replies !
Running An .exe File Using Exec() Or System(), Unable To Fork Error
I have a problem with running an .exe file using exec() or system() I have downloaded a file called ffmpeg.exe for converting movie clips. I can use the program thourg the command line in windows (cmd), but I'm not able to have PHP run the file. First PHP gave be an "unable to fork" error. But then I gave users access to the cmd.exe file and solved that problem. So now is no problem running for example exec("dir");
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 !
Apache Conf To Make The PHP's System Command Works On Linux.
I've got a big problem to make my code works. My system() command don't seems to work. for that code : $res = system($command); echo"res = $res<br>"; the result is "res = " and the command is not executed. I feel that it come from my Apache configuration. However my safe_mode_exec_dir is pointing on the dir of my exec code. My OS is Unix.
View Replies !
Wait $x Seconds, Or Wait Until The "exec" Command Is Finished?
I'm working on a script that will dump a MySQL database to a file with exec(mysqldump [args]), then will let the user download the database. The dump may take a few seconds, so I want to user to be forced to wait before downloading the file. How can I tell my script to wait $x seconds before performing the next step in the script? Even better, would be the ability to wait until the dump is done. Is this possible with PHP?
View Replies !
Warning: Ftp_exec() [function.ftp-exec]: SITE EXEC Is An Unknown Extension
This is kind of a part II to a question a posted earlier about exec and shell_exec not working. I'm trying to use ftp_exec to execute some simple command: $conn_id = ftp_connect("$server") or die ("Cannot initiate connection to host"); ftp_login($conn_id, "$username", "$userpass") or die("Cannot login"); $command = 'cd..' if (ftp_exec($conn_id, $command)) { echo "$command executed successfully"; } else { echo "could not execute $command"; } ftp_close($conn_id); I'm getting the following error: Warning: ftp_exec() [function.ftp-exec]: SITE EXEC is an unknown extension in /home/urieilam/public_html/work/video/test1.1.php on line 21 could not execute cd.. Have tried other commands as well, get the same. Could this be a security issue or something to do with p Safe Mode? I don't know much about commands, shell, etc..
View Replies !
Populating Form In Parent Window With Value From Popup Window
I have a text box in the parent window.. now i want to populate this text box with a user_id that i will get from query within a popup window.. How do i get the value from the popup window to be passed to the main window form field in php. I know how it can be done in javascript but when i tried combining javascript and php i dont get the desired result.
View Replies !
Can A Popup Window Return Data To Parent Window?
Is it possible to do the following in php: I want to have a main form open. In the form I want a button that will open a popup window so the user can search for something. The user can then select what they want, and the popup window closes and the main form (which is still open) shows the search results.
View Replies !
Warning: Exec() [function.exec]:
I'm using PHP Version 5.0.4 in IIS5, Window 2003. When I execute my script, it prompt me the following error : Warning: exec() [function.exec]: Unable to fork [ping 10.8.1.70] in c:Inetpubwwwrootswitch.php on line 62 Below is my script : <?php $line1 = exec("ping 10.8.1.70", $output); exit; ?>
View Replies !
|