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 Complete Forum Thread with Replies
Related Forum Messages:
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 !
Kill A Process
I run an Internet TV station, and im using a piece of software on the server to stream content to the shoutcast server. This all works fine. But what is getting at me is the fact that if i want to kill the process so i can broadcast from my local machine i have to log in via ssh and kill them manually. I already know the php commands to kill a process and also to list the running processes, but i was wondering if it was possible to get the php code to store the PID of the program upon starting so that when the "kill" button is pressed, it reads the string from the database/text file etc. and kills that process only.
View Replies !
Running An .exe File Using Exec() Or System(), Unable To Fork Error
I have a problem with running an .exe file using exec() or system() I have downloaded a file called ffmpeg.exe for converting movie clips. I can use the program thourg the command line in windows (cmd), but I'm not able to have PHP run the file. First PHP gave be an "unable to fork" error. But then I gave users access to the cmd.exe file and solved that problem. So now is no problem running for example exec("dir");
View Replies !
How To Kill Process Started By User?
Let us suppose that PHP file contains cycle which will never stop. For example: while ( 2==2 ) { some usage of database; } User which opens this PHP page runs time consuming execution of the cycle. My question is whether this execution will be automatically stopped after user closes the PHP file (or closes his browser). I suppose that answer is "No", since PHP is server-side application. How than I can find such processes and kill them by hands?
View Replies !
Exec Background Process
I want have PHP call another process (another PHP script at the moment but it may end up being a binary) in the background and not wait for process to complete, but rather instantly jump the the next line of code. I've tried things like: exec("./script.php &"); // script.php has executable permissions set exec("at -f ./script.php now"); // and #!/usr/bin/php at the top of the code Neither seem to work. They both execute script.php, but both hang around until script.php has completed.
View Replies !
XP Exec Background Process
I was trying to exec a background process on XP using PHP CLI, but could not get it to work. Suppose the command I want to spawn off is "cmd". On *nix, it is as easy as putting ampersand "&" at the end of the command. I tried the following on XP without working. exec("cmd"); exec("cmd >NUL"); exec("cmd /c cmd"); exec("start /b cmd"); I tried many combination, but on each one, PHP waits for cmd to exit before continuing. Doing this in Windows script host (cscript) is simple: Set objShell = CreateObject("WScript.Shell") objShell.Run "cmd", 0, False The "False" parameter causes the Run method to continue immediately without waiting for the command to finish. So I could make my PHP file exec a VBS file that does the actual background execution of my command. PHP exec documentation says it will not wait if output of the command is redirected somewhere, but this didn't seem to work for me. If anyone has experience in doing something like this on Windows XP SP2,
View Replies !
Security In An Process Started With Exec
The php script that processes user input from a form, starts a new process using exec. In my case, the process may contain arbitrary, user defined functionality. How do I ensure that that process doesn't do any harm? Is there a way to define a sort of sandbox that the process can run in, so it won't be able to access any unauthorized resources, or do some other damage to the server? I am running PHP 5.1.2 on Apache 2, on Win XP Pro. Thanks, A
View Replies !
EXEC() Runs Process In Background
Exec, shell_exec, system, popen functions all run the process in the background. how can i get it to run the process normally. my code looks like this: <? exec("batch_file.bat"); ?> am i doing anything wrong?
View Replies !
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 !
Exec() Not Running
I just installed ImageMagick on my development machine (OS X 10.4.7, Apache 1.3, PHP 4). I am trying to use exec() to call it. I have created a command via PHP: PHP Code: $cmd = "/usr/local/ImageMagick-6.3.0/bin/convert /Library/WebServer/Documents/one.jpg -resize 250x /Library/WebServer/Documents/photos/two.jpg" exec($cmd, $output, $retVal); I know ImageMagick is correctly installed because when I run the command via the console, it works perfectly. The "photos" directory is chmod'ed to 777. The paths are correct. I have tested a simple "ls -l ." as the command, that outputs everything just fine. Is there somehing I'm not doing right? Someting I need to disable or enable? I've gotten this exact code to work on a different server (GoDaddy of all places) so I'm quite certain it's not the code itself.
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 !
CGIWrap Error: Exec Format Error
This message usually indicates there is a problem with the script itself. Often this indicates either that the #! line of the script is incorrect, or the script was uploaded in binary mode instead of ascii mode. Check to make sure that the script does not have control-M's at the end of every line. That will prevent it from executing. An easy fix that takes care of this most of the time is to put '#!/.../perl --' instead of '#!/.../perl' on the first line of the script. This is typically a problem if the script was edited or uploaded from a DOS/Windows/Macintosh station to a unix based server. If you are not the owner of this script, please forward this error and the URL that caused it to the script owner. That is often the component in the URL right after /cgiwrap/. does anybody know what does this message means?
View Replies !
Php Exec Error
i cannot execute the exec command and pass varaible through it exec('/secure/sed_repl.sh "route add -host $obj->host device $device2" "" '); I have to execute it this way ... exec('/secure/sed_repl.sh "this one" "this one to" ');
View Replies !
Exception Handling - Standardise Error Reporting Process
I work on a site with a large code base, for which which have our own error handling classes. We've decided to start using php5's exception handling mechanisms but as i look into it, i wonder when this is the right thing to do. We want to use it to standardise our error reporting process, and to make sure failed bd queries are logged. As i've started though i've realised... If i throw an exception in the DB class, and make the code using the class responsible for trying and catching, it means we'll have to go through the whole of our site adding try/catch blocks wherever we try and access the db. If we miss one, and at some point throw an exception, we'll get a fatal error which is the worst scenario. Alternatively we could make the DB class responsible for handling the whole situation as follows. Code:
View Replies !
Using Exec Function To Get A .exe Return Status Gives CGI Error
I'm trying to make a web page to work. It worked before so it has to be something related with the configuration. My problem is a call to a compiled executable (made for me) that returns 1 or 0. It does not print any text to the standard ouput so the error is strange: CGI Error: The script can .. because of the HTTP headers (I have it in spanish so the message is not the exact one). As supposed, the HTTP headers are needed only if the executable prints out a text to the browser but it's not the case. And (I repeat) It worked as it before. The machine had to be formatted and the guy in charge of that is not with me anymore.
View Replies !
Warning: Ftp_exec() [function.ftp-exec]: SITE EXEC Is An Unknown Extension
This is kind of a part II to a question a posted earlier about exec and shell_exec not working. I'm trying to use ftp_exec to execute some simple command: $conn_id = ftp_connect("$server") or die ("Cannot initiate connection to host"); ftp_login($conn_id, "$username", "$userpass") or die("Cannot login"); $command = 'cd..' if (ftp_exec($conn_id, $command)) { echo "$command executed successfully"; } else { echo "could not execute $command"; } ftp_close($conn_id); I'm getting the following error: Warning: ftp_exec() [function.ftp-exec]: SITE EXEC is an unknown extension in /home/urieilam/public_html/work/video/test1.1.php on line 21 could not execute cd.. Have tried other commands as well, get the same. Could this be a security issue or something to do with p Safe Mode? I don't know much about commands, shell, etc..
View Replies !
PHP Kill Cron
How can i kill a cron process at the begining of my cron task (php script): My cron task starts evry 5 minutes, but may work more than this time. (no timeout configured on my server for cron tasks (?). I guess if i can stop every process of this task before starting it again. my task looks like:...
View Replies !
How To Kill Cookie
I am trying to limit that a visitor can enter out.php by relative link only. It's fine if I do it at the first time. However, a visitor can enter out.php by absolute link when he entered once by relative link. in.php3 PHP Code:
View Replies !
Kill Cookie
I set the cookie wrongly i think using the time() function, and it works fine on the same day to kill it, but after one day, i want to kill it, and it's still exist? even i kill the cookie file and it's still there here's i find the cookie store in: c:/windows/cookies and c:/windows/temp internet files/ am I use wrongly? with the expression: setcookie("cookie","value",time()+31536000) // for 1 year value i try to delete it: setcookie("cookie","", time()- 31536000) please suggest me how to kill it, i am really sick of it, it's still in my computer..but what's the properly way to set it up and delete it, thanks, i am using php3. It's so strange that the cookie is only in IE, not netscape.
View Replies !
Kill Connection?
how I can make php instantly close and not even send a response header so that a browser trying to connect will get error saying cannot connect to server?
View Replies !
Kill Session
Is there a set way to kill the session (like when a user logs out) or do you just Quoteset session = '' ;
View Replies !
To Kill A Function
I have a cron job I amm writing that includes recursively several similar php scripts to parse xml. The problem I am having is that all the scripts have identically named functions. how can I kill the functions after each include?
View Replies !
Timed Session Kill
I would like to have My $_SESSION variable destroyed after a certain amount of time. Is there a way that I can have a timeout function or something that after 10 minutes it will destroy this variable?
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 !
PEAR::DB Kill The Script Or Crashes PHP ?
I've a strange problem using PEAR::DB (even with the latest version). Our PHP version is 4.3.4. The above line stop the PHP script execution or crashes PHP (I don't know exactly) when the script is runned throught the browser (so, via Apache) : $db = DB::connect(DATASOURCE); I don't have any error message, any traces in the Apache error_log... The page is WHITE... :-/ But, if use the linux console to cat the php script to apache (cat script.php | php) the script is running very well... If I use the native PHP PostgreSQL functions pg_*, everything runs perfectly (in console or via the browser) Do you have any idea to solve that problem (except from removing all the PEAR modules from our application) ? PS : We are currently removing ALL the PEAR modules from our application, but since the application is large this will take a while to do.
View Replies !
Completely Kill A Session When A User Logs Off.
Default installation of Apache 2.0 and PHP 4 on a Fedora Core 4 server. I'm trying to completely kill a session when a user logs off. I use the following code (found on php.net) in my logout script, then redirect the user to the login page. Code:
View Replies !
Warning: Exec() [function.exec]:
I'm using PHP Version 5.0.4 in IIS5, Window 2003. When I execute my script, it prompt me the following error : Warning: exec() [function.exec]: Unable to fork [ping 10.8.1.70] in c:Inetpubwwwrootswitch.php on line 62 Below is my script : <?php $line1 = exec("ping 10.8.1.70", $output); exit; ?>
View Replies !
2>&1 Arg In Exec(perl.... + "sh: /perl Not Found Error" TIA For Help
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 when run from the unix command line returns the following error: sh: /perl: No such file or directory I've verified that perl is located in /usr/bin/ /usr/bin is in the environment variable "PATH" all the directories from php program to the root and back down to usr/bin have 755 permissions. if I run the program (insert.pl) from the command line it works I've tried putting the following in both the php and perl programs: #!/usr/bin/perl #!/usr/bin
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 !
|