[PHP] Shared Memory with Yast-installed mod_php4 from SuSE.

2001-01-23 Thread Thomas Weber

Hi,

i try to use the shared memory functions on a SuSE Linux 7.0 server with
Apache and mod_php4 out of the box installed with yast. For shmop i need to
configure PHP with --enable-shmop with isn't enabled in this installation.

I know how to enable this when compiling and installing the source of
mod_php4, what is to difficult for me, i think. But how to enable it in the
SuSE-RPM-Distribution? I found a mod_php4.spec in /usr/src/packages/SPECS in
wich the configuration options are, butr i don't know how to use it to
install this RPM with my own configuration. Can anyone help me?

Sincerly,
---
Thomas Weber


CYNOBIA Community Online Service AG
Khbachstrae 11
81543 Mnchen
fon 089-78 06 0(280)
fax 089-78 06 01 99
email [EMAIL PROTECTED]
net http://www.CYNOBIA.de




WG: [PHP] Shared Memory with Yast-installed mod_php4 from SuSE.

2001-01-24 Thread Thomas Weber



-Ursprungliche Nachricht-
Von: Thomas Weber [mailto:[EMAIL PROTECTED]]
Gesendet: Mittwoch, 24. Januar 2001 09:50
An: [EMAIL PROTECTED]
Betreff: AW: [PHP] Shared Memory with Yast-installed mod_php4 from SuSE.


Thanks Stathis i tried it twice to compile it, ./configure , make,
make install. but i don't get a new libphp4.so! I found only a libphp4.a
wich is 9MB (the original libphp4.so is only 2.5MB . can't be the same)
and when i try to load this module (and not the libphp4.so from SuSE) is get
an syntax-error in httpd.conf (SuSE support says this happens when a module
is not functioning.)



Hit Thomas,

you need to recompile PHP with the options you want (as a shared apache
module) and then replace libphp4.so on /usr/lib/apache/ with your own
version.
A good thing is to keep SuSE's version as a backup:-)
Don't forget to restart apache afterwards. (/etc/rc.d/apache stop;
/etc/rc.d/apache start)

A SuSE.6.4 user.

-Stathis.

Thomas Weber wrote:

 Hi,

 i try to use the shared memory functions on a SuSE Linux 7.0 server with
 Apache and mod_php4 out of the box installed with yast. For shmop i need
to
 configure PHP with --enable-shmop with isn't enabled in this installation.

 I know how to enable this when compiling and installing the source of
 mod_php4, what is to difficult for me, i think. But how to enable it in
the
 SuSE-RPM-Distribution? I found a mod_php4.spec in /usr/src/packages/SPECS
in
 wich the configuration options are, butr i don't know how to use it to
 install this RPM with my own configuration. Can anyone help me?

 Sincerly,
 ---
 Thomas Weber

 CYNOBIA Community Online Service AG
 Kühbachstraße 11
 81543 München
 fon 089-78 06 0(280)
 fax 089-78 06 01 99
 email [EMAIL PROTECTED]
 net http://www.CYNOBIA.de

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




AW: WG: [PHP] Shared Memory with Yast-installed mod_php4 from SuSE.

2001-01-24 Thread Thomas Weber

Yea, thank you It worked!

Formerly i used the --with-apache command (wich hasn't worked) and now with
the --with-apxs it works.

Great, thank you very much! :))

--
Thomas


-Ursprüngliche Nachricht-
Von: Christian Reiniger [mailto:[EMAIL PROTECTED]]
Gesendet: Mittwoch, 24. Januar 2001 12:15
An: Php-General
Betreff: Re: WG: [PHP] Shared Memory with Yast-installed mod_php4 from
SuSE.


