You are here: Re: Have a few php script questions « All PHP « IT news, forums, messages
Re: Have a few php script questions

Posted by J.O. Aho on 11/24/05 14:36

Julie wrote:
> I have a very large php script that processes a database.
> The script works at times, but then other times in IE, it will say "website
> found, waiting for reply"
> then say "done", then show the error page.
> 1. What is causing this? It seems when I clear out my cache, it may work.
> The script takes about 2.5 minutes to run and is it because for some reason,
> IE doesnt want to wait and is refreshing the page?

Browser timeout, the browser will not stay and wait for a page without any
output for ever. If you have a script that does a lot of background job, you
need to make it to output something once in a while so that the browser won't
think that the server timed out and break the loading, which leads to that the
execution of the php script is terminated.


> 2. How can I set this script to run on the server with a cron job. It needs
> to launch this php script, and then close it.
> I am on an apache server

You need to modify the /etc/crontab on the machine that you have the php
script on, for details how to set up a correct crontab line, you should read
the man page (man crontab)

You need to make the php script to be executive, you will need to tell the
script where to find the php binary, eg:

#!/usr/bin/php


--- example script ---
#!/usr/bin/php
<?PHP
echo date('Y-m-d');
?>
--- end of file ---

When you have your script, you have to set the executive bit on

chmod 755 /path/to/the/script.php

This makes it's read/write/exec byy the owner, read/exec by the group and
read/exec by everyone else.


//Aho

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация