php-general Digest 8 Dec 2006 14:17:06 -0000 Issue 4503

2006-12-08 Thread php-general-digest-help

php-general Digest 8 Dec 2006 14:17:06 - Issue 4503

Topics (messages 245629 through 245650):

weird timestamp problem
245629 by: Amanda Emily
245636 by: Larry Garfield

how to close a socket output, leave input
245630 by: nick.yim
245647 by: Mustafa Aras Koktas
245648 by: Roman Neuhauser

Re: PHP Installation question
245631 by: Beauford
245633 by: Ryan Creaser
245641 by: Roman Neuhauser

fopen failed to open pipe file in Linux+Apache environment
245632 by: mike xu
245634 by: Chris
245635 by: Ryan Creaser
245642 by: mike xu
245643 by: Ryan Creaser
245644 by: mike xu
245645 by: mike xu

Going crazy over mod_deflate
245637 by: Cabbar Duzayak
245646 by: Jochem Maas

Re: Active Directory password change utility in PHP
245638 by: Vincent DUPONT

PHP / MVC  layout question
245639 by: Vincent DUPONT

Re: recursive function problem
245640 by: Roman Neuhauser

Re: signal handling
245649 by: Jochem Maas
245650 by: Roman Neuhauser

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
php-general@lists.php.net


--
---BeginMessage---
I am working on an app that has 15 minute blocks of time to schedule meeting 
room reservations and have ran into an rather odd problem. Any ideas as to 
what could be causing this

I am expecting the block of code output this:


7:00PM
7:15PM

7:15PM
7:30PM

7:30PM
7:45PM
etc

from 5:00 AM local time (PST) to 9:30 PM, but instead starting at 7:45PM, I 
see this (time jumps from 8:00 to 8:01).

7:45 PM
8:00 PM

8:01 PM
8:16 PM

8:16 PM
8:31 PM

8:31 PM
8:46 PM
etc

What is odd is that the app works as intended if I use 30 minute blocks of 
15 minute blocks

Snippet of code is below

// menu start time
$start_c = mktime(5, 0, 0, $month_t, $day_t, $year_t);
// menu end time
$end_c = mktime(21, 30, 0, $month_t, $day_t, $year_t);

while($start_c  $end_c)
{
$time_start = $start_c;
$loop_s = $loop_s+900;
$time_end = $end_c;

$unix_e = $time_end-900;
$unix_s = date(U, $time_start);

$timeloop_e = date(g:i A, $time_end);
$timeloop_s = date(g:i A, $time_start);
print(trtd class=\timeblock\ align=\center\. $timeloop_s .br 
/. $timeloop_e . /td\n);

} 
---End Message---
---BeginMessage---
I'm not sure why you'd have that problem, but I definitely think you're 
over-engineering the code.  That could well be why you're having a problem.  
You can greatly simplify it like so:

$start_c = mktime(5, 0, 0, $month_t, $day_t, $year_t);
$end_c = mktime(21, 30, 0, $month_t, $day_t, $year_t);

for ($start_time = $start_c; $start_time = $end_c; $start_time += 900) {
  $start = date(g:i A, $start_time);
  $end = date(g:i A, $start_time + 900);
  print $startbr /$end;
}

There may be an edge-case at the end you need to deal with, as I've not tested 
the above, but as there's less code there's fewer places things can go wrong.  
That's generally a good way to do things. :-)

On Thursday 07 December 2006 18:55, Amanda Emily wrote:
 I am working on an app that has 15 minute blocks of time to schedule
 meeting room reservations and have ran into an rather odd problem. Any
 ideas as to what could be causing this

 I am expecting the block of code output this:

 
 7:00PM
 7:15PM

 7:15PM
 7:30PM

 7:30PM
 7:45PM
 etc

 from 5:00 AM local time (PST) to 9:30 PM, but instead starting at 7:45PM, I
 see this (time jumps from 8:00 to 8:01).

 7:45 PM
 8:00 PM

 8:01 PM
 8:16 PM

 8:16 PM
 8:31 PM

 8:31 PM
 8:46 PM
 etc

 What is odd is that the app works as intended if I use 30 minute blocks of
 15 minute blocks

 Snippet of code is below

 // menu start time
 $start_c = mktime(5, 0, 0, $month_t, $day_t, $year_t);
 // menu end time
 $end_c = mktime(21, 30, 0, $month_t, $day_t, $year_t);

 while($start_c  $end_c)
 {
 $time_start = $start_c;
 $loop_s = $loop_s+900;
 $time_end = $end_c;

 $unix_e = $time_end-900;
 $unix_s = date(U, $time_start);

 $timeloop_e = date(g:i A, $time_end);
 $timeloop_s = date(g:i A, $time_start);
 print(trtd class=\timeblock\ align=\center\. $timeloop_s
 .br /. $timeloop_e . /td\n);

 }