On Wednesday 24 January 2001 09:55, Thomas Weber wrote:
 Thanks Stathis i tried it twice to compile it, ./configure ,
 make, make install. but i don't get a new libphp4.so! I found only
 a libphp4.a wich is 9MB (the original libphp4.so is only 2.5MB .

You forgot the --with-apxs switch to ./configure

Also , try doing a
strip --strip-unneeded libphp4.so
afterwards

--
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

The use of COBOL cripples the mind; its teaching should, therefore,
be regarded as a criminal offence.

- Edsger W. Dijkstra

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




AW: [PHP] eval() to string???

2001-01-24 Thread Thomas Weber

try

eval("\$php_code;");

-Ursprngliche Nachricht-
Von: [ rswfire ] [mailto:[EMAIL PROTECTED]]
Gesendet: Mittwoch, 24. Januar 2001 15:36
An: [EMAIL PROTECTED]
Betreff: [PHP] eval() to string???


I want to evaluate some PHP code to a string.  How can I do this?

$php_code = "echo 'hello';"

I would like to evaluate the code to "hello" in another string...


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




AW: [PHP] eval() to string???

2001-01-24 Thread Thomas Weber


okay, i see

here is an example:

$php_code = "$foo + $bar";
eval("\$var = \"$php_code\";);

now in $var there should be the eval of $foo + $bar


-Ursprngliche Nachricht-
Von: Robert S. White [mailto:[EMAIL PROTECTED]]
Gesendet: Mittwoch, 24. Januar 2001 16:20
An: [EMAIL PROTECTED]
Betreff: Re: [PHP] eval() to string???


How is this going to help me?

I want to evaluate the code in $php_code to *another* string...


- Original Message -
From: Thomas Weber 
To: Php-General 
Sent: Wednesday, January 24, 2001 10:14 AM
Subject: AW: [PHP] eval() to string???


 try

 eval("\$php_code;");

 -Ursprngliche Nachricht-
 Von: [ rswfire ] [mailto:[EMAIL PROTECTED]]
 Gesendet: Mittwoch, 24. Januar 2001 15:36
 An: [EMAIL PROTECTED]
 Betreff: [PHP] eval() to string???


 I want to evaluate some PHP code to a string.  How can I do this?

 $php_code = "echo 'hello';"

 I would like to evaluate the code to "hello" in another string...


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] httpd-prozess doesn't get killed

2001-01-30 Thread Thomas Weber

Hi,

i code a streaming chat in PHP4. Everithing works fine, it is very fast due
to use of shared memory. But i have this problem: Every time i start the
script a new httpd-process is started (Apache 1.3.12). So far so good. But
the process doesn't get killed when aborting or reloading the script. So if
you reload the stream an few times you have a task list full of Apaches.

How can i kill the old, unused process when i reload the page?

I tried if($connection_aborted()) { exit; }, but it exits the first time.

Thanks,
---
Thomas Weber


CYNOBIA Community Online Service AG
Khbachstrae 11
81543 Mnchen
fon 089-78 06 0(280)
fax 089-78 06 01 99
email [EMAIL PROTECTED]
net http://www.CYNOBIA.de




RE: [PHP] major help required with php3 and apache on suse 7.0 pro

2001-01-30 Thread Thomas Weber

Hi,

i run SuSE 7.0 too, but i think you cannot use mod_php3 AND mod_php4
together.

-Original Message-
From: bob [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 30, 2001 9:48 AM
To: [EMAIL PROTECTED]
Subject: [PHP] major help required with php3 and apache on suse 7.0 pro
Importance: High


Hi,

I have a webserver with over 100 domains running.
I have installed suse 7.0 with the apache that came with suse.
php3 and 4 are installed but are not running.
I cannot restart apache because of an error, and I dont seem to find it.

I want to download the new .14 apache and compile it, but I have NEVER done
that before.
My system admin had a major car crash, and is out for the next 3 months.
Now I want to try this.
I must be careful though, because of the running domains etc...

How can I do this ?
Can anyone help me ?

Regards,
Bob


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] major help required with php3 and apache on suse 7.0 pro

2001-01-30 Thread Thomas Weber

in yout httpd.conf (/etc/httpd/httpd.conf i think) there is a section
IfDefine PHP4. Just comment out the lines with IfDefine... and
/IfDefine and add your prefered extension to a line with AddType.
Then restart the Apache and it should work.

For administration it is always good you are running a Webmin-Server on your
box. ( http://www.webmin.org ) This is a very confortable web.interface for
Linux-administration.

-Original Message-
From: bob [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 30, 2001 12:48 PM
To: Thomas Weber
Subject: RE: [PHP] major help required with php3 and apache on suse 7.0
pro


Hi thomas,

I uninstalled all the php_mods
Installed php4_mod via yast
And still, if I want to www.propop.be/test.php3 then it want to download the
file.

You have suggestions ?

THNX mate

Bob

-Oorspronkelijk bericht-
Van: Thomas Weber [mailto:[EMAIL PROTECTED]]
Verzonden: dinsdag 30 januari 2001 12:27
Aan: [EMAIL PROTECTED]
CC: Php-General
Onderwerp: RE: [PHP] major help required with php3 and apache on suse
7.0 pro


Hi,

i run SuSE 7.0 too, but i think you cannot use mod_php3 AND mod_php4
together.

-Original Message-
From: bob [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 30, 2001 9:48 AM
To: [EMAIL PROTECTED]
Subject: [PHP] major help required with php3 and apache on suse 7.0 pro
Importance: High


Hi,

I have a webserver with over 100 domains running.
I have installed suse 7.0 with the apache that came with suse.
php3 and 4 are installed but are not running.
I cannot restart apache because of an error, and I dont seem to find it.

I want to download the new .14 apache and compile it, but I have NEVER done
that before.
My system admin had a major car crash, and is out for the next 3 months.
Now I want to try this.
I must be careful though, because of the running domains etc...

How can I do this ?
Can anyone help me ?

Regards,
Bob


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Problem compilieng PHP4

2001-02-03 Thread Thomas Weber

Hi,

i tried to compile PHP4.0.4pl1 on my fresh installed SuSE 7.0 Linux box. But everytime 
i call make i get errors like:

linux/limits.h: No such file or directory
linux/errno.h: No such file or directory

Both these files are in /usr/inclue/. Why does the make not find these files?

Thanks,

Thomas Weber
---
EMail: [EMAIL PROTECTED]
Homepage: http://www.youngarts.org / http://www.visions-of-future.de



Fw: [PHP] Problem compiling PHP4 Nr. 2

2001-02-03 Thread Thomas Weber

I have solved the problem. But now i have another problem:

Look at this screenshot: http://electic.hn.org/tunix.gif

Thanks,
---
Thomas Weber
---
EMail: [EMAIL PROTECTED]
Homepage: http://www.youngarts.org / http://www.visions-of-future.de
- Original Message -
From: "Thomas Weber" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, February 03, 2001 7:45 PM
Subject: [PHP] Problem compilieng PHP4


Hi,

i tried to compile PHP4.0.4pl1 on my fresh installed SuSE 7.0 Linux box. But
everytime i call make i get errors like:

linux/limits.h: No such file or directory
linux/errno.h: No such file or directory

Both these files are in /usr/inclue/. Why does the make not find these
files?

Thanks,

Thomas Weber
---
EMail: [EMAIL PROTECTED]
Homepage: http://www.youngarts.org / http://www.visions-of-future.de



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Stringing sql queries?

2001-02-03 Thread Thomas Weber

Yep, try this:

SELECT a.col1, a.col2, b.col3, c.col4 FROM table1 a, table2 b, table3 c

This should give you an array [col1,col2,col3,col4]


Thomas Weber
---
EMail: [EMAIL PROTECTED]
Homepage: http://www.youngarts.org / http://www.visions-of-future.de

- Original Message - 
From: "Sandeep Hundal" [EMAIL PROTECTED]
To: "PHP General" [EMAIL PROTECTED]
Sent: Sunday, February 04, 2001 1:44 AM
Subject: [PHP] Stringing sql queries?


 All,
 can I string 2 sql queries one after the other? 
 like "select * from $table; select * from $table2;" ???
 
 If I can, does that mean if I use mysql_fetch_array then it'll
 convert results from both queries into variables?
 
 TIA
 
 
 __
 Get personalized email addresses from Yahoo! Mail - only $35 
 a year!  http://personal.mail.yahoo.com/
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Response 304

2001-03-09 Thread Thomas Weber

Hi,

i want a script to produce a "HTTP/1.0 304 Not Modified" or "Status 304 Not
Modified". Normally when i send this header after GET data to a script, it
should not be loaded. (in this case: an input-frame of a chat should not be
reloaded after submitting the data.). I heard the script should only send
the header without message body. so i tried:

header ("HTTP/1.0 304 Not Modified");
exit;

But this don't work. The Script is loaded and, of course, an empty page.

How can i do this???

Thank you.

bye,

Thomas Weber


CYNOBIA Community Online Service AG
Khbachstrae 11
81543 Mnchen
fon 089-78 06 0(280)
fax 089-78 06 01 99
email [EMAIL PROTECTED]
net http://www.CYNOBIA.de




[PHP] strange Compiling Errors / PHP4.0.4pl1

2001-02-05 Thread Thomas Weber

Hi,
i've compiled and installed PHP4.0.4pl1 on two systems without problems, but
on the third i get strange errors. The ./configure works, but at the make i
get some errors like "linux/limits.h: No such file or directory", even this
file is in /usr/include/. I have copied limits.h and errno.h to
/usr/include/linux/ and now this works. But now i get another big fat error.
I make a screenshot you find here: http://gotik.hn.org/tunix.gif
The System is a standard-install of SuSE Linux 7.0 with all that required
stuff, bison, flex, automake and so on.
(I tried the same with PHP4.0.3 but i get the same errors.)
Please help me!!!

Thank you,
Thomas Weber


CYNOBIA Community Online Service AG
Khbachstrae 11
81543 Mnchen
fon 089-78 06 0(280)
fax 089-78 06 01 99
email [EMAIL PROTECTED]
net http://www.CYNOBIA.de




[PHP] FW: [PHP-INST] RE: strange Compiling Errors / PHP4.0.4pl1

2001-02-06 Thread Thomas Weber

The problem is solved! My system searched the .h-files in
/usr/include/linux/ and i found them all in
/usr/src/linux-2.2.16/include/linux/, just copied them and it worked :-)))

Thank you all for the support!

-Original Message-
From: Thomas Weber [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 05, 2001 6:07 PM
To: Php-Install; John Hinsley
Subject: [PHP-INST] RE: strange Compiling Errors / PHP4.0.4pl1


The inluded version is PHP4.0.0, but i need an alternative configured 4.0.3
or 4.0.4 with support for shared memory functions. :-(

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of
John Hinsley
Sent: Monday, February 05, 2001 5:59 PM
To: Thomas Weber
Subject: Re:strange Compiling Errors / PHP4.0.4pl1


Hi Thomas:

I'm not sure which version of php was included with SuSE 7.0. But I'd be
inclined to simply use Yast to install it.
--

**
Marx: "Why do Anarchists only drink herbal tea?"
Proudhon: "Because all proper tea is theft."

**


--
PHP Install Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] signal handler to ignore kill of parent

2003-01-02 Thread Thomas Weber
Hi,

i need some way for child-processes to ignore the kill of their parent. Any
idea?

Thanks,
Thomas 'Neo' Weber
---
[EMAIL PROTECTED]
[EMAIL PROTECTED]


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




Re: [PHP] signal handler to ignore kill of parent

2003-01-03 Thread Thomas Weber
I am using the pcntl_ fork() from PHP. The problem with exec() is that i
need the variables and socket-descriptors from the parent.

Thomas 'Neo' Weber
---
[EMAIL PROTECTED]
[EMAIL PROTECTED]

- Original Message -
From: Michael J. Pawlowsky [EMAIL PROTECTED]
To: PHP-List [EMAIL PROTECTED]
Sent: Thursday, January 02, 2003 7:42 PM
Subject: Re: [PHP] signal handler to ignore kill of parent



 Actually let me try to be a bit more helpful... nut not much though :-)

 Did you write the code for the fork();

 Can you modify it?  Read the fork, exec and clone man pages.
 This might help you a bit understand the behaviour.

 If so just call exec from the forked process... this will create a new
process instead of a child one.
 Then call exit() in your forked process.

 Mike






 *** REPLY SEPARATOR  ***

 On 02/01/2003 at 7:05 PM Thomas Weber wrote:

 Hi,
 
 i need some way for child-processes to ignore the kill of their parent.
Any
 idea?
 
 Thanks,
 Thomas 'Neo' Weber
 ---
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]
 
 
 --
 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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Mozilla and german 'Umlaute'

