Re: [PHP] php 5 upgrade and background script on unix

2007-04-03 Thread Jochem Maas
Frederic Belleudy wrote:
 Jochem:
 won't it? what does it do? does it go into and endless loop and bring
 your machine to a halt
 by any chance? .. because by looking at it, as long as $in['bg'] is not
 set and not equal to
 true it's going to keep spawning sub-shells with cmdlines that call itself.
 
 Me:
 You haven't read my message? 

yes I did.

 It works fine when Im running it from the
 shell

the question was referring to what happens when running the exec() line
via the apache php module, I had thought that that was obvious.

 
 When I do:
 
 `/usr/local/bin/php /www/admin.gammacash.com/test/test_fork.php bg=1
 21 /var/log/test.log `
 you can see bg=1
 
 its the passing arguments!
 any other suggestions?

fix/debug it yourself.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] php 5 upgrade and background script on unix

2007-04-02 Thread Frederic Belleudy
Hello there, I hope someone resolved the same issue. I upgraded my 
server to 5.2.1
I got some script that are running background script (generally we call 
this technic FORKING)
Ive got a web interface that running (depending the action chosen) other 
scripts in the background.

My issue is, it doesn't work anymore since my new upgrade.
So I'm using this line to run my background script from the web browser 
interface:

/usr/local/bin/php test.php 21 error.log