-- 
Larry Garfield  AIM: LOLG42
[EMAIL PROTECTED]   ICQ: 6817012

If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it.  -- Thomas 
Jefferson
---End Message---
---BeginMessage---
Hello All,

1. create a socket
2. write 

php-general Digest 9 Dec 2006 03:34:01 -0000 Issue 4504

2006-12-08 Thread php-general-digest-help

php-general Digest 9 Dec 2006 03:34:01 - Issue 4504

Topics (messages 245651 through 245664):

Re: signal handling
245651 by: Jochem Maas
245654 by: Stut
245655 by: Roman Neuhauser
245656 by: Mustafa Aras Koktas

Re: How to be sure to use SSL
245652 by: Jochem Maas
245653 by: Stut

Load Extensions
245657 by: Igor Kravchenko
245658 by: Jim Lucas
245659 by: Igor Kravchenko
245662 by: Jim Lucas
245663 by: Igor Kravchenko

php and DB2
245660 by: afan.afan.net
245661 by: Kristen G. Thorson
245664 by: tedd

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
php-general@lists.php.net


--
---BeginMessage---
Roman Neuhauser wrote:
 # [EMAIL PROTECTED] / 2006-12-02 02:01:35 +0200:
 Hello

 Despite all of my results to succeed, i can not make this work. What i want
 to do is to write a simple socket server in PHP. My current example just
 prints the same character, you send to server from keyboard. It is
 successfull in forking, and generates child as people connect. However in
 any way the client exits, the child process remains defunct on system. I am
 trying to use signal handling, but some comments say through hanging
 sockets, it is not possible to handle signals.

 How can i stop this from happening, i am attaching the code i am working on,
 the 2 signals added at the bottom are just for test there, i tried all other
 signal types. Sending a posix_kill(posix_getpid(), SIGKILL) to the process
 when the client exits does not kill it too, it still is defunct.

 My code: http://pastey.net/2910
 
 The parent needs to wait(2) for its children. http://php.net/pcntl_wait

hi Roman,

have I understood correctly that using pcntl_wait() means you can't do anything 
in
the parent process until all children are dead?

this seems strange. probably I'm mis-understanding and need to reread [alot of] 
stuff.

but if it is true how do you go about tackling the signal handling in child 
processes
AND at the same time have the parent process do something useful like ...
interact/direct child processes, do other management tasks whilst child 
processes are running?

maybe I'm misunderstanding the whole concept - it's nice to have that newbie 
feeling again ;-)

 
---End Message---
---BeginMessage---

Jochem Maas wrote:

Roman Neuhauser wrote:
  

The parent needs to wait(2) for its children. http://php.net/pcntl_wait



have I understood correctly that using pcntl_wait() means you can't do anything 
in
the parent process until all children are dead?

this seems strange. probably I'm mis-understanding and need to reread [alot of] 
stuff.

but if it is true how do you go about tackling the signal handling in child 
processes
AND at the same time have the parent process do something useful like ...
interact/direct child processes, do other management tasks whilst child 
processes are running?

maybe I'm misunderstanding the whole concept - it's nice to have that newbie 
feeling again ;-)


I have a system that forks to 'do work'. The main script sits in an 
infinite loop waiting for work, when it gets some it forks to process it.


In that loop I have the following at the end...

   while (pcntl_wait($status, WNOHANG))  0)
   $workers--;

That takes care of cleaning up finished processes while running.

