Jump to content

How to execute the file completely ??


d.shankar

Recommended Posts

Hi phpfreaks !

 

This thread may sound a bit crazy but plz to try to help me if you people can.

 

 

Consider i have a website(www.test.com) and i have a big file with lot of operations in a file called test.php

 

plz assume the file has some 2000 lines of code and at the end of the line there is a  insert table operation to make sure that the file has reached the end and all the operatiions above have completed, i.e to make sure if the page was accessed.

 

When a user requests the file from the browser say www.test.com/test.php , the file runs for some 10 seconds to complete the operation.

 

Killer Situation:

So when a user closes the window within 10 seconds , the operations won't get completed , the insert operation does not perform too.

 

 

 

My request is that when the user closes the window within 10 secs, is it possible to make the file run in the server background so that it gets executed fully or are there any means to perform this ???

 

Please let me know if this sounds weird !!!

Link to comment
https://forums.phpfreaks.com/topic/159725-how-to-execute-the-file-completely/
Share on other sites

I tried like this

 

<?php
ini_set("ignore_user_abort", 1);


sleep(20);



		$to		=	"[email protected]";

		$from = '[email protected]';

		$subjectx = "testing";

		$body="Mail sent";		

		$headers  = 'MIME-Version: 1.0' . "\r\n";

		$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

		$headers .= $from ."\r\n";



		mail($to,$subjectx,$body,$headers);

?>

 

 

wheni run this file for 20 seconds.. i get the mail.

 

I called this file and immediately closed my browser in 2 seconds but i didnt get the mail :(

 

any suggestions ??

 

 

 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.