if Im executing my script from the shell, my fork is working very fine! 
(Odd isn't it)

I taught it could be owner and rights problems but it's not the case...

Anyone got suggestions??

--
Frederic Belleudy
Programmer
PWIdeas
ICQ #: 253-372-030 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php 5 upgrade and background script on unix

2007-04-02 Thread Jochem Maas
Frederic Belleudy wrote:
 Hello there, I hope someone resolved the same issue. I upgraded my
 server to 5.2.1
 I got some script that are running background script (generally we call
 this technic FORKING)
 Ive got a web interface that running (depending the action chosen) other
 scripts in the background.
 My issue is, it doesn't work anymore since my new upgrade.
 So I'm using this line to run my background script from the web browser
 interface:
 /usr/local/bin/php test.php 21 error.log

and the [php] code that does the fork is what exactly??

 
 if Im executing my script from the shell, my fork is working very fine!
 (Odd isn't it)
 I taught it could be owner and rights problems but it's not the case...
 
 Anyone got suggestions??

don't fork webserver processes, granted it doesn't fix the problem, but you 
really
should be doing it anyway.

I'm guessing that the pcntl extension is not compiled into the webserver php 
SAPI,
it's a really big guess because you didn't supply the code you use to do the 
forking with.

 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php 5 upgrade and background script on unix

2007-04-02 Thread Frederic Belleudy



don't fork webserver processes, granted it doesn't fix the problem, but you 
really
should be doing it anyway.

I'm guessing that the pcntl extension is not compiled into the webserver php 
SAPI,
it's a really big guess because you didn't supply the code you use to do the 
forking with.

  

Ok then you want to have the fork code!
I'm doing a complete example


My script is forking on itself.
So from my browser I go on:
http://localhost/test_fork.php

My code in test_fork.php is :

?
$in = get_shell_args($_SERVER['argv']); // DONT PAY ATTENTION TO THAT 
FUNCTION, it a made home function


if($in['bg']) {
   print HERE;  
   sleep(30);

}
else {
   print forking;
   `/usr/local/bin/php /www/admin.gammacash.com/test/test_fork.php bg=1 
21 /var/log/test.log `

}
?

So Im assuming that the fork will get the bg argument, in this case I 
should receive HERE in /var/log/test.log (did tail -f 
/var/log/test.log while I was running the script)

I've put a sleep 30 seconds to get the fork PID number.

Unfortunately, when I do execute test_fork.php from the web, it wont 
execute itself in background.

This method was running fine with my old config.

The script works perfectly because if Im executing test_fork.php from 
the shell, the fork is working fine!




__ NOD32 2162 (20070402) Information __

This message was checked by NOD32 antivirus system.
http://www.eset.com



  



--
Frederic Belleudy
Programmer
PWIdeas
ICQ #: 253-372-030 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php 5 upgrade and background script on unix

2007-04-02 Thread Jochem Maas
Frederic Belleudy wrote:
 
 don't fork webserver processes, granted it doesn't fix the problem,
 but you really
 should be doing it anyway.

 I'm guessing that the pcntl extension is not compiled into the
 webserver php SAPI,
 it's a really big guess because you didn't supply the code you use to
 do the forking with.

   
 Ok then you want to have the fork code!

'want' is putting it strongly - unless of course your handing out AudiRS4's
in which case 'want' is spot on.

 I'm doing a complete example
 
 
 My script is forking on itself.
 So from my browser I go on:
 http://localhost/test_fork.php
 
 My code in test_fork.php is :
 
 ?
 $in = get_shell_args($_SERVER['argv']); // DONT PAY ATTENTION TO THAT

does $_SERVER['argv'] exist at all? does your error reporting include E_NOTICE?
what is the value of the ini setting 'register_argc_argv'?

 FUNCTION, it a made home function
 
 if($in['bg']) {
print HERE; sleep(30);
 }
 else {
print forking;
`/usr/local/bin/php /www/admin.gammacash.com/test/test_fork.php bg=1
 21 /var/log/test.log `
 }
 ?
 
 So Im assuming that the fork will get the bg argument, in this case I
 should receive HERE in /var/log/test.log (did tail -f
 /var/log/test.log while I was running the script)
 I've put a sleep 30 seconds to get the fork PID number.

no idea how the sleep() will help.

 
 Unfortunately, when I do execute test_fork.php from the web, it wont
 execute itself in background.

won't it? what does it do? does it go into and endless loop and bring your 
machine to a halt
by any chance? .. because by looking at it, as long as $in['bg'] is not set and 
not equal to
true it's going to keep spawning sub-shells with cmdlines that call itself.

 This method was running fine with my old config.
 
 The script works perfectly because if Im executing test_fork.php from
 the shell, the fork is working fine!

and what is the value of the ini setting 'register_argc_argv' when running
via the php CLI SAPI?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php 5 upgrade and background script on unix

2007-04-02 Thread Frederic Belleudy

Jochem:
won't it? what does it do? does it go into and endless loop and bring your 
machine to a halt
by any chance? .. because by looking at it, as long as $in['bg'] is not set and 
not equal to
true it's going to keep spawning sub-shells with cmdlines that call itself.

Me:
You haven't read my message? It works fine when Im running it from the shell

When I do:

`/usr/local/bin/php /www/admin.gammacash.com/test/test_fork.php bg=1 21 
/var/log/test.log `
you can see bg=1

its the passing arguments!
any other suggestions?



Jochem Maas wrote:

Frederic Belleudy wrote:
  

don't fork webserver processes, granted it doesn't fix the problem,
but you really
should be doing it anyway.

I'm guessing that the pcntl extension is not compiled into the
webserver php SAPI,
it's a really big guess because you didn't supply the code you use to
do the forking with.

  
  

Ok then you want to have the fork code!



'want' is putting it strongly - unless of course your handing out AudiRS4's
in which case 'want' is spot on.

  

I'm doing a complete example


My script is forking on itself.
So from my browser I go on:
http://localhost/test_fork.php

My code in test_fork.php is :

?
$in = get_shell_args($_SERVER['argv']); // DONT PAY ATTENTION TO THAT



does $_SERVER['argv'] exist at all? does your error reporting include E_NOTICE?
what is the value of the ini setting 'register_argc_argv'?

  

FUNCTION, it a made home function

if($in['bg']) {
   print HERE; sleep(30);
}
else {
   print forking;
   `/usr/local/bin/php /www/admin.gammacash.com/test/test_fork.php bg=1
21 /var/log/test.log `
}
?

So Im assuming that the fork will get the bg argument, in this case I
should receive HERE in /var/log/test.log (did tail -f
/var/log/test.log while I was running the script)
I've put a sleep 30 seconds to get the fork PID number.



no idea how the sleep() will help.

  

Unfortunately, when I do execute test_fork.php from the web, it wont
execute itself in background.



won't it? what does it do? does it go into and endless loop and bring your 
machine to a halt
by any chance? .. because by looking at it, as long as $in['bg'] is not set and 
not equal to
true it's going to keep spawning sub-shells with cmdlines that call itself.

  

This method was running fine with my old config.

The script works perfectly because if Im executing test_fork.php from
the shell, the fork is working fine!



and what is the value of the ini setting 'register_argc_argv' when running
via the php CLI SAPI?

  



--
Frederic Belleudy
Programmer
PWIdeas
ICQ #: 253-372-030 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php 5 upgrade and background script on unix

2007-04-02 Thread Frederic Belleudy

Jochem Maas wrote:

Frederic Belleudy wrote:
  

don't fork webserver processes, granted it doesn't fix the problem,
but you really
should be doing it anyway.

I'm guessing that the pcntl extension is not compiled into the
webserver php SAPI,
it's a really big guess because you didn't supply the code you use to
do the forking with.

  
  

Ok then you want to have the fork code!



'want' is putting it strongly - unless of course your handing out AudiRS4's
in which case 'want' is spot on.

  

I'm doing a complete example


My script is forking on itself.
So from my browser I go on:
http://localhost/test_fork.php

My code in test_fork.php is :

?
$in = get_shell_args($_SERVER['argv']); // DONT PAY ATTENTION TO THAT



does $_SERVER['argv'] exist at all? does your error reporting include E_NOTICE?
what is the value of the ini setting 'register_argc_argv'?

  

FUNCTION, it a made home function

if($in['bg']) {
   print HERE; sleep(30);
}
else {
   print forking;
   `/usr/local/bin/php /www/admin.gammacash.com/test/test_fork.php bg=1
21 /var/log/test.log `
}
?

So Im assuming that the fork will get the bg argument, in this case I
should receive HERE in /var/log/test.log (did tail -f
/var/log/test.log while I was running the script)
I've put a sleep 30 seconds to get the fork PID number.



no idea how the sleep() will help.

  

Unfortunately, when I do execute test_fork.php from the web, it wont
execute itself in background.



won't it? what does it do? does it go into and endless loop and bring your 
machine to a halt
by any chance? .. because by looking at it, as long as $in['bg'] is not set and 
not equal to
true it's going to keep spawning sub-shells with cmdlines that call itself.

  

This method was running fine with my old config.

The script works perfectly because if Im executing test_fork.php from
the shell, the fork is working fine!



and what is the value of the ini setting 'register_argc_argv' when running
via the php CLI SAPI?

  

the value is OFF

but my other servers that is running php cli is set to OFF too...

--
Frederic Belleudy
Programmer
PWIdeas
ICQ #: 253-372-030 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php