[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



[PHP] Forking doesn't work on php 5.2.1?

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??

--
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] Forking doesn't work on php 5.2.1?

2007-04-02 Thread Frederic Belleudy

Well I think I've found the answer:
the configure command is (in part):

'--disable-cli' '--disable-pear'

Ive got another server who is running fork script and '--enable-cli' is 
in the configure command.


Well Ill let you know guys if it works after I've recompiled apache
How comes it does work when Im executing it from the shell and not from 
the web???

Any explanations?

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

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 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] Forking doesn't work on php 5.2.1?

2007-04-02 Thread Frederic Belleudy

Well my php.ini
register_argc_argv = Off

apache was configured with the option --disable-cli
but cli is installed on my system and it works fine when i do execute 
the script from the shell

so its a problem running php cli from my php apache module

any other suggestions!?!??!

Sebe wrote:

Jochem Maas wrote:

Frederic Belleudy wrote:
 

Well Ill let you know guys if it works after I've recompiled apache



try recompiling php - recompiling apache won't have an effect as far 
as that compile

option goes.
 
  
it will if php is complied statically into apache, then you have to 
recompile apache each time you compile php.. i use static because u 
get better performance, but that's another topic of it's own..





--
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