Questions tagged [exec]

This tag refers to the starting of another, subsidiary program. It is named after the family of POSIX system calls whose name starts with “exec” (notably “execve”) though similar concepts exist on other platforms as well, especially when combined with the starting up of another process.

From The Open Group Base Specifications Issue 7

The exec family of functions shall replace the current process image with a new process image. The new image shall be constructed from a regular, executable file called the new process image file. There shall be no return from a successful exec, because the calling process image is overlaid by the new process image.

This tag is commonly used with when it refers to execute an external program within a php code.

Examples

echo exec('whoami');

References

5914 questions
2
votes
1 answer

PHP Check if process is running (Linux)

I am trying to figure out if a gameserver is running. I found a lot of dirty methods so I wanted to make it basically easy by calling a PHP script which checks if a process is running. Well what I was trying was:
user2139268
  • 75
  • 1
  • 7
2
votes
2 answers

PHP Script works in the terminal but not the browser

I am trying to execute a exec command, and I am having problems. When I run the following code, it doesn't work when I run it through the browser. but if I take the output of $str copy and paste it into a terminal it works just fine. What would be…
Get Off My Lawn
  • 34,175
  • 38
  • 176
  • 338
2
votes
3 answers

PHP exec() return value for background process (linux)

Using PHP on Linux, I'd like to determine whether a shell command run using exec() was successfully executed. I'm using the return_var parameter to check for a successful return value of 0. This works fine until I need to do the same thing for a…
Brian
  • 2,107
  • 6
  • 22
  • 40
2
votes
4 answers

Executing bash script with tilde in path

I am trying to execute in linux: command[0] = "~/test/bin/runScript_sh"; Runtime.getRuntime().exec(command); But get an exception java.io.IOException: Cannot run program error=2, No such file or directory Probably because it can not evaluate…
yuris
  • 1,109
  • 4
  • 19
  • 33
2
votes
2 answers

Exec stored procedure with select as parameter

I have a stored procedure on sql server that takes 2 parameters. I want to run the stp for every row returned by a select. CREATE PROCEDURE stpMySTP @param1, @param2 AS BEGIN --select something from database regarding this parameters END I would…
sebastian.roibu
  • 2,579
  • 7
  • 37
  • 59
2
votes
2 answers

PHP - Can't execute c++ binary files?

I am trying to execute c++ binary files, that i have generated using cmake and make command, from PHP. If i try to execute the same command from terminal everything works perfect but from php nothing seems to be happening. I checked the safe_mode,…
Varundroid
  • 9,135
  • 14
  • 63
  • 93
2
votes
2 answers

how to kill runtime.exec?

I use the code below , in my jframe in order to execute a shell script via java program, but when i implement an other method to stop runing process, this method is blocked by th first and i can't stop my program. So i msut kill the new process, the…
user2043602
  • 237
  • 2
  • 4
  • 15
2
votes
1 answer

parallelize php with exec( )

I want to parallelize a php program which I use to read some .xml. I've been googleing and I read about some options: fork curl gearman exec I also red that exec is the best, but I don´t understand how it works. Anyone who can explain it? Thanks…
Eneko
  • 149
  • 1
  • 2
  • 13
2
votes
4 answers

PHP ini_set("max_execution_time") fails when script is run from exec()

To be simple: ini_set("max_execution_time") works when I call script.php via classic URL call ini_set("max_execution_time") doesn't works when script.php is run via exec() function from another php script/process. Now, my solution is not simply to…
Miloš Đakonović
  • 3,751
  • 5
  • 35
  • 55
2
votes
1 answer

Commands like "ls -l" not executing in execl, whereas in execvp it works

Using the code below in the execl variant, ls works, but ls -l does not work, but in my execvp approach ls and ls-l works. The reason why I adopted the execl approach is because the path of the binaries could differ whereas execvp did not provide me…
markfiel
  • 77
  • 1
  • 2
  • 8
2
votes
1 answer

Redirect a COPY of stdout to different log files multiple times from within same bash script

Following line works well when we want to redirect the stdout to a file, and also get printed on stdout. exec > >(tee logfile-1.txt) However, if we wish to later redirect the stdout to another file, say, exec > >(tee logfile-2.txt) the issue faced…
user31986
  • 1,558
  • 1
  • 14
  • 29
2
votes
2 answers

Problems understanding TCL CATCH exec issue

Got a problem thats being doing my head in for the last 2 days. Im running a tcl script (for an eggdrop) which when triggered, executes a local shell command (child process) and if the command is succesfull it spits out the results. However, if the…
Instronics
  • 79
  • 3
  • 6
2
votes
6 answers

PHP exec(psexec.exe) hangs indefinitely

I have a development / testing setup on a windows box and need to test calling a background process. I am using http://www.somacon.com/p395.php as a list of options for running a background service. Here is the sample code I am trying to…
teynon
  • 7,540
  • 10
  • 63
  • 106
2
votes
1 answer

Running a bash script from Ant and passing it multiple arguments

I'm trying to run the following command from an Ant build file: sh /home/myuser/scripts/run.sh -p=8888 -z=true /home/myuser/resources/mydir So far here's my best attempt:
IAmYourFaja
  • 55,468
  • 181
  • 466
  • 756
2
votes
4 answers

php run another script in foreground

I have a php script that leads up to running another expect script by passing it arguments. $output = shell_exec("expect login_script.tcl '$user' '$host' '$port' '$password'"); Using shell_exec doesn't work as the script gets run in the background…
Programster
  • 12,242
  • 9
  • 49
  • 55
1 2 3
99
100