Re: Try to find a solution, when restart Apache with PHP Script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello James,
in future we will implement the script with cron, i've already talk to the support server guys... and i think this would be the best pratice... But for now i was wondering if there's a workaround... because in the moment my boss tell me to not change anything that could delay the software more than 1 or 2 days...

So i'm looking for a dirty solution for now...

thanks

James Ausmus escreveu:
On 9/17/07, Rodolfo De Nadai <rodolfo.denadai@xxxxxxxxxxxxx> wrote:
Hi all...

I'm facing a serious problem with my application. I have a script write
in PHP that starts in Internet Explorer, this script keep on running
until a varible value change on my MySQL database.
The problem is that when i restart Apache, the process child initalized
isn't kill... then the apache can't be start because the script is use
the port 80.

Hi Rodolfo-

I think you are going about this the wrong way. You shoud not have the
PHP script itself execute the forever running task, it should just
trigger the separate starting/stopping of the task. There are several
ways to do this, the first two that spring to mind are:

1. Create a custom init-script in /etc/init.d (or wherever your
distribution has init scripts) that the PHP process triggers with a
start command (/etc/init.d/myprog start). This will require root
privileges for the PHP process (or no-password sudo privileges for
that command).

--or--

2. Have a cron job running as a user that has appropriate permissions.
This cron job should look for the presence of specific files - if it
sees them, it takes the appropriate action, and then deletes the
trigger file. For example, have the cron job watch for the presence of
/tmp/startMyProg.marker - when it sees it, it starts the program and
deletes /tmp/startMyProg.marker. Also have it watch for the presence
of /tmp/stopMyProg.marker, when it sees that, it would stop the
running program, and delete the marker file. At this point, all your
PHP script has to do is create the appropriate file in /tmp (could be
as simple as a exec("touch /tmp/startMyProg.marker") call).

Hope that sends you a workable direction-

James



--
* Rodolfo De Nadai *
* Analista de Sistema Jr. - Desenvolvimento *

	

	
	*Informática de Municípios Associados S.A.*
Seu governo mais inteligente
rodolfo.denadai@xxxxxxxxxxxxx <mailto:rodolfo.denadai@xxxxxxxxxxxxx> - www.ima.sp.gov.br <http://www.ima.sp.gov.br/> Fone: (19) 3739-6000 / Ramal: 1307
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux