PHP - Script Is Timing Out On Server
Can someone propose a solution to resolve the following:
I have a PHP script that runs just fine when processing small amounts of data (opening and reading CSV file and performing afew validation checks before saving to db). Issue: when attempting to process a large file, I have found the execution time exceeds the "timeout" value currently set on the server which is 60 seconds. Note: I do not want to increase this time interval as that's a security risk so need to figure out a way to break up the data - being read from the CSV file - into chunks and some way create mini-processes (I guess) to execute chunks of that data at a time until the entire file is read. Any suggestions? Similar TutorialsI have a ptc site in php I want that all my ads will refresh at midnight in Pakistani time but server based in USA please let me know how it will happen I have a file name titulos.php and this is code please help me thanks. <tr> <td bgcolor="<?=$highlight?>"> <? require('config.php'); $sqle = "SELECT * FROM tb_ads WHERE user='$last' and ident='$id'"; $resulte = mysql_query($sqle); $myrow = mysql_fetch_array($resulte); mysql_close($con); $time=$myrow['visitime']; $crok1 = date(time()); $crok2 = date($time + (24 * 60 * 60)); if($crok1 >= $crok2) { ?><?=$bold?><a href="view.php?ad=<?=$id?>" target="_blank"><?=$description?></a><?=$boldc?><? } else { ?><del><?=$description?><del><? } ?> </td> <tD bgcolor="<?=$highlight?>"> <?=$members?> </td> <td bgcolor="<?=$highlight?>"> <?=$outside?> </td> <td bgcolor="<?=$highlight?>"> <?=$total?> </td> </tr> I'm trying to run 5 php scripts that all run about ~200 MySQL commands each. The basic framwork is: 1.) Fetch a list of names from a table 2.) Names are put in an array, Loop starts 3.) For each name that is retrieved, it is matched with a name on a website (Echo for each name retrieved for logging purposes) 4.) the information retrieved from the website is stored in the table (using UPDATE) 5.) repeated for each name, until the end of the list is reached. And it works, but seldom. When I run these in a web browser, some of the scripts that fetch a larger list of names from the table times out, whereas the shorter lists will succeed in a full update. I've also tried setting these up as a Cron job (I'm using Hosting24 as my host), but the output is no better. The log shows that it runs about 8-9 names before stopping. No error, no nothing. Just end of log. I've tried using set_time_limit(); and have set it to 0 for unlimited, and even tried setting it really high (anywhere between 100 and 900 seconds), but to no avail. Is there anything else I can do? #1 my function to find out if my store is closed function determineTime() { $hour = date("H"); if (($hour < '09' || $hour >= '21')) { return true; } else { return false; } } #2 my case switch to find out if the "trip" departs in less then <24 hours or <48 hours etc..... $myDiff = dateDiff(date("m/d/Y H:i:s"), "$dep_date 05:00:00"); list($myHour, $myMinute) = split(',', $myDiff); //echo $myHour.'<br/>'; //echo $myMinute; if(!isset($myHour)) $myHour = 0; $nowTime = date("H:i:s"); $futureTime = date("H:i:s", strtotime("$nowTime + 2 hours")); //echo '<h1>*'.$nowTime.'*</h1>'; //echo '<h1>*'.$futureTime.'*</h1>'; //$departures = $db->query("$dep_query $dep_where $dep_order"); // NO TIME RESTRICTIONS switch($myHour){ default: case "": break; case ($myHour <= 24): $_SESSION['addToTotal'] = $passengers*5; if(determineTime()){ //we are closed //if the store is closed and it is TODAY do not allow the users to book a trip before 9am $departures = $db->query("$dep_query $dep_where AND trips.times > '09:00:00' $dep_order"); //run query }else{ //we are open //if open allow the user to book, but only for trips that are for 2 HOURS out and GREATER $departures = $db->query("$dep_query $dep_where AND (trips.times > '$futureTime' OR trips.times > '09:00:00') $dep_order"); //run query } break; case ($myHour > 24 && $myHour < 48): $_SESSION['addToTotal'] = $passengers*5; $departures = $db->query("$dep_query $dep_where $dep_order"); //run query break; } All my times are in H:i:s format. Somewhere for some reason that when we are closed users can still book trips that are for 5am. I have a quick question about a script I wrote that searches all .jpg images in a directory (and it's sub-directories) and makes thumbnails of them. The problem I am having is that I am getting an internal server error after about 15 seconds. I have included my script, the class it requires, and my php.ini file that resides in the root of my site. I have searched for a couple of hours online and haven't been able to come up with an answer as to why I am getting that error. The thumbnail file... Code: [Select] <?php set_time_limit(0); require_once('classes/Create_Thumbnail.php'); $filter = '.jpg'; $directory = 'media'; // Do not include a trailing slash $it = new RecursiveDirectoryIterator("$directory"); foreach(new RecursiveIteratorIterator($it) as $file) { if (!((strpos(strtolower($file), $filter)) === false) || empty($filter)) { $items[] = preg_replace("#\\\#", "/", $file); } } foreach ($items as $item) { $photo = new Create_Thumbnail($item); $photo->createThumbnail(); } ?> The Create_Thumbnail class... Code: [Select] <?php class Create_Thumbnail { private $_photo; private $_photoBasename; private $_photoWidth; private $_photoHeight; private $_photoType; private $_resizedPhoto; private $_thumbFolder; private $_thumbWidth = 125; private $_thumbHeight = 125; private $_thumbSuffix = '_thumb'; private $_thumbnail; /** * Constructor retrieves photo's basename, extension, width, and height. */ public function __construct($photo) { $this->_photo = $photo; $this->_photoBasename = pathinfo($this->_photo, PATHINFO_FILENAME); $this->_extension = pathinfo($this->_photo, PATHINFO_EXTENSION); $this->_thumbFolder = dirname($photo) . '/'; list($this->_photoWidth, $this->_photoHeight, $this->_photoType) = getimagesize($this->_photo); } /** * Method to resize the original image to a size that is much closer to the desired thumbnail size. */ public function resize() { $photoRatio = $this->calculatePhotoRatio(); if ($photoRatio != 1) { $this->_resizedWidth = round($this->_photoWidth * $photoRatio); $this->_resizedHeight = round($this->_photoHeight * $photoRatio); } else { $this->_resizedWidth = $this->_thumbWidth; $this->_resizedHeight = $this->_thumbHeight; } $resource = $this->createResource($this->_photoType, $this->_photo); $resized = imagecreatetruecolor($this->_resizedWidth, $this->_resizedHeight); imagecopyresampled($resized, $resource, 0, 0, 0, 0, $this->_resizedWidth, $this->_resizedHeight, $this->_photoWidth, $this->_photoHeight); $this->_resizedPhoto = $this->_thumbFolder . $this->_photoBasename . '_resized.' . $this->_extension; $this->createNewImage($this->_photoType, $resized, $this->_resizedPhoto); imagedestroy($resource); imagedestroy($resized); return $this->_resizedPhoto; } /** * Method to create the thumbnail. */ public function createThumbnail() { $source = $this->resize(); list($width_original, $height_original, $type) = getimagesize($source); $base_name = pathinfo($source, PATHINFO_FILENAME); $base_name = str_replace('_resized', '', $base_name); $extension = pathinfo($source, PATHINFO_EXTENSION); $source_x = ($width_original / 2) - ($this->_thumbWidth / 2); $source_y = ($height_original / 2) - ($this->_thumbHeight / 2); $resource = $this->createResource($type, $source); $thumb = imagecreatetruecolor($this->_thumbWidth, $this->_thumbHeight); imagecopyresampled($thumb, $resource, 0, 0, $source_x, $source_y, $this->_thumbWidth, $this->_thumbHeight, $this->_thumbWidth, $this->_thumbHeight); $this->_thumbnail = $this->_thumbFolder . $base_name . $this->_thumbSuffix . '.' . $extension; $this->createNewImage($type, $thumb, $this->_thumbnail); unlink($source); return $this->_thumbnail; } /** * Method to create an image resource. */ public function createResource($type, $source) { switch ($type) { case 1: $resource = imagecreatefromgif($source); break; case 2: $resource = imagecreatefromjpeg($source); break; case 3: $resource = imagecreatefrompng($source); break; } return $resource; } /** * Method to calculate the photo ratio. */ public function calculatePhotoRatio() { if ($this->_photoWidth > $this->_photoHeight) { $maximumHeight = $this->_thumbHeight; $photoRatio = $maximumHeight / $this->_photoHeight; } elseif ($this->_photoWidth < $this->_photoHeight) { $maximumWidth = $this->_thumbWidth; $photoRatio = $maximumWidth / $this->_photoWidth; } else { $photoRatio = 1; } return $photoRatio; } /** * Method to create a new image. */ public function createNewImage($type, $source, $destination) { switch ($type) { case 1: if (function_exists('imagegif')) { imagegif($source, $destination); } else { imagejpeg($source, $destination, 50); } break; case 2: imagejpeg($source, $destination, 100); break; case 3: imagepng($source, $destination); break; } } } The php.ini file... Code: [Select] file_uploads on upload_max_filesize = 150M post_max_size = 150M max_input_time = -1 max_execution_time = 0 memory_limit = 150M register_argc_argv = false Hi guys , my script works perfectly in Gmail however i now need it to work in Outlook , when the form is submitted i get this error.
2014-10-25 18:49:00 SMTP ERROR: Failed to connect to server: Connection timed out (110) 2014-10-25 18:49:00 SMTP connect() failed. Mailer Error: SMTP connect() failed.
<?php require("../lib/phpmailer/PHPMailerAutoload.php"); if(empty($_POST['name']) || empty($_POST['email']) || empty($_POST['phone']) || empty($_POST['message']) || !filter_var($_POST['email'],FILTER_VALIDATE_EMAIL)) { echo "No arguments Provided!"; return false; } $m = new PHPMailer(); $m->IsSMTP(); $m->SMTPAuth = true; $m->SMTPDebug = 2; $m->Host = "smtp.live.com"; $m->Username = "test@outlook.com"; $m->Password = "pass"; $m->SMTPSecure = 'tls'; $m->Port = 465; // ive also tried 587 $m->From = "test@outlook.com"; $m->FromName = "test@outlook.com"; $m->addReplyTo('test@outlook.com ','Reply Address'); $m->addAddress('test@outlook.com', 'Some Guy'); $name = $_POST['name']; $email_address = $_POST['email']; $phone = $_POST['phone']; $message = $_POST['message']; $m->Subject = $subject; $m->Body = "You have received a new message. <br><br>". " Here are the details:<br> Name: $name <br> Phone Number: $phone <br>". "Email: $email_address<br> Message <br> $message"; $m->AltBody = "You have received a new message. <br><br>". " Here are the details:<br> Name: $name <br> Phone Number: $phone <br>". "Email: $email_address<br> Message <br> $message"; if(!$m->Send()) { echo "Mailer Error: " . $m->ErrorInfo; } else { echo "Message sent!"; return true; } ?> This is mind bender. I recently upgraded from a VPS to a Dedicated server. The script is a data mining tool that primarily uses cURL. It worked flawlessy on the the VPS. Because it was the same hosting company everything was migrated and done so smoothly to the new dedicated. Now, the program hangs for no reason at all. The times vary but I'll usually get about an hour of the script before it hangs. It used to run for hours at a time on the VPS. While I do see some 'notices' and cURL timeouts - there are no error messages echoed out when the program hangs and there is nothing within the error log on the server to indicate anything in terms of why. The program simply 'freezes'. I think I've spent the last three days modifying the php.ini file. Here are some settings which may be of interest? post_max_size = 16M log_errors = On max_execution_time = 0; (From what I understand is unlimited). max_input_time = 0 ; memory_limit = 128M; At the top of every page within my script: set_time_limit(0); error_reporting(E_ALL); The dedicated is an 8 gig Linux box running Apache. Speaking of which, here are some settings within WHM for Apache: Max Clients 500 Max Requests Per Child - 0 (unlimited) Keep-Alive - On Keep-Alive Timeout - 50 Max Keep-Alive Requests - Unlimited Timeout - 1000 Because the script works on another VPS that I have within the same hosting company can someone direct me with what I should be looking for and/or comparing between both servers? What are the most common reasons for a PHP script to freeze from a server setting standpoint? Hello, I made a server statuc checking script that checks the status of a game server. It works fine on my computer, but when I upload it to my web host it stops working. I'm assuming my web host is blocking it in some way. My host is Yahoo Small Businesses. Does anyone know if they block this kind of thing, or if there is a way to unblock it? Perhaps editing the code? Here is my code, if that helps. Code: [Select] <?php function GetServerStatus($site, $port) { $status = array("OFFLINE", "ONLINE"); $fp = @fsockopen($site, $port, $errno, $errstr, 2); if(!$fp) { return $status[0]; } else { return $status[1]; } } $Redemption = GetServerStatus("174.142.118.233", 11661); $RedemptionPossible = GetServerStatus("174.142.118.234", 51665); $Tranquility = GetServerStatus("174.142.118.234", 11601); $TranquilityPossible = GetServerStatus("174.142.118.234", 51665); $Nemesis = GetServerStatus("174.142.118.241", 11601); $NemesisPossible = GetServerStatus("174.142.118.241", 64721); $OverallServer = GetServerStatus("174.142.118.237", 11093); $CodServer = GetServerStatus("8.9.6.122", 4230); echo($CodServer . "<br />"); echo("Overall Server: " . $OverallServer . "<br />"); echo("Redemption: " . $Redemption . "<br />"); echo("Tranquility: " . $Tranquility . "<br />"); echo("Nemesis: " . $Nemesis . "<br />"); ?> Hi all! Yet again I have a problem. I really couldn't find what the heck's wrong with this thing. It's extremely simple and still... I'm trying to put a php script in my website to monitor the status of my FTP and HFS servers. Help? <TITLE>Server Status</TITLE> <?php $data .= " </div> <center> <div style=\"border-bottom:1px #999999 solid;width:480;\"><b> <font size='1' color='#3896CC'>Server Status</font></b> </div> </center> <br>"; //configure script $timeout = "1"; //set service checks $port[1] = "80"; $service[1] = "Apache"; $ip[1] = "localhost"; $icon[1] = "habbo.jpg"; $alt[1] = "Apache"; $port[2] = "8080"; $service[2] = "HFS Server"; $ip[2] = "localhost"; $icon[2] = "web.png"; $alt[2] = "HFS Server"; $port[3] = "21"; $service[3] = "FTP Server"; $ip[3] = "localhost"; $icon[3] = "web.png"; $alt[3] = "FTP Server"; // // NO NEED TO EDIT BEYOND HERE // UNLESS YOU WISH TO CHANGE STYLE OF RESULTS // //count arrays $ports = count($port); $ports = $ports + 1; $count = 1; //beggin table for status $data .= "<table width='480' border='1' cellspacing='0' cellpadding='3' style='border-collapse:none' bordercolor='#CCCCCC' align='center'>"; while($count < $ports){ if($ip[$count]==""){ $ip[$count] = "localhost"; } $fp = @fsockopen("$ip[$count]", $port[$count], $errno, $errstr, $timeout); if (!$fp) { $data .= "<tr><td width='18' align='center'><img src='http://127.0.0.1/stat/$icon[$count]' title='$alt[$count]' alt='$alt[$count]'></td><td>$service[$count]</td><td width='18' align='center'><img src='http://127.0.0.1/stat/off.png'></td></tr>"; } else { $data .= "<tr><td width='18' align='center'><img src='http://127.0.0.1/stat/$icon[$count]' title='$alt[$count]' alt='$alt[$count]'></td><td>$service[$count]</td><td width='18' align='center'><img src='http://127.0.0.1/stat/on.png'></td></tr>"; fclose($fp); } $count++; } //close table $data .= "</table><div>"; echo $data; ?> The output of this is... Quote Parse error: syntax error, unexpected T_VARIABLE in D:\Program Files\xampp\xampp\htdocs\stat\server.php on line 18 Also, does somebody have a link or something to a tutorial/pre-made script (although I'd like to follow instructions about it) about server statistics? I want to have data on how much a certain partition on the server has free or full. Thank you in advance. Is there any php function I can test how fast my server is performing, like how fast its carrying out a certain action so I can see its resource usage. I'm trying to show the progress of executing a python script in PHP with a progress bar. I found a link (https://www.htmlgoodies.com/beyond/php/show-progress-report-for-long-running-php-scripts.html) that uses SSE to send progress updates to the client. In the original code, a loop is used to simulate a long script but in my case I'm trying to execute a python script that takes roughly 50 seconds. index.php
<!DOCTYPE html> process.php
<?php
function send_message($id, $message, $progress) {
echo "id: $id" . PHP_EOL;
ob_flush();
send_message('CLOSE', 'Process complete'); Problem: As you can see in process.php I commented the original code and placed a simple python execution in php. I just want to diplay the progress of the script but it is not doing so. What do I have to do to show the progress of the script? Note: I don't think is relavent but the python script just opens up a batch file. Are there other methods to display the progress bar of a script in php? I am moving my website to a new Service Provider. The script I use for multiple updating worked on the older server but not on the new one. It shows the information but does not update the records. Any help would be greatly appreciated. Old Server : PHP 5.2.11 MYSQL: 5.0.92-community New Server : PHP 5.2.17 MYSQL: 5.1.47-community Script: <?php include("head.php"); $host="localhost"; // Host name $username="xxxxxxx"; // Mysql username $password="xxxxxxx"; // Mysql password $db_name="xxxxxxx"; // Database name $tbl_name="xxxxxxx"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $sql="SELECT * FROM $tbl_name limit 20"; $result=mysql_query($sql); // Count table rows $count=mysql_num_rows($result); ?> <title>PowerMan South Africa</title> <META HTTP-EQUIV="Pragma" CONTENT="no-cache"> <META HTTP-EQUIV="Expires" CONTENT="-1"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" href="style.css" type="text/css" media="screen" /> <style type="text/css" media="screen,projection"> @import url(calendar.css); </style> </head> <table width="500" border="0" cellspacing="1" cellpadding="0"> <form name="form1" method="post" action=""> <tr> <td> <table width="500" border="0" cellspacing="1" cellpadding="0"> <tr> <td align="center"><strong>ID</strong></td> <td align="center"><strong>Company</strong></td> <td align="center"><strong>contact</strong></td> <td align="center"><strong>Email</strong></td> <td align="center"><strong>Telephone</strong></td> <td align="center"><strong>Type</strong></td> </tr> <?php while($rows=mysql_fetch_array($result)){ ?> <tr> <td align="center"><? $id[]=$rows['id']; ?><? echo $rows['id']; ?></td> <td align="center"><input name="company[]" type="text" id="company" value="<? echo $rows['company']; ?>"></td> <td align="center"><input name="contact[]" type="text" id="contact" value="<? echo $rows['contact']; ?>"></td> <td align="center"><input name="email[]" type="text" id="email" value="<? echo $rows['email']; ?>"></td> <td align="center"><input name="telephone[]" type="text" id="telephone" value="<? echo $rows['telephone']; ?>"></td> <td align="center"><input name="type[]" type="text" id="type" value="<? echo $rows['type']; ?>"></td> </tr> <?php } ?> <tr> <td colspan="4" align="center"><input type="submit" name="Submit" value="Submit"></td> </tr> </table> </td> </tr> </form> </table> <?php // Check if button name "Submit" is active, do this if($Submit){ for($i=0;$i<$count;$i++){ $sql1="UPDATE $tbl_name SET company='$company[$i]', contact='$contact[$i]', email='$email[$i]',type='$type[$i]', telephone='$telephone[$i]' WHERE id='$id[$i]'"; $result1=mysql_query($sql1); } } if($result1){ header("location:update_multiple.php"); echo "<meta http-equiv=Refresh content=0;url=update_multiple.php>"; } mysql_close(); ?> I've been looking for a simple script that would connect to a game server to see if it is still online. I've found many, but not one of them work. They will permanently send back the text "Online", or "Offline". This is the simplest code I have found: <?php $ip = "66.79.190.40"; $port = "27960"; if (! $sock = @fsockopen($ip, $port, $num, $error, 5)) echo '<B><FONT COLOR=red>Offline</b></FONT>'; else{ echo '<B><FONT COLOR=lime>Online</b></FONT>'; fclose($sock); } ?> I'm also looking into getting it to pull the map name and player-list, but I should be able to figure that out on my own once I get this working. If it helps, this script is supposed to connect to the original Quake games(One, two, and three). I have written a small script for my own personal use that checks the servers of my favorite sites to see if they are operational. I'm having trouble getting it to work, I have most of it (I think) and I'm very new to PHP. The script also allows for a form to add any sites to the file, which I think I explode into an array correctly, at a later time. Here's my code, Please Help! <html> <head> <title>project.php</title> </head> <body> <?php $filename = "websites.txt"; $file = file_get_contents($filename); // reads entire file into a string $DomainNames = explode("\n", $file); // split the string at new line characters, returns an array $length = count($DomainNames) - 1; // count is the correct way to get the length of an array $i=0; while($i<=$length){ $fp = @fsockopen ($DomainNames[$i], 80, $errno, $errstr, 10); if (!$fp) echo "$DomainNames[$i] : <font color='red'>Failed!</font>"; else { echo "$DomainNames[$i] : <font color='green'>Online!</font>"; echo "<br>"; $i++; } } if (isset($_POST['submit'])) { $DomainNames[] = $_POST['url']; // append url to array $file = implode("\n", $DomainNames); // convert array to string, delimiting by new lines file_put_contents($filename, $file); // save contents to file } ?> <form action="project.php" method="post"> <fieldset> <label for="url">Url: </label> <input type="text" name="url" id="url" /> <input type="submit" name="submit" id="submit" value="Add URL" /> </fieldset> </form> </body> </html> I am trying to develop a browser interface for an embedded system. The code written so far consists of one HTML page and one PHP script. The HTML page creates a form containing a select widget and a submit button. When the submit button is pressed, the selected item is posted to the PHP script for processing. The PHP script does a MySQL query using the form data and generates HTML to display the query result in a table, which displays in a new Web page. All of this works fine. However... I need to change the HTML page to create the select widget choices using a the result of a query run when the HTML page gets displayed. I created a PHP script to do this, and included it in my HTML page in this manner: Code: [Select] <form action="procSomeForm.php" method="post"> <?php include "genSelectList.php"; ?> <input class="main" type="submit" name="submit[view]" value="View" style="width:70px"/> </form> When I tried this, the select didn't appear. I tried moving the <select> </select> out of the PHP script and placing them around the "include". The select now displayed but with no contents. After many failed attempts to resolve any errors in the script, I began to suspect that the browser was ignoring the include directive. I then reduced the problem to this trivial code: Code: [Select] <html> <head> <title>PHP Test</title> </head> <body> <?php include "tmp.php"; echo "<p>This message brought to you by PHP!</p>"; ?> </body> </html> The PHP script looks like this: Code: [Select] <?php echo "<p>Hello from tmp.php!</p>"; ?> My Web browser rendered the result as: Code: [Select] This message brought to you by PHP! ";?> The "hello" message in tmp.php wasn't displayed, and the the browser printed the last few characters of the embedded PHP statement as if they were simple text! I have tried this same experiment on two PCs with the same result. My development PC runs Debian 6.0 (Squeeze) in VMWare on top of WinXP; I access the Web pages locally from within VMWare using IceWeasel. My embedded PC also runs Debian 6.0; I access the Web pages from my WinXP box using Firefox. Interestingly, when I use IE8 to call up the trivial page from the embedded PC, it displays a blank page! Sorry for the long-winded setup to the problem, but I wanted to point out that generating a separate HTML page from a PHP script works; it appears that the issue is with putting PHP statements in an HTML page. Any help will be greatly appreciated - thanks in advance! Chris Hi guys, I'm trying to create a script which changes on curtain times, heres a example: 3pm - Dance Session 4pm - Indie Session 5pm - RnB Session What i want the desired outcome to be is Display current time with whats playing (say its 3pm) 3pm - Dance Session Then at 4 i want it to remove the 3pm and display the 4pm - Indie Session Is it possible? If so how? Many thanks for you time guys! J Hi guys, Basically I am developing a page where the order status of customers are listed in a tabular form, what I need now is to mail these data to my email address at a defined date (e.g. 1st day of next month) automatically. I do not know how to code this since I am just self studying and is still a noob. Thanks. Hi, I have a mail script to that will take a long time to process, let me call it form2.php Now I post from form1.php to form2.php. I like to run/execute the form2.php in the background so that the user will not wait for the time executing the form2.php. I have used exec and shell_exec but not success. I am using latest WAMP server in my local mechine. Thanks Folks, I am running Linux Commands in PHP. I am looping through the Domain list and using the below line in my Script: exec('cp -r '.$source.' '.$destination); I am using this in a Foreach Statment, so only the last Even in the loop getting executed, because, the loop is running too fast so the Linux command does not even get initiated, only the last even in loop goes through. What i have done is, i have added a line after exec(); sleep(30); This gives enough time for Linux command to get executed, but is it efficient way to handle timing liek this? Do i need to use time_limit() or something like that? Cheers Natasha |