2003-09-13 Thread Thomas Weber
Hi,

i have a strange problem with Mozilla. When submitting a form, german
umlaute (ä (ae), ü (ue) and others) become strange 16bit-chars like 'ä'.
I've tested this with PHP as dynamic Apache-module and with an own webserver
written in PHP.
Doctype and other XML-specific things in the page with the form don't make
any changes.

Does anyone know this problem? Does someone have a solution for this?

Thanks,
Thomas 'Neo' Weber
---
[EMAIL PROTECTED]
[EMAIL PROTECTED]

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



[PHP] socket_write eats data

2003-09-13 Thread Thomas Weber
Hi,

I am deveoping a chatserver in IRC-style in PHP. For communication it uses
socket-multiplexing aka socket_select. So long so good, works perfectly.
The problem is, than when i make several socket_write's to the same client
without waiting about 0.1sec after each write, the written data gets lost
somewhere. socket_write does NOT throw any error, the data seams just
sended, but the clients never receives it.

Small example of the used code:
-
var $clients // array of 'client'-objects, each object has it's own
socket-descriptor in the object-variable $socket

function write_to_clients ($text) {
  for ($i = 0; $i  count ($this-clients); $i++) {
socket_write ($this-clients[$i]-socket, $text);
  }
  // usleep (1); if this is uncommented, all write are received by all
clients
}

