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

what is the difference between eval and exec in python?

Possible Duplicate: What’s the difference between eval, exec, and compile in Python? I known that eval is a function exec is a statement And the simple usage of both is : eval('1+2') exec 'print 1+2' But there are other usages that I can't…
Tanky Woo
  • 4,906
  • 9
  • 44
  • 75
2
votes
1 answer

PHP exec() called via web vs CLI

I'm trying to use exec() in PHP and i get different results when using it through a web browser and via the command line shell. simple thing: calling this from a web browser results…
airtruk
  • 321
  • 3
  • 11
2
votes
3 answers

How can I dynamically select the interpreter in the shebang line?

I am trying to write a script which is called from the shebang line and returns the right interpreter based on a condition (in my case, based on OS version) and I can't understand why it doesn't work. I'll try to clarify by an example: Executable…
Oren S
  • 1,820
  • 1
  • 19
  • 33
2
votes
1 answer

no result!! using fork() to run execlp() with 2 pipes using dup2

I am writing a C program which will run Linux commands, like: cat /etc/passwd | grep list | cut -c 1-5 and i didnt have any result *here the parent wait for the first child(child_pid) to finish;and the first child wait for the second(pfils) !! any…
falcon1990
  • 23
  • 6
2
votes
1 answer

Run php script in background using exec

I have a php file to create a directory. I want that php file execute in background. I have written 2 files like below. file1.php
user1841408
  • 133
  • 1
  • 1
  • 8
2
votes
3 answers

PHP exec and header redirect

I have a long running PHP script that i want to be executed in background on server after a user action. and the user should be redirected to other page while command should be running in background. Below is the code $command = exec('php -q…
Asghar
  • 2,336
  • 8
  • 46
  • 79
2
votes
3 answers

PHP script exec bash script does not print all bash lines

I have php script on my redhat that im logging in as root via telnet client. My PHP script to run the bash script is(functions.inc): My Bash script: #!/bin/bash echo "Hello world" echo "Whats going on…
ilansch
  • 4,784
  • 7
  • 47
  • 96
2
votes
2 answers

Escaping spaces in WinSCP command-line when executing from PHP

I have a what should be a simple problem. I am trying to execute the code below in PHP. The goal of this code is to upload files from one folder to another folder in an FTP using a program called WinSCP. exec("C:\\xampp\\winscp.com backup /command…
user875139
  • 1,599
  • 4
  • 23
  • 44
2
votes
1 answer

How to run a shell script with root privileges from PHP?

I'm trying to use vpopmail's vadddomain to add new virtual domains. Since apache user has no access to vpopmail's binaries I cannot exec('../bin/vadddomain...') directly from PHP. I made a shell script (adddomain.sh) as below: #!/bin/bash cd…
user899205
2
votes
3 answers

Buffered Reader refusing to output data

I'm trying to create a program to find all files by a certain name on a Linux server, and then pipe their absolute paths into an ArrayList for processing. My method of using a Process (with exec) and a BufferedReader seems to have worked for all my…
Matthew Salsamendi
  • 294
  • 1
  • 5
  • 14
2
votes
1 answer

C++: execv/execvp not using existing PID

I have a C++ program that runs as a linux service. Some of the program's command line options simply set values in its configuration files and then exit, which then require the service to restart to pick up the new config. In order to allow the…
rdowell
  • 729
  • 4
  • 15
2
votes
3 answers

Execute Java on Ubuntu: PHP exec() is not working while console works just fine

My website needs PHP to run a Java program in the background. So, PHP issues exec() method to let Java do all the work. The implementation works fine on Windows, but completely failed on Ubuntu. While exec() doesn't work, a stand-alone test with…
Leo
  • 311
  • 2
  • 11
2
votes
0 answers

How to terminate task in ANT after starting server in Windows

I'm trying to start a weblogic server using ant exec command. After the operation triggers the exec process creates a child process i.e starts weblogic server. I wish to terminate the parent ant process after the server startup and keep alive the…
2
votes
2 answers

php exec infinite loop

I have the following which call the exec to run the script test.php in the background. exec("/home/gooffers/test.php?one=one &"); Script test.php contains the following $test = $_GET['one']; echo $test; However this is creating an infinite loop…
hedhud
  • 73
  • 1
  • 2
  • 9
2
votes
0 answers

how to call java class from mysql procedure via the sys_exec?

I want to execute the java code via he sys_exec in MySQL. I configured the sys_exec via the CREATE FUNCTION sys_exec RETURNS STRING SONAME 'lib_mysqludf_sys.dll'; When I run command SELECT sys_exec(" java HelloWorld ") FROM dual , this is not…
1 2 3
99
100