If the loop ends for any reason (e.g. it got stopped by a status 
change), I do...


   $started = time();
   while ($workers  0 and (time() - $started)  300)
   {
   pcntl_wait($status, WNOHANG);
   $workers--;
   sleep(1);
   }

That sits waiting for up to 5 minutes for all processes to end.

-Stut
**
---End Message---
---BeginMessage---
# [EMAIL PROTECTED] / 2006-12-08 15:36:52 +0100:
 Roman Neuhauser wrote:
  # [EMAIL PROTECTED] / 2006-12-02 02:01:35 +0200:
  [...] to write a simple socket server in PHP. My current example just
  prints the same character, you send to server from keyboard. It is
  successfull in forking, and generates child as people connect. However in
  any way the client exits, the child process remains defunct on system.

  The parent needs to wait(2) for its children. http://php.net/pcntl_wait
 
 have I understood correctly that using pcntl_wait() means you can't do 
 anything in
 the parent process until all children are dead?

no.
 
 but if it is true how do you go about tackling the signal handling in child 
 processes
 AND at the same time have the parent process do something useful like ...
 interact/direct child processes, do other management tasks whilst child 
 processes are running?

do whatever you want, either have a SIGCLD handler, or check one of the
wait(2)-family functions every now and then (and make sure to use
WNOHANG).

-- 
How many Vietnam 

Re: [PHP] fopen failed to open pipe file in Linux+Apache environment

2006-12-08 Thread Ryan Creaser

mike xu wrote:

Thanks a lot forr your reply.