for ($i = 0; $i  10; $i++) {
$this-write_to_clients (test .$i);
}
-

Okay, this doesn't check the client-sockets for readiness to write, but even
if I check (via socket_select), ALL clients are ready to write and writes
get lost too. It can't be the network-connection, because the tests run with
standalone PHP-clients on the same machine.

Is there any possibility to make fast writes without waiting after each
write? The wait limits the server to max. 10 writes per second, wich isn't
really enaugh for a good chatserver.

Thanks for your help!

Thomas 'Neo' Weber
---
[EMAIL PROTECTED]
[EMAIL PROTECTED]

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



Re: [PHP] socket_write eats data - solved

2003-09-13 Thread Thomas Weber
Hi,

i've checked a hundred things before posting this question, but i forgot the
most important thing, the buffer.
The 'eaten' writes were buffered by the network-kernel and sent as bunch of
data. If too much data for the buffer is sent, the write is broken up and
completed in the next bunch-of-data.
My receive-script hasn't diplayed the raw output, but an unserialized array,
fetched out of the received string.

Maybe this will will help someone in future.

Thomas 'Neo' Weber
---
[EMAIL PROTECTED]
[EMAIL PROTECTED]

- Original Message - 
From: Thomas Weber [EMAIL PROTECTED]
To: PHP-List [EMAIL PROTECTED]
Sent: Saturday, September 13, 2003 9:15 PM
Subject: [PHP] socket_write eats data


 Hi,

 I am deveoping a chatserver in IRC-style in PHP. For communication it uses
 socket-multiplexing aka socket_select. So long so good, works perfectly.
 The problem is, than when i make several socket_write's to the same client
 without waiting about 0.1sec after each write, the written data gets lost
 somewhere. socket_write does NOT throw any error, the data seams just
 sended, but the clients never receives it.

 Small example of the used code:
 -
 var $clients // array of 'client'-objects, each object has it's own
 socket-descriptor in the object-variable $socket

 function write_to_clients ($text) {
   for ($i = 0; $i  count ($this-clients); $i++) {
 socket_write ($this-clients[$i]-socket, $text);
   }
   // usleep (1); if this is uncommented, all write are received by all
 clients
 }

 for ($i = 0; $i  10; $i++) {
 $this-write_to_clients (test .$i);
 }
 -

 Okay, this doesn't check the client-sockets for readiness to write, but
