Forking Multiple Processes At A Time
i have a php script that needs to execute an external php script (call this
script 2) when the user clicks a link, however I don't want the user to have
to wait until script 2 finishes executing before he sees the output of
script one... i know I can use the exec() command to do this, and use the &
to run the command in the background....
but say i want to run 100 instances of script 2 when the user clicks the
link (with different arguments)... i dont want to have all 100 processes
running at the same time... what I would like to do is run 10 or so at once,
and once those 10 are completed, run another 10...
View Complete Forum Thread with Replies
Related Forum Messages:
Max_execution_time Ignored, Multiple Apache Processes Spawned
I have an app that is going berzerk on its own; without any code or environmental changes of any kind, for some bizarre reason it will randomly just hang, spawn multiple Apache processes and completely ignore max_execution_time, literally running infinitely. Using PHP 5.2.0, Apache 1.3 and Win XP Is this normal "bizarre" behavior that can occur within this setup; if so, what workarounds have you found to combat this, other than the obvious (try to debug and fix code)?
View Replies !
Forking A Process
What i should i use to create a script that does two things at the same time ie while sorting/execeuting a process, how can i show another screen with valid data on it?
View Replies !
Forking PHP On Windows 2003.
We are attempting to fork a php script into a background php script and have the first scrip continue to completion. Is this even possible in the windows version of php? We have used the many code snippets floating around on the Internet claiming to fork on Windows, yet we never get it to work properly, sometimes ending up with hunderds of dead php.exe processes on the machine. Our environment is: Windows 2k3 server PHP 4.3.6 (cgi-fcgi) (built: Apr 14 2004 17:21:37) If there is any other info needed to determine the problem I'll gladly reply with it.
View Replies !
Forking A PHP Process Into The Background In A Web Server Environment
I have installed the PCNTL functions[1] on my PHP enabled webserver in the interest of being able to fork a process into the background so I can do some heavy processing but return control of the browser back to the user rather quickly. However, after mucking about with PCNTL for a while and not getting the results I expected, I finally stumbled across this line in the opening parragraph on PCNTL functions on PHP.net: "Process Control should not be enabled within a webserver environment and unexpected results may happen if any Process Control functions are used within a webserver environment." Seems like they should bold and highlight in red that line, but I digress. In any case, can anyone suggest a way to fork a process off to unload a large amount of processing and return control of the web browser to the user? All the examples and whatnot I have found assume a CLI version of PHP. I want to do this on the web server! [1]I am running Apache2/PHP4.3 on RHEL 4. I downloaded the RPM for PCNTL at
View Replies !
PHP Processes
I have a cronjob triggering a php script that takes several minutes to accomplish. I need to prevent multiple triggering by the cronjob mulfunctioning. So I would like a clean way to know how many instances of a certain php are currently working on the server. is there a server variable for that? if not, how do I know (via php) how many concurrent accesses are there to a certain php page? for example in mysql (the "SHOW PROCESSLIST" command), but I need a similar function for the php page iself.
View Replies !
Background Processes
I'd like to know how to send an external process to the background, so that I can run multiple instances of the same process at one time. Any tips, links.. etc?
View Replies !
Listing Processes In PHP
Using PHP, is it possible to return and display a list of currently running processes on the client's machine? In fact, is it possible to run a system command on a client's machine?
View Replies !
Automated Processes
Customers post 'projects' to my site. These 'projects' are closed after 10 days. I could run a script on the default.php page that detects this, but it seems a waste of resources to run it everytime someone visits the site. Is there a way around this, for example the first visitor to the site in any, say, 3 hour period, runs the script & switches the most recently outdated projects from open to closed?
View Replies !
Max Number Of Processes
how can i determine what the maximum number of processes i should open with popen (or proc_open) is? i assume it'd depend on the hardware of the computer in question, but if that were teh case, then is there a way to get info. about it, and some general method to determine a good number of processes to open from that info?
View Replies !
Search Multiple Tables At One Time
I use a search script and it searches the db like this $query = "select * from names where product like "%$trimmed%" what I would like to do is not only have it search a table called "names" but also "stores" as well for the "product" field. I don't have server access at the moment to test it but would it just have to be something like $query = "select * from names,stores where product like "%$trimmed%" or is something else needed?
View Replies !
Stranded PHP Processes And ProcessExplorer
Does anyone know what it means if I see PHP processes in the process tree at the base level, instead of under the IIS worker process? I do nothing but web serving off of the box. These processes that are not under the IIS worker process seem to be stranded/hung. They are never cleaned up by any garbage collection and I have to kill them manually. They also always have a fairly low memory usage, potentially indicating that they fail before loading completely. Could it be that the execution of the process fails early enough that ProcessExplorer doesn't see them as being executed by IIS?
View Replies !
Handling Long Processes
I am building web app, that will run a long processs (image processing) that can porbably take 15-30 minutes to complete) in respond to a user request (the user clicks a "process" button on a php web form). The ideal situation that I see is once the user's request was recevied, a reply that says "you request is being processed. we will send you email once finished", will be sent to the user, while the other process will take place. When it's finished, a callback function will be called that sends email to the user notifying him the process outcome. What are the options to implement that? multithreading?
View Replies !
Shared Memory Between 2 Processes?
I have two running php processes (they have infinite loops) and I need them to pass some data to eachother. Writing and reading shared memory in one process works just fine but when I try to save var in process1 and read in process2 I get error: "Variable key 555 doesn't exist". What I'm doing wrong? //PROCESS 1 (saving var) $key = 'My Key' $value = 'My Value' $app = 'lovelyapp' $key = $key . 'a' $segment_key = abs(crc32($app . $key)); $segment_size = 1024; $segment_perms = 0600; $shm_id = shm_attach($segment_key, $segment_size, $segment_perms); shm_put_var($shm_id, 555, $value); shm_detach($shm_id); // PROCESS 2 (reading var) $key = 'My Key' $app = 'lovelyapp' $key = $key . 'a' $segment_key = abs(crc32($app . $key)); $segment_size = 1024; $segment_perms = 0600; $shm_id = shm_attach($segment_key, $segment_size, $segment_perms); $value = shm_get_var($shm_id, 555); shm_detach($shm_id);
View Replies !
Select Multiple Submit Buttons At One Time
im using the line below in a while loop, but i want to be able to select multiple submit buttons at one time so,but at the moment im not sure how to change the name of the button as it could be a while loop for x amount of times. i could count how manytimes i need to go throught the loop and then output the submit button but then how do i change the name in this loop automatically? does this help. im on here so ne qns just reply and il answer within a few secs. while($i<$count && $results = mysql_fetch_array($result, MYSQL_ASSOC)){ <td align="center"><input type="radio" name= "txtbox[]" value = '.$orderId.'Â unchecked> Selected</td>
View Replies !
Insert Processes Before Form Is Submitted
I am trying to stop using Macromedia as my crutch and you guys have been a big help. I need some assistance with submitting a form. I have a form on my page and need to do an insert. I have the action posting it back to the same page I am on versus sending it to an insert page. The problem I am having is it trys to do the insert as soon as I pull up the page instead of waiting till the form is submitted. I believe I need to do something with isset, but can't really find a tutorial that goes over it really well. Code:
View Replies !
Large Data Transfer Between 2 Processes
fist the context: I have a web server which query a mySql database. but as the number of parralel queries increase, the server slows down too much. I got 2 ideas, one of which is to run N deamons which effectively execute requests. the PHP uses message queuing(1) to queue queries request to the daemons. but the answer may be quite large, larger than messages the message queueing service can handle. I thought to open back a communication link between the current daemon and the waiting PHP to tranfer/process the result, using the message queueing service to send back info regarding the opened link. I thought to open a pipe between the current daemon and the PHP. is this possible? and if so, how? if not, is an IP link to localhost be as fast as a pipe?
View Replies !
Session Problem With Multiple Scripts Running At The Same Time
I've noticed a rather interresting problem with sessions and multitasking scripts.. Let's say I've got 2 frames and both running a program that prints 1000 dots at rate of 1 per second. Pretty simple. And this works, great. Both frames print dots at the same time. So this is the the problem: If I put session_start(); in these scripts (or have session.autostart defined), the other script doesn't start until the first one finishes. Does PHP lock the sessionfile while executing the script or something and script waits until the lock's released? Has anyone figured where the problem is? It would help my project very much if I could use session while running the script.
View Replies !
Multiple Scripts Running At The Same Time Cannot Execute Session_start().
I'm writing an application that has an over-abundance of AJAX. I have a central script that the user interacts with, and several scripts are called via AJAX request to do various things. It seems however, that multiple scripts running at the same time cannot execute session_start(). Like, If I have one script that is running on the server, that is using sessions, and then kick off another script, the second one will not proceed until the first one is finished. I need them to run simultaneously. It appears that session_start puts some sort of mutex on the session file on the server, and locks it from multiple access. That makes sense. Am I interpreting the problem correctly and is their a way around it. I don't want to have to use plain old cookies.
View Replies !
Keeping Users Informed In Lengthy PHP Processes
Often PHP processes take a long time, such as wildcard searching a PostgreSQL database, or generating thumbnails. The PHP host page does not display until the script is complete, so you can not effectively use code such as echo "Converting file ".$Infile; exec(convert $Infile $O8utfile); for realtime feedback to the user. How have others implemented a "progress meter" in PHP processes , one thought I had was to use Javascript redirection to call a PHP page with differing parameters each time .
View Replies !
Sending Signals To Processes As A Different User Than Owner Using Php
i know, it seems more to be a problem according to unix but i got it while developing software with php: i have 2 different users on a hp-ux machine that execute php scripts. they are both in the same group. these php scripts start background processes, i can communicate with using signals (sending with posix_kill, starting background processes via pcntl_fork). so i got severel background processes owned by my 2 users. the problem is i want to send signals as one of my 2 users to all my php background processes no matter who of my 2 users is the owner. is it possible other than using external tools like sudo? i'm using: PHP 4.3.4 (cgi) (built: Aug 18 2004 15:37:46) Copyright (c) 1997-2003 The PHP Group Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies compiled with: ../configure' '--prefix=/usr/local/php-cgi-saprfc' '--enable-calendar' '--enable-filepro' '--with-gd' '--with-jpeg-dir=/usr/local' '--with-zlib-dir=/usr/local' '--without-mysql' '--enable-sysvsem' '--enable-sysvshm' '--with-pgsql=/usr/local/pgsql' '--enable-trans-sid' '--with-cpdflib=/usr/local' '--enable-sockets' '--with-ncurses=/usr/local' '--disable-shared' '--with-tsrm-pthreads' '--with-saprfc=/usr/local/rfcsdk' '--enable-pcntl
View Replies !
Limiting The Number Of Spawned MySQL Child Processes
Need to know if there is any way to limit the number of spawned MySQL child processes in linux ? I have done my research at http://www.mysql.com and have not been able to find my answer. Have also looked at the source code (what i can understand of it). Using MySQL v.4.0.25-max. Using an older system and the 14 childern are just bogging the system down. I am the only one with access to the server so 14 childern is overkill.
View Replies !
Checkboxes - Loop That Takes The Values And Processes And Writes The Changes To The Database.
I generate a form page from my MySQL database. let's say the table structure is: Table A > ID, title, active the number of rows generated by the query is dynamic. If a field's value is 1, then the form output appears as <input type=checkbox name=$ID checked> $title and if not <input type=checkbox name=$ID> $title At the bottom of the form there is a submit button. The visitor can check/uncheck rows and then submit the form. I need to write a loop (possibly foreach) that takes the values and processes them and writes the changes to the database.
View Replies !
Build A Page That Takes Form Data, Processes It In A Second Page
I'm trying to build a page that takes form data, processes it in a second page, then sends the user to a third,depending on data processing. On the second page, I am trying to get the page to have some sort of "Loading" message while the backend processes the data, but I can't seem to get anything to work. Does anyone know how I can get that Loading message to display?
View Replies !
Max Execution Time Means Server Execution Time Or Client Browser Hung Up Time?
The max execution time is set up to be 30. When I submit the requests of execution through the client browser, it shows the execution was running. It still hung up there after 30 seconds, after 2 minutes ... And the browser hung there forever. I have another page which saves the reports of the execution, so I open another browser window, and check out the report. It shows me the execution is still going even after 1 minute, 2 minutes... Code:
View Replies !
Compute Current Time For Mountain Standard Time With Daylight Savings (MDT)
I'm trying to compute current time for mountain standard time with daylight savings (MDT);and without DST (MST), eg: Phoenix, AZ. If I use the PHP timezone "US/Mountain", it returns MDT correctly. What is the PHP time zone for MST? Similarly, are there PHP time zones for Pacific, Central and Eastern time zones without Daylight Savings? The PHP time zones US/Pacific, US/ Central and US/Eastern all show time with Daylight Savings.
View Replies !
Show Time / Date To Reflect Eastern Standard Time
my web host is located on the west coast i live on the east coast so if my page shows the date: $day = date(d); $mth = date(m); $yr = date(y); echo $day . "-" . $mth . "-" . $yr; i shows the date as of west coast time. so the time now is 1:40am april 6, 2007 my page will still show april 5, since west coast is 3 hours back. (10:40pm apr 5) how do i compensate for this time zone difference? i want my time / date to always reflect eastern standard time.
View Replies !
Convert Query Results To Time Date/time Format
i have a query which displays the start time, end time, and also the duration. these results are displayed, however the duration doesnt seem to display in the correct format, it is displayed as numbers but not in the correct format. Code:
View Replies !
Adjusting Time Displays For User's Local Time
I have a news/comment site where stories and comments are accompanied by the date they were posted. Currently I'm doing that in the GMT format, simply because it's easiest. What I'd like to do, however, is have the page display posts and comments with "your time," i.e., the local time of the user (example of what I'm talking about here). I know how to get local time variables from a user with javascript, but I'm not sure how to pass that information to PHP, especially since I'd like to do this on the front page, which means no passing javascript information via query strings.
View Replies !
Ow To Add Then Display The The Total Amount Of Time For A Given Set Of Time Stamps.
I need to know how to add then display the the total amount of time for a given set of time stamps. For example my page looks like this: task--------time 1-----------start at 8:00 1-----------end at 8:10 2-----------start at 8:12 3-----------start at 8:13 2-----------end at 8:14 3-----------end at 8:20 //notice there is no 8:11 I need to add then display the total amount of time it took for all tasks. Then separate the individual tasks then figure and diaplay the total amount of time needed for each individual task. Code:
View Replies !
Time System Report On Delinquent Time
Going Nuts with this array. My goal is to have a time system report on delinquent time that looks like this. Tom Doe Tom@workplace.com. Entered: 0 Hour(s) on: 2005-02-02 Entered: 0 Hour(s) on: 2005-02-01 ***************** Jane Doe jane@workplace.com. Entered: 0 Hour(s) on: 2005-02-02 Entered: 0 Hour(s) on: 2005-02-03 [color=blue][color=green][color=darkred] >>>>>>>>>>>>>>>>>>>>>>[/color][/color][/color] What I'm getting is this Jane@workplace.com. You have entered insufficient time on: Employee: Jane Doe Entered: 0 Hour(s) on: 2005-02-01 Tom@workplace.com. You have entered insufficient time on: Employee: Tom Doe Entered: 0 Hour(s) on: 2005-02-01 Harry@workplace.com. You have entered insufficient time on: Employee: Harry Doe Entered: 0 Hour(s) on: 2005-02-02 Jane@workplace.com. You have entered insufficient time on: Employee: Jane Doe Entered: 0 Hour(s) on: 2005-02-02
View Replies !
Determining If Time Falls Into Time Frame
I am having problems determining whether the current time falls into a certain time frame. I want to be able to allow my users to set a start and end time of when they do not want to be disturbed. for example: between 11pm and 3am every day. I would then store this as 23:00:00 and 03:00:00 in a table. If the times were on the same day then this code would work: PHP Code:
View Replies !
Convertint Time String To Time Stamp
I want to convert the time string from the if-modified-since header into a unix time stamp, so I looked at the strtotime() function. The PHP manual on that function makes reference to a GNU manual page, which indicates that only UTC and Z are unambiguous. However, a last-modified-header is followed by "GMT". They are synonymous, but can I safely use it with strtotime()?
View Replies !
Calculating Time - Get Time From A Video Game
When I get time from a video game it has the time syntax like 0D 0H 0M and it can hold data up to 23D 23H 59M. So how would I take that type of syntax and take only the H and M time variables and put it into a database called Minutes & Hours. Dont worry about the Day datatype because no-one will spend 1 day in a game unless thier idleing which would be cheating. So take 0D 14H 42M and put it in 2 colums in a database the one bing Hours And THe Other Being minutes. I think theres an explode and implode statements in ther but I have no idea on how to do it.
View Replies !
Arrange Posts By Time The Time Is Stored
I have a databse called phpb1 (The forums- obviously!) I use the below simple code to retreive posts: mysql_select_db(npsari_phpb1); $q = "SELECT * FROM phpbb_posts_text ORDER BY ???? DESC LIMIT 100;"; $res = @mysql_query($q); I want to arrange posts by Time The Time is stored in another Table How can I connect between two tables?
View Replies !
Subtract Time From The Current Server Time
i have a time that i will get from a mysql database (so it will be in mysql format, YYYY/MM/DD HH:MM:SS). what i would like to do is subtract this time from the current server time in order to get the difference between the two times, expressed as 'x days, x hours, x minutes and x seconds'. any pointers or tips on how to do this .
View Replies !
Time Comparison - Asking The User To Select The Between Time?
I have a form thats called Conference Room Booking. In that i need to asking the user to select the between time(like 5:30 to 6:30) Everything is ok. now my problem is i shud not allow the user to select the same time. for example Another user has been requseted the time between 5:30pm to 6:30pm .Now i shud not allow the following times thats 4:30 to 5:00 5:30 to 6:00 and so on.
View Replies !
|