Here is the error msg:
*Warning*: fopen(/dev/pmsg)
[function.fopenhttp://localhost/Source/test/function.fopen]:
failed to open stream: Permission denied in *
/var/www/html/Source/test/register_user.php* on line *31

It still doesn't work even if I move pmsg to /tmp/ directory and 
change its

own to appache...



I don't really know Fedora or SELinux, but since your permissions seem 
ok could it be the SELinux policy for httpd causing you grief?


- rjc

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



Re: [PHP] fopen failed to open pipe file in Linux+Apache environment

2006-12-08 Thread mike xu

Hi Ryan,

I just did another test, if I start the httpd by root user manually (the
httpd daemon program still owns apache user by the result of `ps -aux`), the
php script works fine. So, it seems the httpd start script
(/etc/rc.d/init.d/httpd) did something specially which cause the permission
problem...
I'll continue checking it ...

Thanks,
Mike

On 12/8/06, Ryan Creaser [EMAIL PROTECTED] wrote:


mike xu wrote:
 Thanks a lot forr your reply.

 Here is the error msg:
 *Warning*: fopen(/dev/pmsg)
 [function.fopenhttp://localhost/Source/test/function.fopen]:
 failed to open stream: Permission denied in *
 /var/www/html/Source/test/register_user.php* on line *31

 It still doesn't work even if I move pmsg to /tmp/ directory and
 change its
 own to appache...


I don't really know Fedora or SELinux, but since your permissions seem
ok could it be the SELinux policy for httpd causing you grief?

- rjc



Re: [PHP] fopen failed to open pipe file in Linux+Apache environment

2006-12-08 Thread mike xu

Its so strange, when I runing /etc/rc.d/rc3.d/S85httpd restart, the php
script couldn't fopen pipe file.
But if I copy /etc/rc.d/rc3.d/S85httpd to some other place (for example
/root), and execute `/root/S85httpd restart`, the php script could fopen
file successfully!

Its so confusing ...

On 12/8/06, mike xu [EMAIL PROTECTED] wrote:


Hi Ryan,

I just did another test, if I start the httpd by root user manually (the
httpd daemon program still owns apache user by the result of `ps -aux`), the
php script works fine. So, it seems the httpd start script
(/etc/rc.d/init.d/httpd) did something specially which cause the permission
problem...
I'll continue checking it ...

Thanks,
Mike

On 12/8/06, Ryan Creaser [EMAIL PROTECTED] wrote:

 mike xu wrote:
  Thanks a lot forr your reply.
 
  Here is the error msg:
  *Warning*: fopen(/dev/pmsg)
  [function.fopenhttp://localhost/Source/test/function.fopen ]:
  failed to open stream: Permission denied in *
  /var/www/html/Source/test/register_user.php* on line *31
 
  It still doesn't work even if I move pmsg to /tmp/ directory and
  change its
  own to appache...
 

 I don't really know Fedora or SELinux, but since your permissions seem
 ok could it be the SELinux policy for httpd causing you grief?

 - rjc





Re: [PHP] Going crazy over mod_deflate

2006-12-08 Thread Jochem Maas
Cabbar Duzayak wrote:
 Before I start, I am using apache 2.0.52 with PHP 4.3.9.
 
 In my .htaccess, I have a rewrite rule that rewrites /bb.flv as
 /bb.php, and this bb.php file reads a flv file and outputs it. In the
 PHP file, I am specifying content-type as video/x-flv and
 content-length, however mod_deflate still compresses this, and also
 removes the content-length header from the response, and this messes
 up the flv player!...
 
 I tried everything, simply everything, and yet could not get
 mod_deflate to by-pass this file. For some reason, it does not see
 this content as video/x-flv, and treats is as regular text And,
 when I disable the mod_deflate filter, everything returns back to
 normal. BTW, I am not doing any compression on the PHP side!...
 
 Things I tried are:
 
 + AddOutputFilterByType DEFLATE text/html text/plain text/xml
 
 + SetEnvIfNoCase Request_URI \
  \.(?:gif|jpe?g|png|flv)$ no-gzip dont-vary

have you tried something like this:?

 \(?:\/bb\.php|.(?:gif|jpe?g|png|flv))$ no-gzip dont-vary
 
 I tried putting these in directory, location, virtual and global
 context, and none of them worked. Additionally, I tried to rewrite the
 type using the rewriterule as:
 RewriteRule ^bb.flv /bb.php [T=video/x-flv]
 
 I also tried ForcedType, AddTpe, AddOutputFilter (by extension), etc. etc.
 
 But, still the output is compressed. And, the response headers I am
 seeing are:
 
 content-disposition: inline; filename=123.flv
 Vary: Accept-Encoding
 Content-Encoding: gzip
 Keep-Alive: timeout=5, max=96
 Connection: Keep-Alive
 Transfer-Encoding: chunked
 Content-Type: video/x-flv
 
 Can you please tell what I am missing here and/or is there anyway I
 can by-pass the mod_deflate compression?
 
 TIA.
 

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



RE: [PHP] how to close a socket output, leave input

2006-12-08 Thread Mustafa Aras Koktas
Is this for the client application or server?
I assume it is a client as you are trying to read a server response.
socket_write() will return the length of the buffer that is written to
server, so you can check that value to make sure the send is complete.

--Aras

-Original Message-
From: nick.yim [mailto:[EMAIL PROTECTED]
Sent: Friday, December 08, 2006 3:39 AM
To: php-general
Subject: [PHP] how to close a socket output, leave input


Hello All,

1. create a socket
2. write something
3. (just) close output
4. read the server response
5. close the socket

step 3, i mean close output, let the server know the client send
complete

Best regards,

nick.yim
[EMAIL PROTECTED]
2006-12-08

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

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



Re: [PHP] how to close a socket output, leave input

2006-12-08 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2006-12-08 09:38:44 +0800:
 Hello All,
 
 1. create a socket
 2. write something
 3. (just) close output
   4. read the server response
 5. close the socket
 
 step 3, i mean close output, let the server know the client send complete

socket_shutdown() might help

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



Re: [PHP] signal handling

2006-12-08 Thread Jochem Maas
Aras wrote:
 Hello
 
 Despite all of my results to succeed, i can not make this work. What i want
 to do is to write a simple socket server in PHP. My current example just
 prints the same character, you send to server from keyboard. It is
 successfull in forking, and generates child as people connect. However in
 any way the client exits, the child process remains defunct on system. I am
 trying to use signal handling, but some comments say through hanging
 sockets, it is not possible to handle signals.
 
 How can i stop this from happening, i am attaching the code i am working on,
 the 2 signals added at the bottom are just for test there, i tried all other
 signal types. Sending a posix_kill(posix_getpid(), SIGKILL) to the process
 when the client exits does not kill it too, it still is defunct.

I don't know what is going wrong bu5t I would like to ...
If it were my problem I'd start by configuring more calls to pcntl_signal()
to cover all signals and add some more info to the output of your signal handler
so you can see whats what (e.g. pid etc) - maybe some signals are being sent but
your not trapping them...

also does removing the pcntl_signal() calls completely have any positive effect.

sorry if I suggesting stuff that is obvious to you - I still kind of new
to all this cmdline scripting, process signalling, etc - although it's something
that has been keeping me busy and I'm looking to increase my understanding.

 
 My code: http://pastey.net/2910
 
 
 Thanks!
 Aras
 

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



Re: [PHP] signal handling

2006-12-08 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2006-12-02 02:01:35 +0200:
 Hello
 
 Despite all of my results to succeed, i can not make this work. What i want
 to do is to write a simple socket server in PHP. My current example just
 prints the same character, you send to server from keyboard. It is
 successfull in forking, and generates child as people connect. However in
 any way the client exits, the child process remains defunct on system. I am
 trying to use signal handling, but some comments say through hanging
 sockets, it is not possible to handle signals.
 
 How can i stop this from happening, i am attaching the code i am working on,
 the 2 signals added at the bottom are just for test there, i tried all other
 signal types. Sending a posix_kill(posix_getpid(), SIGKILL) to the process
 when the client exits does not kill it too, it still is defunct.
 
 My code: http://pastey.net/2910

The parent needs to wait(2) for its children. http://php.net/pcntl_wait

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



Re: [PHP] signal handling

2006-12-08 Thread Jochem Maas
Roman Neuhauser wrote:
 # [EMAIL PROTECTED] / 2006-12-02 02:01:35 +0200:
 Hello

 Despite all of my results to succeed, i can not make this work. What i want
 to do is to write a simple socket server in PHP. My current example just
 prints the same character, you send to server from keyboard. It is
 successfull in forking, and generates child as people connect. However in
 any way the client exits, the child process remains defunct on system. I am
 trying to use signal handling, but some comments say through hanging
 sockets, it is not possible to handle signals.

 How can i stop this from happening, i am attaching the code i am working on,
 the 2 signals added at the bottom are just for test there, i tried all other
 signal types. Sending a posix_kill(posix_getpid(), SIGKILL) to the process
 when the client exits does not kill it too, it still is defunct.

 My code: http://pastey.net/2910
 
 The parent needs to wait(2) for its children. http://php.net/pcntl_wait

hi Roman,

have I understood correctly that using pcntl_wait() means you can't do anything 
in
the parent process until all children are dead?

this seems strange. probably I'm mis-understanding and need to reread [alot of] 
stuff.

but if it is true how do you go about tackling the signal handling in child 
processes
AND at the same time have the parent process do something useful like ...
interact/direct child processes, do other management tasks whilst child 
processes are running?

maybe I'm misunderstanding the whole concept - it's nice to have that newbie 
feeling again ;-)

 

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



Re: [PHP] How to be sure to use SSL

2006-12-08 Thread Jochem Maas
Alain Roger wrote:
 Richard,
 
 as i wrote you before, i've gotthe following suggestion to implement before
 to run the rest of my PHP code.
 
 if($_SERVER['HTTPS']!='on')
 {
 header('location:https://www.mysite.com');
 exit;
 }
 ...
 
 but i do not know if it's enough.

it is enough - but I'd like to clean it up for you just a tiny bit:

1. use isset on thwe var your checking
2. strtolower() the var your checking to cover your ass on even the weirdest
webserver SAPIs (I have seen the values of 'On' and 'on' for $_SERVER['HTTPS'])
3. 'Location: ' not 'location:' (1 more 'location' and I'm a realestate agent, 
ack dang too late ;-)

if(!isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) != 'on') {
header('Location: https://www.mysite.com');
exit;
}

 
 Alain
 
 
 On 12/2/06, Richard Lynch [EMAIL PROTECTED] wrote:

 On Sat, December 2, 2006 2:17 am, Alain Roger wrote:
  I would like to know how can i be sure to make customer use the SSL
  all the
  time.
  all the time in my PHP code, i write links as relative links, so
  without
  HTTPS.
 
  I was thinking to check everything if the port is the SSL port
  (default :
  443), but it does not mean that protocol is HTTPS.
  So, how do you ensure that customer uses SSL protocol all the time ?

 I was asking myself that same question last week, but I searched on
 http://php.net for the answer.

 Did you try that?

 :-)

 -- 
 Some people have a gift link here.
 Know what I want?
 I want you to buy a CD from some starving artist.
 http://cdbaby.com/browse/from/lynch
 Yeah, I get a buck. So?


 
 

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



Re: [PHP] How to be sure to use SSL

2006-12-08 Thread Stut

Alain Roger wrote:

but i do not know if it's enough.


Sorry it doesn't use PHP, but this is what I do if the client wants an 
entire site to always use SSL. In the web server config for the non-ssl 
site, put a permanent redirection to the SSL site. For Apache I use the 
following vhost...


VirtualHost 10.10.10.5:80
   ServerName domain.com
   ServerAlias www.domain.com
   Redirect permanent / https://www.domain.com/
/VirtualHost

Works great, and it retains the full URL they were aiming for. For 
example, if they go to http://domain.com/somewhere they end up at 
https://www.domain.com/somewhere.


I'm sure something similar is possible in most web servers.

-Stut

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



Re: [PHP] signal handling

2006-12-08 Thread Stut

Jochem Maas wrote:

Roman Neuhauser wrote:
  

The parent needs to wait(2) for its children. http://php.net/pcntl_wait



have I understood correctly that using pcntl_wait() means you can't do anything 
in
the parent process until all children are dead?

this seems strange. probably I'm mis-understanding and need to reread [alot of] 
stuff.

but if it is true how do you go about tackling the signal handling in child 
processes
AND at the same time have the parent process do something useful like ...
interact/direct child processes, do other management tasks whilst child 
processes are running?

maybe I'm misunderstanding the whole concept - it's nice to have that newbie 
feeling again ;-)