even
 if I check (via socket_select), ALL clients are ready to write and writes
 get lost too. It can't be the network-connection, because the tests run
with
 standalone PHP-clients on the same machine.

 Is there any possibility to make fast writes without waiting after each
 write? The wait limits the server to max. 10 writes per second, wich isn't
 really enaugh for a good chatserver.

 Thanks for your help!

 Thomas 'Neo' Weber
 ---
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]

 -- 
 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] socket_write eats data - solved

2003-09-13 Thread Thomas Weber

No, it's TCP and a very uncomplicated protocol, everything is sent in clear
text. Major problem is the socket-multicasting to keep track of all clients
simultanly.

- Original Message - 
From: Raditha Dissanayake [EMAIL PROTECTED]
To: Thomas Weber [EMAIL PROTECTED]; PHP-List
[EMAIL PROTECTED]
Sent: Sunday, September 14, 2003 2:59 AM
Subject: Re: [PHP] socket_write eats data - solved


 Is IRC UDP?
 Thomas Weber wrote:

 Hi,
 
 i've checked a hundred things before posting this question, but i forgot
the
 most important thing, the buffer.
 The 'eaten' writes were buffered by the network-kernel and sent as bunch
of
 data. If too much data for the buffer is sent, the write is broken up and
 completed in the next bunch-of-data.
 My receive-script hasn't diplayed the raw output, but an unserialized
array,
 fetched out of the received string.
 
 Maybe this will will help someone in future.
 
 Thomas 'Neo' Weber
 ---
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]
 
 - Original Message - 
 From: Thomas Weber [EMAIL PROTECTED]
 To: PHP-List [EMAIL PROTECTED]
 Sent: Saturday, September 13, 2003 9:15 PM
 Subject: [PHP] socket_write eats data
 
 
 
 
 Hi,
 
 I am deveoping a chatserver in IRC-style in PHP. For communication it
uses
 socket-multiplexing aka socket_select. So long so good, works perfectly.
 The problem is, than when i make several socket_write's to the same
client
 without waiting about 0.1sec after each write, the written data gets
lost
 somewhere. socket_write does NOT throw any error, the data seams just
 sended, but the clients never receives it.
 
 Small example of the used code:
 -
 var $clients // array of 'client'-objects, each object has it's own
 socket-descriptor in the object-variable $socket
 
 function write_to_clients ($text) {
   for ($i = 0; $i  count ($this-clients); $i++) {
 socket_write ($this-clients[$i]-socket, $text);
   }
   // usleep (1); if this is uncommented, all write are received by
all
 clients
 }
 
 for ($i = 0; $i  10; $i++) {
 $this-write_to_clients (test .$i);
 }
 -
 
 Okay, this doesn't check the client-sockets for readiness to write, but
 
 
 even
 
 
 if I check (via socket_select), ALL clients are ready to write and
writes
 get lost too. It can't be the network-connection, because the tests run
 
 
 with
 
 
 standalone PHP-clients on the same machine.
 
 Is there any possibility to make fast writes without waiting after each
 write? The wait limits the server to max. 10 writes per second, wich
isn't
 really enaugh for a good chatserver.
 
 Thanks for your help!
 
 Thomas 'Neo' Weber
 ---
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
 
 


 -- 
 http://www.radinks.com/upload
 Drag and Drop File Uploader.

 -- 
 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] socket_write eats data - solved

