473,320 Members | 1,810 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

exec() and &

At the shell you can always type "rm -rf /tmp/* &" and let the delete
command run in the background. Is there a way to do this from a php
shell script?

I've tried `rm -rf /tmp/* &` ... but with the backticks it still
waits for the command to finish before moving on to the next. I've
also tried exec() with no luck. Anyone know any tricks?
Mar 15 '08 #1
3 1602
On Mar 14, 9:54 pm, Bryan Andrews <bryanandr...@gmail.comwrote:
At the shell you can always type "rm -rf /tmp/* &" and let the delete
command run in the background. Is there a way to do this from a php
shell script?

I've tried `rm -rf /tmp/* &` ... but with the backticks it still
waits for the command to finish before moving on to the next. I've
also tried exec() with no luck. Anyone know any tricks?
http://us.php.net/manual/en/function.pcntl-fork.php

It's not really threading, but you can escape the parent process while
the child is running.
Mar 15 '08 #2
On Mar 14, 7:33 pm, Steve <steve.h...@gmail.comwrote:
On Mar 14, 9:54 pm, Bryan Andrews <bryanandr...@gmail.comwrote:
At the shell you can always type "rm -rf /tmp/* &" and let the delete
command run in the background. Is there a way to do this from a php
shell script?
I've tried `rm -rf /tmp/* &` ... but with the backticks it still
waits for the command to finish before moving on to the next. I've
also tried exec() with no luck. Anyone know any tricks?

http://us.php.net/manual/en/function.pcntl-fork.php

It's not really threading, but you can escape the parent process while
the child is running.
That worked great, thanks!
Mar 15 '08 #3
In article <1b3a9e06-a84d-4a95-a22a-
d8**********@e25g2000prg.googlegroups.com>, br**********@gmail.com
says...
http://us.php.net/manual/en/function.pcntl-fork.php

It's not really threading, but you can escape the parent process while
the child is running.

That worked great, thanks!
Seconded - very interesting reading - thank you.
Mar 17 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Shagshag | last post by:
Hello, (i'm particulary interested in security issue - php is running on apache + linux) i need to pass the result (here $exp) of a form submission to a third part application using : ...
3
by: Mike | last post by:
Hi This will not work, does any one know why? exec("/usr/usr/bin -C $U2 &"); Thanks
1
by: Andr? Roberge | last post by:
I have the following two files: #--testexec.py-- def exec_code(co): try: exec co except: print "error" #-- test.py--
0
by: Jan | last post by:
I store sql-commands in a database table. In the first step I get the sql command out of the database table with embedded sql. In the second step I try to execute the command, which i got from the...
3
by: shahid.juma | last post by:
Hi, I have an exe that I want to run with php. In the console, it works perfectly fine. There is a problem with security and it doesn't seem to run. I have tried the following after...
17
by: comp.lang.tcl | last post by:
The TCL command I am using will do a command-line action on a PHP script: set cannotRunPHP I have to do it this way as both the TCL script and the PHP script run as CLI. However, "info.php"...
2
by: Marty Meyers | last post by:
I have the following line in a php file: $msg= exec("perl $scriptPath/insert.pl $d $u $t 2>&1", $returnVal); Can someone explain the "2>&1" argument? Second problem, this same line of code...
4
by: vol30w60 | last post by:
Hi folks, I am trying to launch a program with PHP code. I am running Apache on Windows XP SP2. I am using the method noted here: http://us2.php.net/manual/en/function.exec.php#59428 To...
0
by: himanshu11 | last post by:
Hi All, What this command will do? exec 2>&1
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.