I have a system that forks to 'do work'. The main script sits in an 
infinite loop waiting for work, when it gets some it forks to process it.


In that loop I have the following at the end...

   while (pcntl_wait($status, WNOHANG))  0)
   $workers--;

That takes care of cleaning up finished processes while running.

If the loop ends for any reason (e.g. it got stopped by a status 
change), I do...


   $started = time();
   while ($workers  0 and (time() - $started)  300)
   {
   pcntl_wait($status, WNOHANG);
   $workers--;
   sleep(1);
   }

That sits waiting for up to 5 minutes for all processes to end.

-Stut
**

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



Re: [PHP] signal handling

2006-12-08 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2006-12-08 15:36:52 +0100:
 Roman Neuhauser wrote:
  # [EMAIL PROTECTED] / 2006-12-02 02:01:35 +0200:
  [...] to write a simple socket server in PHP. My current example just
  prints the same character, you send to server from keyboard. It is
  successfull in forking, and generates child as people connect. However in
  any way the client exits, the child process remains defunct on system.

  The parent needs to wait(2) for its children. http://php.net/pcntl_wait
 
 have I understood correctly that using pcntl_wait() means you can't do 
 anything in
 the parent process until all children are dead?

no.
 
 but if it is true how do you go about tackling the signal handling in child 
 processes
 AND at the same time have the parent process do something useful like ...
 interact/direct child processes, do other management tasks whilst child 
 processes are running?