2003-09-14 Thread Thomas Weber
IMAP? We were talking about IRC, the Internet Relay Chat.
In detail, my problems doesn't even refer to IRC directly, as i am
developing a server for a html-based webchat, but the server-structure and
the messages are nearly the same.
Once you realize the basics of socket-multicasting, it is no problem to
maintain hundreds of simultanous TCP-connects via arrays of sockets, also
called descriptor-sets. PHP seems to directly use the underlying C-
libraries, so everything you can imagine is possible.
Anyway, the major drawback of PHP in this case is speed. Currently i can
send about seven messages per second (one send means socket-connect of a
input client, some simple processing of the message and sending it to all
connected listening clients) with a dozen listening clients, but only about
three messages per second with two hundred listening clients. As C-written
IRC-servers sometimes have thousands of connected clients, i can only
imagine that it is PHP which has some not so efficent array- or
resource-handling.

Thomas 'Neo' Weber
---
[EMAIL PROTECTED]
[EMAIL PROTECTED]

- Original Message - 
From: Raditha Dissanayake [EMAIL PROTECTED]
Cc: PHP-List [EMAIL PROTECTED]
Sent: Sunday, September 14, 2003 7:26 AM
Subject: Re: [PHP] socket_write eats data - solved


 Wouldn't this multiple connections be a problem for php? IMHO one of the
 main draw backs of the PHP IMAP library is the fact that you have to
 open and close and imap connection for each page. That issue is
 multiplied ten fold in this scenario isn't it?


 Thomas Weber wrote:

 No, it's TCP and a very uncomplicated protocol, everything is sent in
clear
 text. Major problem is the socket-multicasting to keep track of all
clients
 simultanly.
 
 - Original Message - 
 From: Raditha Dissanayake [EMAIL PROTECTED]
 To: Thomas Weber [EMAIL PROTECTED]; PHP-List
 [EMAIL PROTECTED]
 Sent: Sunday, September 14, 2003 2:59 AM
 Subject: Re: [PHP] socket_write eats data - solved
 
 
 
 
 Is IRC UDP?
 Thomas Weber wrote:
 
 
 
 Hi,
 
 i've checked a hundred things before posting this question, but i
forgot
 
 
 the
 
 
 most important thing, the buffer.
 The 'eaten' writes were buffered by the network-kernel and sent as
bunch
 
 
 of
 
 
 data. If too much data for the buffer is sent, the write is broken up
and
 completed in the next bunch-of-data.
 My receive-script hasn't diplayed the raw output, but an unserialized
 
 
 array,
 
 
 fetched out of the received string.
 
 Maybe this will will help someone in future.
 
 Thomas 'Neo' Weber
 ---
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]
 
 - Original Message - 
 From: Thomas Weber [EMAIL PROTECTED]
 To: PHP-List [EMAIL PROTECTED]
 Sent: Saturday, September 13, 2003 9:15 PM
 Subject: [PHP] socket_write eats data
 
 
 
 
 
 
 Hi,
 
 I am deveoping a chatserver in IRC-style in PHP. For communication it
 
 
 uses
 
 
 socket-multiplexing aka socket_select. So long so good, works
perfectly.
 The problem is, than when i make several socket_write's to the same
 
 
 client
 
 
 without waiting about 0.1sec after each write, the written data gets
 
 
 lost
 
 
 somewhere. socket_write does NOT throw any error, the data seams just
 sended, but the clients never receives it.
 
 Small example of the used code:
 -
 var $clients // array of 'client'-objects, each object has it's own
 socket-descriptor in the object-variable $socket
 
 function write_to_clients ($text) {
  for ($i = 0; $i  count ($this-clients); $i++) {
socket_write ($this-clients[$i]-socket, $text);
  }
  // usleep (1); if this is uncommented, all write are received by
 
 
 all
 
 
 clients
 }
 
 for ($i = 0; $i  10; $i++) {
$this-write_to_clients (test .$i);
 }
 -
 
 Okay, this doesn't check the client-sockets for readiness to write,
but
 
 
 
 
 even
 
 
 
 
 if I check (via socket_select), ALL clients are ready to write and
 
 
 writes
 
 
 get lost too. It can't be the network-connection, because the tests
run
 
 
 
 
 with
 
 
 
 
 standalone PHP-clients on the same machine.
 
 Is there any possibility to make fast writes without waiting after
each
 write? The wait limits the server to max. 10 writes per second, wich
 
 
 isn't
 
 
 really enaugh for a good chatserver.
 
 Thanks for your help!
 
 Thomas 'Neo' Weber
 ---
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
 
 
 
 
 -- 
 http://www.radinks.com/upload
 Drag and Drop File Uploader.
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
 
 


 -- 
 http://www.radinks.com/upload
 Drag and Drop File Uploader.

 -- 
 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] List of Variables

2003-06-27 Thread Thomas Weber
Hi,

