Possible To Check To See If Windows Process Is Running From PHP?
I need to check the state of a processes from within a PHP script on a
Windows machine. All I need to know is whether or not the process
exists (i.e., is running). Anyone have any ideas?
I searched the archives and found proc_open(), but if it can do what
I'm trying to do, I can't figure out how.
View Complete Forum Thread with Replies
Related Forum Messages:
Display If $process Is Running
How can I display if a process is running... For example, I'd trying to write a snippet of PHP code that will check if a process is running and display a message on the resulting webpage depending on whether it's running or not: Code:
View Replies !
Continuously Running Process
Would it be a high load on a server to have a php process run from the executable, continuously looking for existence of files in a folder and processing them if they are there? Just an endless loop that checks for the existence of the files. If they are there, do something with them, if not keep looping? It is not a web accessible application but something for server admin.
View Replies !
Running PHP Process In Background
Here's the deal, I work on a PHP based menu system for my company. The menu system allows users to run reports, change settings on our Linux box, etc. My problem here is with the reports. Some of them can take 10-15 minutes to run. That's a long time to force the user to sit and watch a "Loading..." screen. What I'd like to do is somehow send the report process to the background. Code:
View Replies !
Running A Background Process
I' m trying to run a php script in background using exec(). I have a browser request to eventtest.php, which contains: <?php exec("/usr/local/bin/php -q event1.php &"); die(); ?> ==== event1.php has: <?php error_log("initiate event1", LOG_FILE); die(); ?> the result is that the log entry is never generated if eventtest.php is requested, but works fine if event1.php is requested directly. While eventtest.php is running, i see stuff like this from ps -aux, repeated many times. Any ideas what is going wrong? Is there a better way to initiate a background php process. I am running this on a shared hosting environment on Linux Code:
View Replies !
Error Running Exec() To Kill A Process
Red Hat Linux 7.3, Apache 1.3, PHP 4.3.3 I am trying to create a PHP script to terminate a process that is running on the server. The file and folder permissions are set correctly, but I am getting the error "kill 943: Operation not permitted"; I am running the command "exec ("/bin/kill 943");".
View Replies !
Best Way To Structure A Continuous Running, High Load Process?
I have a web app that needs to continuously upload large amounts of data to a server. What to upload and when to upload it is stored in a database, but it needs to do this continuously, and needs to be pretty fault resistant. I was thinking cron jobs, but it really needs to run all the time, not at regular intervals. Is there some way so I can make it so it runs constantly, processing it's queue? Also, could it use a new process to handle the queue items? So if there are three items in the queue, it will make three processes, but still keep processing?
View Replies !
How Can I Kill A Running Child Process When Client Closes Connection
running PHP5 under Apache 2.2 (prefork) as module, I call a Python script that does a sometimes lengthy MySQL query, using parameters supplied by the browser client. When the query takes too long, the user may want to press the STOP button and issue a different query. But the previous child process will run to completion in any case, wasting server resources at the very least. In the current setting there seems to be no way to forward the user action to kill the child process. The system() call is blocking, and the only chance to see the closed connection in the PHP script is after it has returned. Is there a work-around? I'm advised not to use the pcntl_fork() etc. in embedded PHP. Are there other possibilities? Please don't say I should have done everything directly in PHP, without a system() call. I'm much better in Python, that's the reason why, and also I think the call to execute_query (or whatever it is called) directly from within PHP will block as well. Any suggestions, best proven real-life solutions, are welcome. I thought this must be an everyday problem, or?
View Replies !
Want To Spawn Process From Windows PHP
I wanted to write some code purely on Linux, but unfortunately the document scanner drivers are non-existent for the high-end commercial document scanners. So, I had to port my Linux PHP project to Windows PHP (WAMP). There, I found a scanning tool (Kodak Image Scan - imgscan.ocx) that I can put on a VB form, tell it to scan some documents into a TIF file, and then shut down. I can run this VB app at command line just fine, but when I run it from either a popen(), system(), or exec() call, it won't detach from the PHP page. Instead, it just sits there. I can see the VB exe I made is being loaded properly in RAM, but unfortunately it sticks and won't unload on its own, nor will it tell the scanner to engage. I have to kill the VB exe and then the PHP page continues. What's the way to spawn a detached process from PHP on Windows?
View Replies !
Process Management In Windows
All I need to do is run a windows batch file from a small php program, and return the windows process id of the batch file. I have played around with proc_open() but that returns a resource id. Does anyone have a suggestion on what call I could use to get the windows process id returned within my program. I am using windows xp pro, and php 5/apache
View Replies !
Calling PHP From A Windows Process
I'm calling PHP from a windowsprocess in a simple Webserver application. I'm using the createprocess Windows API command.... C:PhpPHP Filename.php In this file I will open a TCP/IP connection to my SQL-server. When I do so, I always get the following error mysql_connect(): Can't create TCP/IP socket (10106) No I start a command shell and I call the same... C:PhpPHP Filename.php This will work without any error!! Same effect I get from all TCP/IP Actions (FTP etc....) Can somebody help me. Is it a PHP Setting, a server variable or a WindowsXP Access right problem?
View Replies !
Shell_exec Background Process *Windows*
I am trying to get a shell_exec command to run in the background. So far I have tried: $ret = shell_exec($ffmpegcmd1." >NUL 2>&1");$ret = shell_exec($ffmpegcmd1." >NUL 2>&1 &");$ret = shell_exec($ffmpegcmd1." >NUL"); without any luck.
View Replies !
Running PHP On Windows XP
I installed Apache/MySQL/PHP on Windows XP. There was one problem. Microsoft IIS 4 or higher was defaultly selected for MySQL. It did not work. When I double-click a PHP file, a lightning-fast MS-DOS window opens and closes. When I go to start, then go to run, then type "cmd", then type the PHP file path, I take a long time to see what happened. I want my PHP file to work on my browser offline just like uploading and visiting my PHP file on a web host with my browser online. In other words, I want the interactivity of my site to happen in my computer. How can I do that?
View Replies !
Mcrypt Lib Running Under Windows
I need to use encryption functions with php, such as mcrypt_generic(), mcrypt_decrypt(), etc I have placed libmcrypt.dll in my windows/system32 directory. I can now encrypt, but not decrypt. The code I use to encrypt / decrypt functions under Mac OSX + Linux, but not Windows.
View Replies !
Running A Windows Command Line From A Web Page
I have a web page on an intranet, i need to run a command in the local windows run from the webpage. for example when you press a button button on a webpage it has the same effect as running cmd from the run prompt on the local machine. Anyone know how to do this?
View Replies !
Having Problems Running Some Files On Apache For Windows
I am running Apache 2 for windows and have PHP installed and working fine on the server. However, some of the php scripts and programs i have do not use the <?php starting tag, the use <? instead, and as a result of this, the script does not execute. Can anyone tell me how i can configure apache to allow both <?php tag and <? aswell?
View Replies !
How Can I Check If A Server Is Up And Running?
Is there any way to check if a server is running and then refresh to it? maybe something like this: <?php $url = "http://www.mysite.com"; if(server_status($url) == true){ header('location : $url'); } else{ echo "Server down -- TRY AGAIN LATER"; } ?> I was looking at php.net and i found Memcache::getStats(), but i don't know what that does...
View Replies !
How To Check If Mysql Is Running
I have just installed mySQL win32 version and i dont really know how to get the service to run or if it is actually running. is there any php code that will check to see if it is running. if it is running, can someone tell me how i am actually suppose to manage and add new databases etc?
View Replies !
Ftp Via Scrip Check If File Exist Before Uploading Process Begins Problems
I wrote a PHP script that allows users to upload files to a FTP Server, the script works perfectly fine and files get uploaded with no problem. The issue i'm having is checking if the same file already exist on the server, when i upload the same file, it starts to upload and then returns with the error message and doesn't upload to the server like I want it to. My question is if there is a way to check before the upload process begins instead of wasting time and having to come back with the error message: Code:
View Replies !
Check If A File Is In Windows-1250
i need to check a file to see if its encoded in windows-1250 so ican convert if it is... i cant just convert the files that are in the correct encoding because this adds some strange characters where there shouldnt be does anyone know how i can check? ie if (windows1250($doc)) { iconv(...); } how do i do that check?
View Replies !
Check Windows Folder Permissions
I'm writing some PHP code which acts as a web-based file browser. It lists all the directories and files on a server by checking the server directly rather than going through FTP. The files and directories on the server have permissions which restrict them to certain users. What I want the code to do is check if the user who is currently logged in has permissions on the file or directory and if so, check if the permissions are sufficient enough tpo perform the requested operation. Code:
View Replies !
Check That The Image Is "complete" Before Running The Script?
I have a script that processes a live image from a webcam, cropping it and delivering it to the user. The webcam ftp's an image called "ftp.jpg" every so often, and when the user loads the "live image" page, the script opens the ftp-ed image and creates and saves a new jpeg with the cropping applied. The problem seems to be, if the user runs the script and the new image hasn't finished ftp-ing in, the resulting cropped image is black - nothing. Is there some way to check that the image is "complete" before running the script? If not, any suggestions for avoiding trying to process an incomplete image?
View Replies !
Warning: Invalid Argument Supplied For Foreach() Running On A OS X Machine Running Apache 1.x And PHP 4.x.
The following script was running on a OS X machine running Apache 1.x and PHP 4.x. I just moved the script over to a Linux machine running Apache 2.0.51 and PHP 4.3.8, and now the foreach line does not work. It says Warning: Invalid argument supplied for foreach() in /var/www/localhost/htdocs/warehouse/whse_order_submit.php on line 39 Here is the script: <?php //get the variables from the other page $id=$_POST['id_no']; $sku=$_POST['sku']; $description=$_POST['description']; $order=($_POST['order_qty']); $store=$_POST['store']; $comment=$_POST['comment']; $ip=$REMOTE_ADDR; //check if store is empty if(empty($store)) { die("Store is required. Please press the back button and enter in your store."); } //connect to the database require('../inc/database_conn.php'); //$month=getdate(mon); //$day=getdate(mday); //$year=getdate(year); //$today=$year . "-" . $month . "-" . $day $today=date('Y-m-d'); // create the unique order number $headerqry = "INSERT INTO misc_order_header (order_date, store, comment, ip) VALUES ('$today', '$store', '$comment', '$ip')"; mysql_query($headerqry, $conn) or die(mysql_error()); $order_no=mysql_insert_id(); foreach($order_qty as $id_no => $val) { if($order_qty[$id_no] > 0) { $detailqry = "INSERT INTO misc_order_detail (order_no, id_no, sku, order_qty, order_date, store) VALUES ('$order_no', '$id_no', '$sku', '".$order_qty[$id_no]."', '$today', '$store')"; mysql_query($detailqry, $conn) or die(mysql_error() . "<BR>" . $detailqry); } }
View Replies !
Add A Drop Down Menu For Check In And Check Out Date
i have done a booking system and want to add a drop down menu for check in and check out date. I have done the drop down menu and the date display in is today's date. I wanted to make the the date 3 days in advanced of todays date. <select name="dayIn" > <? for ($i=1;$i<=$days;$i++) { if($i == $_POST['dayIn']) { ?> <option value="<?=sprintf('%02d', $i)?>" selected><?=$i?></option> <? } else if($_POST['dayIn'] == "" && $i==date(d)){?> <option value="<?=sprintf('%02d', $i)?>" selected><?=$i?></option> <? } else { ?> <option value="<?=sprintf('%02d', $i)?>"><?=$i?></option> <? } } ?> </select> and here is my code for check out: <td>Check-out date</td> <td> </td> </tr> <tr> <td><select name="dayOut"> <? #$nextDayOut=$_POST['dayIn']+1; $nextDayOut = date('d', strtotime('+1 days')); for ($i=1;$i<=$days;$i++) { if($i == $nextDayOut) { ?> <option value="<?=sprintf('%02d', $i)?>" selected><?=$i?></option> <? } else { ?> <option value="<?=sprintf('%02d', $i)?>"><?=$i?></option> <? } } ?> can anyone help me figure this thing out?
View Replies !
Sort Of IP Check Or Other Security Check
Do sessions already do some sort of IP check or other security check or do I have to do this manually? My problem is that I want to use sessions to log in users to my message board. My concern is that a non-cookie user, we'll call her Mary, will post a link to another message at my site and that link will include her session id. If someone else, call him John, clicks on that link, will John now have the same session id as Mary? Or are sessions smart enough not to let that happen?
View Replies !
File Check-in/check-out System?
I'd like to a build a PHP-based interface for sharing documents (MS Office docs, latex, etc). I need to be able to allow users to "check-out" the files for their exclusive use and then go through a "check in" process when they re-upload the doc so it's accessible again to everyone else. I'd also like to implement some form of version control where older versions of the docs can be in some sort of repository. I'm not quite sure how to approach either concept. I'm wondering if anyone can give me tips on how I might go about this.
View Replies !
Process ID
I am starting a process with the system command via a php page. I want to put a button on the same page which will let the user kill the process by clicking that button. To do this, I need to know the process ID. I could grep for it, but that also returns the grep command. How can I make PHP tell me the process ID of a process I started? It seems as if this would not be a problem but I guess I am missing something.
View Replies !
Getting Your Own Process ID
I am doing some work where I want to do locking, and prevent scripts from running in parallel. I see that I could use the semaphore mechanism, but I'd like for my code to be portable, and that extension is not enabled in many places. I need some way for a process to uniquely identify itself. It can then look at the storage container (flat file, DB, whatever is appropriate in context), check to see if the requested semaphore is available, and if it is, acquire it and then mark itself as the owner. It can then check that it did in fact get ownership (as opposed to another process which attempted to acquire it at the exact same moment) before proceeding. Code:
View Replies !
Process Name
How do you send a variable with a php process name? I have one script that different websites are running in the background. I want to be able to identify which website is running which process of the script. /usr/bin/php /home/thescript.php - domain1.com /usr/bin/php /home/thescript.php - domain2.com
View Replies !
Run Process In Background
I want to run process from my php script in background. I try different functions from functions list but all of them whaiting for process ending. How can I run `wget -b ...` and finish my script, but wget must still working? I use PHP5, Linux, Apache2.
View Replies !
Multithread A Process
can i use php to multithread mail() or something similar? in my company i need to send multiple copies of email to a few hundred ppl affilated and on my list. instead of calling mail over and over again i would like to thread this process. could someone point me to some documentation or perhaps an example of where to start with this?
View Replies !
Fetch & Process
I doing a straight forward webpage fetch and saving it to a file: CODE: $open = @fopen($url, "r"); $urlfile = @fread($open, 50000); @fclose($open); $page = split("",$urlfile); $datafile = fopen($tempfile, 'w'); foreach ($page as $line) { echo($line); fwrite($datafile,$line); } fclose($datafile); So I basically just write the fetched HTML line by line to a local file. The weird thing is I'm getting a bunch of ^M characters in the final file after every $line is written to the file.
View Replies !
PHP Process Problems
I'm having problems with php process in win2k. I have apache+php intalled on a win2k machine and after some use I can find 1,2 or 3 non-terminated process in the system. I try to kill them but I receive access denied (even logged as administrator :confused, and I have to reboot the machine. While I have 1 non-terminated process, I have no problems. But when it reaches 3 process php scripts doens't work anymore. If I try to load a page, it doesn't execute the scripts and the browser keeps waiting forever. What maybe the problem? Why can't I kill the process?
View Replies !
Process Form Twice
I have a basic form on one website. But the way it is setup is once the submit button is hit it takes them to a different site where the form is processed. Is what I need to do is have a way that once the submit button is hit I need to save the persons name only in a text file or something then have it go to the other page to be processed. Does that make sense. i know how to save the info from the form to a text file but don't know how to have it do both, save the name and then take the user to the other page where the registration form is processed.
View Replies !
Trouble With A Php Process
I have set up a form and when I click on submit I get the following error message: Warning: fopen(admin/data.dat): failed to open stream: No such file or directory in /home/mlkphoto/public_html/process.php on line 33 Warning: fwrite(): supplied argument is not a valid stream resource in /home/mlkphoto/public_html/process.php on line 37 Warning: Cannot modify header information - headers already sent by (output started at /home/mlkphoto/public_html/process.php:33) in /home/mlkphoto/public_html/process.php on line 39 What does this mean and how do I fix it? I do get the form information sent to my email so I know it's going through. I just can't get a "Thank you" page to come up and I get the error messages.
View Replies !
Process This Form
I want to have a form which has several rows for example: username1 firstname1 surname1 username2 firstname2 surname2 username3 firstname3 surname3 username4 firstname4 surname4 What I want to do is when this data is typed into the form to save it in a MYSQL db. The problem isn't with the saving, it's with the form itself. What is the best way to process this? I can't really name the various fields "username1" and "username2" because I would then need to replicate these as variables and this form generated could have an number of rows so hard coding the form field names with numbers makes it hard. Is there any way I can do this?? How have other people tackled this sort of thing in the past?
View Replies !
PHP Load Process
I've tried searching around for information on how PHP parses and renders itself. Basically, I'm writing a bunch of scripts that rely on a core file. The core itself is quite large (around 20k), but the scripts that reference it don't often utilise the entire contents of the core. Inside the core are functions that are never called *inside* the core, and a bunch of constants and globals that I call from the referencing scripts. So I guess in a nutshell, I want to know if when I call require, does PHP read the *entire* file? Or does it only read the bits it needs? I realise that last sentence makes me sound like I have trouble putting legos together, but I would just like to know how PHP goes about it duty.
View Replies !
Hanging Php Process
I am running a php site on a shared host environment. They have 20 max concurrent process limitation. Recently, I am having issue of some phpcgi process just hanging there and my site run out of process quota. the time limitation in php.ini is 180 seconds. However,those php just doesn't quit after 180 seconds, I check ps result. seems all those process just consume 0 seconds of CPU which explains why it didn't get termiated? It just didn't finish properly. what kind of things will cause process stay there? if I didn't close mysql connection,not free up result, will that cause it?
View Replies !
Image Process
I start learining php this week , and I am wondering if anybody knows if we can access to a picture's pixel using php.
View Replies !
Process A BIG String
i need to process every character in a file, so i open the file read in buffers of about 8192bytes and process each buffer, then i write the output to another file. the problem is that with large files(>8Mb) i get a script error(Fatal error: Maximum execution time of 30 seconds exceeded ). i acess every character in the buffer with $chr=ord($bufferIn{$i}); (where $i=0...8192) seems like all he time the script consumes is in the for loop and the chr/ord functions. can i do something to speed things up? is there any other way of acessing a single characher except $bufferIn{$i} ?
View Replies !
Mysql Process Cpu 106%?
Im in real trouble here I have a new social networking site similar to myspace, I just opened it to the public today and it has only around 80 users so far and with like 20 online i get this mysql process cpu 106%.
View Replies !
Background Process
I would like to create a script that acts like a background process. Basically once every hour, it will access a website, gather data from it, and write that data to a file on a remote server. The PHP code would be running on this same server. Is this type of non user activated, constantly running code possible?
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 !
In-process Display
Is there an easy way to do either of the following in php? display basic content while the php script is running through a extended loop, then when the loop completes, replace the basic content with final content; or have two pages, one with the basic content that checks with the longer running script and redirects to it when the latter is complete.
View Replies !
|