do whatever you want, either have a SIGCLD handler, or check one of the
wait(2)-family functions every now and then (and make sure to use
WNOHANG).

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



[PHP] signal handling

2006-12-08 Thread Mustafa Aras Koktas
Roman, Stut and Jochem, thanks for the comments and recommendations on the
subject.
I have installed my signal as  pcntl_signal(SIGCHLD, SIG_IGN)  without a
specific function handler and it is closing child processes now. I could not
use the pcntl_wait because it is available after PHP 5.0 i guess.



-Original Message-
From: Roman Neuhauser [mailto:[EMAIL PROTECTED]
Sent: Friday, December 08, 2006 7:02 PM
To: Jochem Maas
Cc: php-general@lists.php.net
Subject: Re: [PHP] signal handling


# [EMAIL PROTECTED] / 2006-12-08 15:36:52 +0100:
 Roman Neuhauser wrote:
  # [EMAIL PROTECTED] / 2006-12-02 02:01:35 +0200:
  [...] to write a simple socket server in PHP. My current example just
  prints the same character, you send to server from keyboard. It is
  successfull in forking, and generates child as people connect. However
in
  any way the client exits, the child process remains defunct on system.

  The parent needs to wait(2) for its children.
http://php.net/pcntl_wait

 have I understood correctly that using pcntl_wait() means you can't do
anything in
 the parent process until all children are dead?

no.

 but if it is true how do you go about tackling the signal handling in
child processes
 AND at the same time have the parent process do something useful like ...
 interact/direct child processes, do other management tasks whilst child
processes are running?

do whatever you want, either have a SIGCLD handler, or check one of the
wait(2)-family functions every now and then (and make sure to use
WNOHANG).

--
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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

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



[PHP] Load Extensions

2006-12-08 Thread Igor Kravchenko
Can someone help me with this, please?  I cannot load extensions.

I setup php5 in the c:\php folder.  I specified extension_dir = 
C:\php\ext.

Everything else is setup correctly because php works. for me, I can load 
phpinfo file.

It would not load extensions.

I am going nuts here.  Please anyone, what can it be

Thank you. 

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



Re: [PHP] Load Extensions

2006-12-08 Thread Jim Lucas

Igor Kravchenko wrote:

Can someone help me with this, please?  I cannot load extensions.

I setup php5 in the c:\php folder.  I specified extension_dir = 
C:\php\ext.


Everything else is setup correctly because php works. for me, I can load 
phpinfo file.


It would not load extensions.

I am going nuts here.  Please anyone, what can it be

Thank you. 

  
run the phpinfo() command in a script and see where your php.ini file is 
located.


make sure you are editing the correct file.

jl

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



Re: [PHP] Load Extensions

2006-12-08 Thread Igor Kravchenko
Thank you for your reply.

I have only one php.ini. I checked it.

Now, I found in the evenet log viewer that I have lots of messages like:

Module compiled with module API=20060613, debug=0, thread-safety=1

PHP compiled with module API=20020429, debug=0, thread-safety=1

These options need to match

And

 PHP Warning: Unknown(): Unable to load dynamic library 
'C:\php\ext\php_mysqli.dll' - The specified procedure could not be found.

in Unknown on line 0.

Any ideas?

The file is there and this is the correct path.

Thank you.

ILK.





Jim Lucas [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Igor Kravchenko wrote:
 Can someone help me with this, please?  I cannot load extensions.

 I setup php5 in the c:\php folder.  I specified extension_dir = 
 C:\php\ext.

 Everything else is setup correctly because php works. for me, I can load 
 phpinfo file.

 It would not load extensions.

 I am going nuts here.  Please anyone, what can it be

 Thank you.

 run the phpinfo() command in a script and see where your php.ini file is 
 located.

 make sure you are editing the correct file.

 jl 

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



[PHP] php and DB2

2006-12-08 Thread afan
hi to all,
my IT director got an idea to replace mysql with DB2. more
power/flexibility/stability/security...
though, for our needs, I think mysql is just fine and enough. the business
we are doing is promotional products and all online orders we have are
ONLY from our sales people. with 200-300 orders per day and averge of 5
items per order I think we really don't need that replacement.
though, don't know how php works with DB2 (assuming same quality as with
mysql).

can anybody give me some ideas and reasons to present to boss to NOT
replace mysql with DB2?

thanks.

-afan

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



RE: [PHP] php and DB2

2006-12-08 Thread Kristen G. Thorson
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: Friday, December 08, 2006 3:39 PM
 To: php-general@lists.php.net
 Subject: [PHP] php and DB2
 
 hi to all,
 my IT director got an idea to replace mysql with DB2. more
 power/flexibility/stability/security...
 though, for our needs, I think mysql is just fine and enough. the
business
 we are doing is promotional products and all online orders we have are
 ONLY from our sales people. with 200-300 orders per day and averge of
5
 items per order I think we really don't need that replacement.
 though, don't know how php works with DB2 (assuming same quality as
with
 mysql).
 
 can anybody give me some ideas and reasons to present to boss to NOT
 replace mysql with DB2?
 
 thanks.
 
 -afan
 