is there any way to get a list of all defined variables?
It is intended to be used to get and identify all defined objects to call
some costum decunstructor at the scripts end.

Thanks!
Thomas 'Neo' Weber
---
[EMAIL PROTECTED]
[EMAIL PROTECTED]

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



Re: [PHP] List of Variables

2003-06-27 Thread Thomas Weber
Yea thanks, we must have been blind when searching the php-docs ;)

Thomas 'Neo' Weber
---
[EMAIL PROTECTED]
[EMAIL PROTECTED]

- Original Message - 
From: Adam Voigt [EMAIL PROTECTED]
To: Thomas Weber [EMAIL PROTECTED]
Cc: PHP-List [EMAIL PROTECTED]
Sent: Friday, June 27, 2003 3:09 PM
Subject: Re: [PHP] List of Variables


 print_r(get_defined_vars());


 On Fri, 2003-06-27 at 09:07, Thomas Weber wrote:
  Hi,
 
  is there any way to get a list of all defined variables?
  It is intended to be used to get and identify all defined objects to
call
  some costum decunstructor at the scripts end.
 
  Thanks!
  Thomas 'Neo' Weber
  ---
  [EMAIL PROTECTED]
 [EMAIL PROTECTED]
 -- 
 Adam Voigt ([EMAIL PROTECTED])
 Linux/Unix Network Administrator
 The Cryptocomm Group


 -- 
 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] Close Connection to Browser

2003-06-29 Thread Thomas Weber
Hi,

is it possible to close the connection to the client/browser without calling
exit?
I have an input-script for a chat-system, wich gives a Status 204 No Content
to the client after submit, wich works great. The problem is, that sometimes
the script needs some time to finish after sending the 204 and keeps the
connection over this time, wich couses Internet Explorer and sometimes even
Mozilla to crash if too much connections to the script are active.

Thanks,
Thomas 'Neo' Weber
---
[EMAIL PROTECTED]
[EMAIL PROTECTED]


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



Re: [PHP] Chat with php

2002-10-08 Thread Thomas Weber

I've thought about adding the text on the top, but never found a good way to
make that (not with plain HTML, it would require a java-applet to display
the stream).
Scrolling is quite simple, i use this:

head
  SCRIPT language=JavaScript
  !--
   doscroll = true;
   function Scroller() {
   if (doscroll != false) {
   window.scrollBy(0,15);
 }
 window.setTimeout(Scroller(),15)
   }
   Scroller();
   parent.atok = 'CCOFs';
   function atok(p1) {
   parent.atok = p1;
   }
  //--
  /SCRIPT
 /head
 body onFocus=doscroll=false onBlur=doscroll=true
onMouseOver=doscroll=false onMouseOut=doscroll=true
...

It scrolls down whenever the mouse is outside the frame with the stream.

Cya,
Thomas 'Neo' Weber
---
[EMAIL PROTECTED]
[EMAIL PROTECTED]


