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 exec is not working in centos

I am trying to use the exec command in centos: exec(Yii::getPathOfAlias('application').'\yiic SendNow '.$sendID); this does not work in centos but this work in windows
Headway
  • 55
  • 6
2
votes
2 answers

How do I export environment variables from the Ant 'exec' task?

I am using Ant under WinXp to build MSVisual c++ projects. To access "devenv.com", being computer-independent, I would like to use the vsvars32.bat script. Unfortunately, it seems that environment variables are defined only in the "exec" scope.…
rockeye
  • 2,765
  • 2
  • 30
  • 44
2
votes
2 answers

How to use the name of the file with sed in a find expression

Trying to answer Using Bash/Perl to modify files based on each file's name I ended in a point in which I don't know how to use find and sed all together. Let's say there is a certain structure of files in which we want to change a line, appending…
fedorqui
  • 275,237
  • 103
  • 548
  • 598
2
votes
1 answer

Why PHP shell_exec is not working

The command for png optimization plugin Optipng: The tutorial for using the command Synopsis: optipng [options] files ... Files: Image files of type: PNG, BMP, GIF, PNM or TIFF Basic options: -?, -h, -help show the extended help -o optimization…
user782104
  • 13,233
  • 55
  • 172
  • 312
2
votes
1 answer

php compile less file using lessc via nodejs on windows 7

I am trying to compile less file using php, and I am trying to use lessc which I installed as nodejs module on my windows 7 I am trying to do : $command = lessc %s -compress %s via exec($command, $output); and if I do this via cmd it works fine…
Syed
  • 148
  • 1
  • 16
2
votes
3 answers

Returning argument to shell_exec() function in php script

I am calling executable file with main() function from php script using exec(). Which works fine but return all printf() values rather only returning array: main.cpp: #include #include #include "foo.h" int main(int argc, char…
user123
  • 5,269
  • 16
  • 73
  • 121
2
votes
1 answer

How to print phing output on browser realtime?

My project build process involves complex tasks & they are time consuming. If I execute Phing command line, I want end-user to display real time information on browser, about what's happening about the build (step by step). Using exec() will…
Parag Diwan
  • 3,007
  • 2
  • 19
  • 37
2
votes
0 answers

Jake exec not displaying exec output on windows

I have a simple command which im running in Jake, and it keeps failing however it doesn't tell me what the failure reason is. The command is the typescript compiler so the command looks like so: tsc app.ts Then the actual jake command looks…
Grofit
  • 17,693
  • 24
  • 96
  • 176
2
votes
1 answer

Run server-side js from php through exec()

I have a site running on Apache/PHP, and as a matter of performance, I wrote a javascript to do a specific task. I have installed node.js on server, in order to run this javascript. When I call the script from the command line, it works fine. See…
cawecoy
  • 2,359
  • 4
  • 27
  • 36
2
votes
1 answer

Execl (passing parameters) in c

I've problem with this code because this cycle not passing arguments correctly to son process and generate some error with fork. nproc is numer process to create as 5 for example x is set to 1 value and i want to pass to my new process as 1,2,3…
2
votes
0 answers

Java runtime.exec() error 2 but works in terminal

I am creating a command string by adding some strings together. If i debug my application and copy final string from variable it works perfectly in terminal. If try Runtime.getRuntime().exec(cmd1); where cmd1 is my string it doesn't work, i get…
JNM
  • 1,175
  • 4
  • 20
  • 39
2
votes
2 answers

Opening a new terminal with arguments from an existing terminal

In linux, I can open a new terminal by executing gnome-terminal command on the existing terminal, but how can i open the new terminal with arguments? I tried gnome-terminal --command ls but the new terminal opens and closes quickly before I can see…
Muhammad Omer
  • 543
  • 1
  • 8
  • 15
2
votes
5 answers

How to call a function of another file by using exec command from current file

I have a file, Notification.php, which is a class. Its structure is like this: Class Notificaiton { public function sendNotification($token,$count) { // Here is the code for sending push notification(APNS) } } Normally, if…
Ponting
  • 2,248
  • 8
  • 33
  • 61
2
votes
1 answer

Is running a C/C++ CGI script on Apache dangerous?

I am currently programming my own little website system (a script that compiles Markdown documents, and puts them in appropriate locations, thus making a quick, static website). I would like to enable people who go to my (initially static) contact…
Diti
  • 1,454
  • 3
  • 23
  • 38
2
votes
3 answers

Php : running ssh from Windows to login to a Linux and run a script

Here's my goal : I have a Windows XP PC with all the source code in it and a development database. Let's call it "pc.dev.XP". I have a destination computer that runs Linux. Let's call it "pc.demo.Linux". Here's what I've done on "pc.dev.XP" (just…
Olivier Pons
  • 15,363
  • 26
  • 117
  • 213