I don't know how close the syntax between MySQL and DB2 is, but I
suspect you're looking at quite a bit of rewrite.  Unless your
application was written specifically to work with either, I doubt it
will simply be a matter of plugging in a new database.

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



Re: [PHP] Load Extensions

2006-12-08 Thread Jim Lucas

Igor Kravchenko wrote:

Thank you for your reply.

I have only one php.ini. I checked it.

Now, I found in the evenet log viewer that I have lots of messages like:

Module compiled with module API=20060613, debug=0, thread-safety=1

PHP compiled with module API=20020429, debug=0, thread-safety=1

These options need to match

And

 PHP Warning: Unknown(): Unable to load dynamic library 
'C:\php\ext\php_mysqli.dll' - The specified procedure could not be found.


in Unknown on line 0.

Any ideas?

The file is there and this is the correct path.

Thank you.

ILK.





Jim Lucas [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
  

Igor Kravchenko wrote:


Can someone help me with this, please?  I cannot load extensions.

I setup php5 in the c:\php folder.  I specified extension_dir = 
C:\php\ext.


Everything else is setup correctly because php works. for me, I can load 
phpinfo file.


It would not load extensions.

I am going nuts here.  Please anyone, what can it be

Thank you.

  
run the phpinfo() command in a script and see where your php.ini file is 
located.


make sure you are editing the correct file.

jl 



  


The These options need to match warning is talking about the version of php 
that it was compiled against.  They look like timestamps to me.  So,I will assume you are 
trying to use a different version of php then what the extension was compiled against.

Find out what version of PHP you are using and what version of PHP the 
extension was compiled for and you might then have your answer.

jl

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



Re: [PHP] Load Extensions

2006-12-08 Thread Igor Kravchenko
Thank you.
I removed php folder - everything except php.ini file and replaced with the 
new downloaded version and it started working.

Thank you for your help.


Jim Lucas [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Igor Kravchenko wrote:
 Thank you for your reply.

 I have only one php.ini. I checked it.

 Now, I found in the evenet log viewer that I have lots of messages like:

 Module compiled with module API=20060613, debug=0, thread-safety=1

 PHP compiled with module API=20020429, debug=0, thread-safety=1

 These options need to match

 And

  PHP Warning: Unknown(): Unable to load dynamic library 
 'C:\php\ext\php_mysqli.dll' - The specified procedure could not be found.

 in Unknown on line 0.

 Any ideas?

 The file is there and this is the correct path.

 Thank you.

 ILK.





 Jim Lucas [EMAIL PROTECTED] wrote in message 
 news:[EMAIL PROTECTED]

 Igor Kravchenko wrote:

 Can someone help me with this, please?  I cannot load extensions.

 I setup php5 in the c:\php folder.  I specified extension_dir = 
 C:\php\ext.

 Everything else is setup correctly because php works. for me, I can 
 load phpinfo file.

 It would not load extensions.

 I am going nuts here.  Please anyone, what can it be

 Thank you.


 run the phpinfo() command in a script and see where your php.ini file is 
 located.

 make sure you are editing the correct file.

 jl



 The These options need to match warning is talking about the version of 
 php that it was compiled against.  They look like timestamps to me.  So,I 
 will assume you are trying to use a different version of php then what the 
 extension was compiled against.

 Find out what version of PHP you are using and what version of PHP the 
 extension was compiled for and you might then have your answer.

 jl 

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



Re: [PHP] php and DB2

2006-12-08 Thread tedd

At 9:38 PM +0100 12/8/06, [EMAIL PROTECTED] wrote:

hi to all,
my IT director got an idea to replace mysql with DB2. more
power/flexibility/stability/security...
though, for our needs, I think mysql is just fine and enough. the business
we are doing is promotional products and all online orders we have are
ONLY from our sales people. with 200-300 orders per day and averge of 5
items per order I think we really don't need that replacement.
though, don't know how php works with DB2 (assuming same quality as with
mysql).

can anybody give me some ideas and reasons to present to boss to NOT
replace mysql with DB2?

thanks.

-afan


Afan:

These people will give you sound advice:

http://lists.nyphp.org/mailman/listinfo/mysql

Ask them.

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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