- Original Message -
From: Oliver Witt [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; Thomas Weber [EMAIL PROTECTED]
Sent: Tuesday, October 08, 2002 10:51 AM
Subject: Re: [PHP] Chat with php


 Hey cool,
 That's working. The only problem I have now is that I want the most recent
text
 at the top. But that script adds it on the bottom. Any way to change that?
At
 least a way to always scroll automatically to the bottom?
 Cya,
 Olli


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




[PHP] Array Searching

2002-11-15 Thread Thomas Weber
Hi,

i have an array like:

Array
(
[1] = Array
(
[alias] = foo
...
)
[2] = Array
(
[alias] = bar
...
)
...
)

I need some way to find out, if an alias foo is in the array. Any idea how
to do this?

Thanks,
Thomas 'Neo' Weber
---
[EMAIL PROTECTED]
[EMAIL PROTECTED]


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




[PHP] fork and childs

2003-09-30 Thread Thomas Weber
Hi,

I'm writing a network-server in PHP, using pcntl_fork() to fork childs
(errr... jep).
My problem is, than when i shutdown the parent-process, all childs are
killed automatically.
Does anyone know a way to avoid this behaviour?

Thanks,
Thomas 'Neo' Weber
---
[EMAIL PROTECTED]
[EMAIL PROTECTED]

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



[PHP] socket_select() hangs sometimes; Bug?

2003-11-24 Thread Thomas Weber
Hi folks,

I am battling around with socket_select() for some months now and still have
an unsolved problem with random hanging.

PHP: 4.3.4 with -sockets, -sigchild, -pcntl and some other things
OS: FreeBSD 5.0 (same problem with 4.8 and 5.1)

In simple words, I have a server-daemon (runs with PHP4.3.4 now) wich uses
socket_select() for accepting new connections and dealing with existing
ones. It is an IRC-like chatserver talking with PHP-script running on a
webserver on _the same_ machine, same IP, long connects for output, short
connects for input. For debugging I use normal TCP-sockets, not
unix-domain-sockets. The select runs on all connected sockets for read and
error, write is untouched.
In testing-enviroment everything works perfect, but in production-eviroment
the server hangs after some time.

Some facts:
- in testing, even 32.000 fast connects (made synchronous with 16 processes)
couldn't get the server to hang, in production it hangs after about 3000 -
7000 connects, regardless of low CPU-load
- debug-outputs to console before and after the select show clearly the
socket_select() is hanging
- tried both blocking and non-blocking select, same effect in both cases
- both test and production are on the same machine, same PHP
- both are getting only local connects from other PHP-scripts
- socket-dumps before the select show all sockets in normal state, even if
directly before a hang
- select hangs sometimes with about 80 synchronous connections, sometimes
with only about 20

I thought it might be a bug in PHPs socket-extension, because the hangups
come random, indipendent of number of synchronous connects, number of
processed connects, id of hightest socket-descriptor, used CPU-time.
Maybe i just forgot something, but it doesn't go into my head why it hangs
exactly during the select :-/

The code should be okay, it is basically indentical to an example posted
some time ago in the php-dev-mailinglist (i've pasted it below).

#!/usr/local/bin/php -q
?php

set_time_limit(0);


// defaults...

define('MAXLINE', 1024);// how much to read from a socket at a time
define('LISTENQ', 10);  // listening queue
define('PORT', 1);  // the default port to run on
define('FD_SETSIZE', 5);// file descriptor set size (max number of
concurrent clients)...


// for kill the biatch...

function killDaemon()
{
global $listenfd, $client;

socket_close($listenfd);
$msg = Daemon going down!\n;
for ($i = 0; $i  FD_SETSIZE; $i++)
{
if ($client[$i] != null)
{
socket_write($client[$i], $msg, strlen($msg));
socket_close($client[$i]);
}
}

print Shutting down the daemon\n;
exit;
}


// whenever a client disconnects...

function closeClient($i)
{
global $client, $remote_host, $remote_port;

print closing client[$i] ({$remote_host[$i]}:{$remote_port[$i]})\n;

socket_close($client[$i]);
$client[$i] = null;
unset($remote_host[$i]);
unset($remote_port[$i]);
}


// set up the file descriptors and sockets...

// $listenfd only listens for a connection, it doesn't handle anything
// but initial connections, after which the $client array takes over...

$listenfd = socket_create(AF_INET, SOCK_STREAM, 0);
if ($listenfd)
print Listening on port  . PORT . \n;
else
die(AIEE -- socket died!\n);

socket_setopt($listenfd, SOL_SOCKET, SO_REUSEADDR, 1);
if (!socket_bind($listenfd, 0.0.0.0, PORT))
{
socket_close($listenfd);
die(AIEE -- Couldn't bind!\n);
}
socket_listen($listenfd, LISTENQ);


// set up our clients. After listenfd receives a connection,
// the connection is handed off to a $client[]. $maxi is the
// set to the highest client being used, which is somewhat
// unnecessary, but it saves us from checking each and every client
// if only, say, the first two are being used.

$maxi = -1;
for ($i = 0; $i  FD_SETSIZE; $i++)
$client[$i] = null;


// the main loop.

while(1)
{
$rfds[0] = $listenfd;

for ($i = 0; $i  FD_SETSIZE; $i++)
{
if ($client[$i] != null)
$rfds[$i + 1] = $client[$i];
}


// block indefinitely until we receive a connection...

$nready = socket_select($rfds, $null, $null, null);


// if we have a new connection, stick it in the $client array,

if (in_array($listenfd, $rfds))
{
print listenfd heard something, setting up new client\n;

for ($i = 0; $i  FD_SETSIZE; $i++)
{
if ($client[$i] == null)
{
$client[$i] = socket_accept($listenfd);
socket_setopt($client[$i], SOL_SOCKET, SO_REUSEADDR, 1);
socket_getpeername($client[$i], $remote_host[$i],
$remote_port[$i]);
print Accepted {$remote_host[$i]}:{$remote_port[$i]} as
client[$i]\n;
break;
}

if ($i == FD_SETSIZE - 1)
{
trigger_error(too many clients, E_USER_ERROR);
exit;

[PHP] Memory-Size of Objects

2004-04-21 Thread Thomas Weber
Hi,

does anybody know a way to get the memory-size of an object?

I'm triing to seek some memory-leaks in a php-daemon-program wich cannot be
reproduced easily to track them down, so i thought to monitor the size of
the objects while running in a production-enviroment.

Thanks!
Thomas 'Neo' Weber
---
[EMAIL PROTECTED]
[EMAIL PROTECTED]

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