php-general Digest 20 Nov 2004 23:47:39 -0000 Issue 3124

Topics (messages 202556 through 202579):

Is it a good idea?
        202556 by: Bruno B B Magalh�es

images process
        202557 by: edwardspl.ita.org.mo
        202560 by: Raditha Dissanayake

$_POST and multiple windows
        202558 by: Rory McKinley
        202561 by: Jason Wong

Re: Warning: Unknown list entry type in request shutdown (0) in Unknown on line 0
        202559 by: Raditha Dissanayake

fo2pdf problem
        202562 by: markus ecker

Re: Sequrity without HTTPS?
        202563 by: fabien champel

Where to learn about these topics
        202564 by: Chris Lott

PHP script + read file
        202565 by: Jerry Swanson
        202567 by: Jon-EIrik Pettersen
        202568 by: Gerhard Meier
        202569 by: Jason Wong

Validating XML Schema
        202566 by: Mario Bittencourt

Re: ending a session
        202570 by: Jed Smith
        202576 by: Greg Donald
        202577 by: Jeffery Fernandez

Re: I am new - Having problems displaying something
        202571 by: Brian Heibert

Class for determining word count, ignoring HTML?
        202572 by: Murray . PlanetThoughtful
        202573 by: M. Sokolewicz
        202574 by: Greg Donald

Re: MySQLDiff 0.1, program to output diffs between MySQL tables
        202575 by: Rajesh Kumar

Re: Is Perl faster than PHP?
        202578 by: Curt Zirzow

Re: Limit to the number of sockets socket_select can supervise?
        202579 by: Jed Smith

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:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
Hi guys,

In my framework I have some classes that depends from others (like authentication depends of database)... So I wrote is method inside the framework class, and I would like to know if is it an intelligent solution or not:

class dependent
{
        function dependent (&$framework)
        {
                $independent =& $framework->load_core_class('independent');
        }
}

AND THE LOADING METHOD:

function load_core_class($class='')
{
        if(!class_exists($class))
        {
                if(file_exists($this->core_dir.$class.'.class.php'))
                {
                        include_once($this->core_dir.$class.'.class.php');
                        return $this->core->$class =& new $class($this);
                }
                else
                {
                        return false;
                }
        }
        elseif(!isset($this->core->$class))
        {
                return $this->core->$class =& new $class($this);
        }
        else
        {
                return $this->core->$class;
        }
}

Best regards to you all,
Bruno B B Magalhaes

--- End Message ---
--- Begin Message ---
Dear You,

How to load images ( eg: gif, jpg....) with base64 function from
Database on IE directly ?
Is there any samples to me for reference ?

Many thank for your help !

Ed.

--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:

>Dear You,
>
>How to load images ( eg: gif, jpg....) with base64 function from
>Database on IE directly ?
>  
>
as far as I know you cannot do this with IE directly.

>Is there any samples to me for reference ?
>
>Many thank for your help !
>
>Ed.
>
>  
>

--- End Message ---
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello List

Currently I am building an app that will have a navigation app that will
allow users to open multiple windows (every time they click on a link it
will open a new window) while the navigation window remains unchanged
(for the purpose of this question).

Therefore it will be possible for the user to work on more than one item
~ of functionality at the same time (e.g. he can have one window that he
is using to update client details and another that he uses to query
product details). All the persistent info is shared in session variables
and the session is cookies-based.

One of these session variables is an object that stores all login, and
user-permission related data. This object is accessed by each window
that is opened from the app control panel. Most of the windows will rely
on $_POST data which will be used for input to a DB.

My question is about the $_POST superglobal. I assume that there will be
only one instance of this superglobal per session and not per open
window (i.e. if I have three windows open, each running a different
module within the same app independent of one another, there is only a
single structure for storing their post data). Hence, if I have fields
in multiple windows that have a common name (e.g. I have two modules,
each of which requires a field called client name) posts from different
windows will overwrite the last post of a field with that common name,
regardless which window it came from.

E.g. doc1.php has a field called client_name
User enters "client1" and hits submit.
$_POST['client_name'] = "client1"
doc2.php also has a field called client_name
User enters "client2" and hits submit.
$_POST['client_name'] = "client2"

And now (finally) my question:

Let us assume that in the above example,  I renamed the field names so
that they weren't common :

doc1.php has a field called client_name1
doc2.php has a field called client_name2

When the submit button is hit in doc1.php the action page is doc1next.php
When the submit button is hit in doc2.php the action page is doc2next.php

In my scenario the user first clicks submit on doc1.php and then clicks
submit on doc2.php before doc1next.php is finished (i.e it still needs
to access the values posted from doc1next.php).

Will $_POST still contain both client_name1 and client_name2 or will the
$_POST array be emptied when submit is clicked in doc2.php - meaning
that the only field available is client_name2.

I have a sneaking suspicion that it is the latter but I am hoping that
someone will be able to tel me definitively.

Apologies for the looong email - I just wanted to make sure that my
problem was properly defined.



- --
Rory McKinley
Nebula Solutions
+27 21 555 3227 - office
+27 21 551 0676 - fax
+27 82 857 2391 - mobile
www.nebula.co.za
====================
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32)

iD8DBQFBn0BwpslJtahJIvMRArUnAKDavfdYBIYTpzxCPZJAKsM4gI4shACfX63M
ay1ZEuEa20c3eKSKkonSdFw=
=N6A5
-----END PGP SIGNATURE-----

--- End Message ---
--- Begin Message ---
On Saturday 20 November 2004 21:02, Rory McKinley wrote:

> My question is about the $_POST superglobal. I assume that there will be
> only one instance of this superglobal per session and not per open
> window 

You would in fact get a version of $_POST for *each* _request_. Request 
meaning each time a form is submitted.

> (i.e. if I have three windows open, each running a different 
> module within the same app independent of one another, there is only a
> single structure for storing their post data).

PHP has no notion of what your application consists of. When you submit a form 
PHP has no idea whether it came from window1 or window2 or wherever.

> Hence, if I have fields 
> in multiple windows that have a common name (e.g. I have two modules,
> each of which requires a field called client name) posts from different
> windows will overwrite the last post of a field with that common name,
> regardless which window it came from.

Even if you submit the same form twice in rapid succession nothing will get 
overwritten. Each request (submission) starts a new instance of php with it 
own copy of the form data.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
What about WRITING it first and rationalizing it afterwords?  :-)
             -- Larry Wall in <[EMAIL PROTECTED]>
*/

--- End Message ---
--- Begin Message ---
Manoj Kumar wrote:

Hi folks ,

What is the case of following warning ...
Warning: Unknown list entry type in request shutdown (0) in Unknown on
line 0





unknown


-- Manoj Kr. Sheoran www.daffodildb.com <BLOCKED::http://www.daffodildb.com>







--- End Message ---
--- Begin Message ---
Hi all!!

i tried really hard to install fo2pdf on my machine but somehow it simply 
doesnt work. i can successfully create a new java instance in php, but then 
i get the following error

Internal Server Error
The server encountered an internal error or misconfiguration and was unable 
to complete your request...............


__In my apache log there is this entry:
[Sat Nov 20 14:05:44 2004] [error] [client 127.0.0.1] malformed header from 
script. Bad header=[INFO] Using org.apache.xerces: c:/appserv/php/php.exe


Using: Apache/1.3.29 (CGI Versioin), PHP/4.3.4
Java: j2sdk1.4.2_06

The modules required by fo2pdf are in the ext directory of my java.

It would be really great if someone could help me to fix this problem.

Thanks everybody 4 help!!!
greets
Markus

--- End Message ---
--- Begin Message ---
update ;)

also support non-javascript browser






<?php
session_start();
if ( function_exists("session_regenerate_id") ) session_regenerate_id();

// pour les tests, sinon, a recuperer dans la base
$lepass = md5("1234");
$lelogin = "login";

$l = &$_GET["login"];
$p = &$_GET["pass"];

if ( isset($l) && $l==$lelogin && isset($p) &&
isset($_SESSION["graindesel"]) && ($p ==
md5($lepass.$_SESSION["graindesel"]) || md5($p)==$lepass) ){
        $logged = true;
        unset($_SESSION["graindesel"]);
} else {
        srand(time());
        $grain = sha1( rand() );
        $_SESSION["graindesel"] = $grain;
        $logged = false;
}


echo '<?xml version="1.0" encoding="iso-8859-1"?">';
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
<title>auth md5</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<?php  if ( !$logged ) { ?>
<script type="text/javascript" src="md5.js"></script>
<script type="text/javascript">
<!--
function goForm(){
        motdepasse = document.formul.pass.value;
        md5 = hex_md5(hex_md5(motdepasse)+"<?php echo $grain; ?>");
        document.formul.pass.value = md5;
        document.formul.action = "<?php echo $_SERVER["PHP_SELF"]; ?>";
        document.formul.submit();
}
-->
</script>
<?php } ?>
</head>
<body>


<?php  if ( !$logged ) { ?>

<form method="GET" action="<?php echo $_SERVER["PHP_SELF"]; ?>" name="formul">
<input type="text" name="login" id="login" /><br />
<input type="password" name="pass" id="pass" /><br />
<input type="submit" value="envoyer" />
</form>
<script type="text/javascript">
<!--
document.formul.action = "javascript:goForm()";
-->
</script>

<?php } else { ?>
ok ;)
<?php } ?>
</body>
</html>


it's not as secure as https, but it's better than without it.

what do you think about it ?

--- End Message ---
--- Begin Message ---
Where can I learn topics such as:

1) Examples of complex PHP applications entering data into complex
related table structures. For instance, if I am writing an application
to create a class catalog that has 5 related tables, how do I handle
the workflow when the data in related tables doesn't yet exist? Do I
force a user to enter data into 5 different forms first? Do I have a
place to enter the new data on the main form? Do I create temporary
records as part of a step-by-step process?

2) Complex display with database results-- particularly when working
with many joined tables, displaying results effectively for reporting
(show me all departments, within that all classes, within that who is
teaching, sorted by department). The queries aren't hard, but if
optimized into one big query the constructs for displaying seem to get
ugly. For instance, given a query that gives me these results as
$result (joined together from three tables):

+---------+----------+----------+-----------+-------+
| first   | last     | relation | city      | state |
+---------+----------+----------+-----------+-------+
| Chris   | Beks     | business | Fairbanks | AK    |
| Robert  | Hannon   | friend   | Fairbanks | AK    |
| Cindy   | Lott     | family   | Fresno    | CA    |
| Derryl  | Hartz    | business | Seattle   | WA    |
| Kirsten | O'Malley | friend   | Seattle   | WA    |
+---------+----------+----------+-----------+-------+

It seems like there must be a more efficient way to get a listing of
each city and who lives there than:


$currentcity = '';
$counter = 1;

while ($thisrow = mysql_fetch_array($result))
        {
        if ($currentcity <> $thisrow['city'])
                {
                if ($counter > 1)
                        {
                        echo '</blockquote>';
                        }
                echo '<h1>' . $thisrow['city'] . '</h1>';
                echo '<blockquote>';
                $currentcity = $thisrow['city'];
                }
        echo $thisrow['first'] . ' ' . $thisrow['last'] . '<br />';
        $counter++;
        }

Although this is preferable to running separate queries:

$query = 'select lid, city, state from locations order by city, state';

$result = mysql_query($query) or die('Couldn\'t perform the query: ' . $query); 

while ($thisrow = mysql_fetch_array($result))
        {
        echo '<h1>' . $thisrow['city'] . ', ' . $thisrow['state'] . '</h1>';
        echo '<blockquote>';
        $pquery = "select first, last from people where lid =
{$thisrow['lid']} order by last, first";
        $presult = mysql_query($pquery) or die('Couldn\'t perform the query:
' . $query);
        while ($prow = mysql_fetch_array($presult))
                {
                echo $prow['first'] . ' ' . $prow['last'] . '<br />';
                }
        echo '</blockquote>';
        }

c

--- End Message ---
--- Begin Message ---
I know how to read a file. But the problem is different, I have
directory that has more than 250 files. I need to read each file and
process it. But How I know what file to read?
ls -l (show all files). How I can select each file without knowing
name? The file will be process and than delete.

Any ideas?

--- End Message ---
--- Begin Message ---
Jerry Swanson wrote:

I know how to read a file. But the problem is different, I have
directory that has more than 250 files. I need to read each file and
process it. But How I know what file to read?
ls -l (show all files). How I can select each file without knowing
name? The file will be process and than delete.

Any ideas?



Something like this?

$dp = opendir('dirname');
while ($file = readdir($dp)) {
 // Process file, filename $file
}
closedir($dp);

--- End Message ---
--- Begin Message ---
On Sat, Nov 20, 2004 at 09:11:41PM +0000, Jerry Swanson wrote:
> I know how to read a file. But the problem is different, I have
> directory that has more than 250 files. I need to read each file and
> process it. But How I know what file to read?
> ls -l (show all files). How I can select each file without knowing
> name? The file will be process and than delete.

Look at http://www.php.net/manual/en/function.opendir.php

/GM

--- End Message ---
--- Begin Message ---
On Sunday 21 November 2004 05:11, Jerry Swanson wrote:
> I know how to read a file. But the problem is different, I have
> directory that has more than 250 files. I need to read each file and
> process it. But How I know what file to read?
> ls -l (show all files). How I can select each file without knowing
> name? The file will be process and than delete.

To get list of files from directory:
  manual > Directory Functions

To open/read/write/delete files:
  manual > Filesystem Functions

There are plenty of examples in the manual and in the user notes of the online 
manual.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Do not try to solve all life's problems at once -- learn to dread each
day as it comes.
  -- Donald Kaul
*/

--- End Message ---
--- Begin Message ---
Hi,

I am trying to use php to validate a document using it's schema.

I keep getting Warning: Element 'Invoices': No matching global
declaration available.

My xsd has

<?xml version="1.0" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
targetNamespace="http://www.mysite.com";
xmlns="http://www.mysite.com"; elementFormDefault="qualified">
<xs:element name="Invoices" type="InvoicesType"/>
<xs:complexType name="InvoicesType">
                <xs:element name="Invoice" type="xs:string"/>
</xs:complexType>
</xs:schema>

The xml test

<?xml version="1.0" ?>
<Invoices>
        <Invoice>10</Invoice>
</Invoices>

The php

$xml = new DOMDocument();
$xml->load( 'invoice.xml' );
if ($xml->schemaValidate("invoice.xsd"))
{
     echo "Validated OK" ;
} else 
{
     echo "Validate FAILED";
}

--- End Message ---
--- Begin Message --- Hans J.J. Prins wrote:
3. Is it the same copy of PHP? Same php.ini, same PHP SAPI?

I really don't know I would have to find out later.

PHP attached to different Apaches can't share sessions, AFAIK. You'll need to make sure it's the same copy of Apache, listening on both ports, and that there's not a different configuration for each. Otherwise your application might need a redesign to accommodate the difference in ports. Your own, custom session handlers aren't that difficult to implement, if I recall (been a while :^)).


That's the best advice I can give without further information.

4. Same Apache?

How do I find out?

Ask your sysadmin.

5. What's your Listen directive look like, if YES for number 4?

Sorry, don't know what you mean by that.

It's in httpd.conf or friends, whatever your particular instance of Apache uses. I suggest having a glance over the Apache manual and having a chat with your sysadmin.


Good luck.

--
     _
    (_)___    Jed Smith, Code Ninja
    | / __|   RFBs: [email for info]
    | \__ \   +1 (541) 606-4145
   _/ |___/   [EMAIL PROTECTED] (Signed mail preferred: PGP 0x703F9124)
  |__/        http://personal.jed.bz/keys/jedsmith.asc

--- End Message ---
--- Begin Message ---
On Sat, 20 Nov 2004 13:52:32 -0800, Jed Smith <[EMAIL PROTECTED]> wrote:
> PHP attached to different Apaches can't share sessions, AFAIK. You'll
> need to make sure it's the same copy of Apache, listening on both ports

The simplest solution is to use database managed PHP sessions, passing
the session id in the url.  As long as you connect to the same
database, your PHP session will follow you wherever your scripts live.

Someone probably has something better, but here's mine:
http://destiney.com/pub/php_db_sessions.tar.gz


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

--- End Message ---
--- Begin Message ---
Greg Donald wrote:

On Sat, 20 Nov 2004 13:52:32 -0800, Jed Smith <[EMAIL PROTECTED]> wrote:


PHP attached to different Apaches can't share sessions, AFAIK. You'll
need to make sure it's the same copy of Apache, listening on both ports



The simplest solution is to use database managed PHP sessions, passing the session id in the url. As long as you connect to the same database, your PHP session will follow you wherever your scripts live.

Someone probably has something better, but here's mine:
http://destiney.com/pub/php_db_sessions.tar.gz




Nice tutorial here: http://www.zend.com/zend/spotlight/code-gallery-wade8.php?article=code-gallery-wade8&id=4467&open=1&anc=0&view=1

cheers,
Jeffery

--- End Message ---
--- Begin Message ---
I am still having trouble all it does is says Current Song: then it is blank
------ Forwarded Message
From: Brian Heibert <[EMAIL PROTECTED]>
Date: Fri, 19 Nov 2004 17:10:48 -0500
To: <[EMAIL PROTECTED]>
Subject: Re: [PHP] I am new - Having problems displaying something

I tried adding a ip addresss:

<EMBED SRC="http://4.10.69.244/christiantoplist/playing.php"; WIDTH="256"
HEIGHT="256" ALIGN="BOTTOM">

The domain I have christiantoplist.org forwards to
http://4.10.69.244/christiantoplist/index.html

But it still doesn't work
It says: Current Song: and then it's blank

Brian

On 11/19/04 1:17 AM, "Warren Vail" <[EMAIL PROTECTED]> wrote:

> Looks like the URL you are trying to passthru is missing a domain, No?  ;-)
> 
> Warren Vail
> 
>> -----Original Message-----
>> From: Brian Heibert [mailto:[EMAIL PROTECTED]
>> Sent: Thursday, November 18, 2004 9:33 PM
>> To: [EMAIL PROTECTED]
>> Subject: [PHP] I am new - Having problems displaying something
>> 
>> 
>> Hi,
>> 
>> I am new to this list.  I am trying to do a php script that will say what
>> song is currently playing in iTunes/NiceCast Internet Radio broadcaster
>> Onto my website
>> 
>> Every attempt I have made so far has failed
>> 
>> I got a file called playing.php
>> With this text inside it:
>> <?php
>> 
>> echo "Current Song: ".passthru("osascript
>> /Library/WebServer/Documents/christiantoplist/whattrack.scpt");
>> 
>> ?>
>> 
>> 
>> And a file called whattrack.scpt (AppleScript file) with this in it
>> tell application "iTunes"
>> set trk to current track
>> set tle to name of trk
>> set art to artist of trk
>> set albm to album of trk
>>  return tle & " - " & art & ", " & albm
>>  end tell
>> 
>> But it is not displaying what song is playing on my website
>> All it says is Current Song: and then it doesn't say the song
>> 
>> Brian Heibert
>> 
>> PS: I have a iMac G4 800mhz OS 10.3.6 running Apple's webserver system
>> preference which is there version of Apache I think
>> 
>> -- 
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>> 
>> 
>> 

------ End of Forwarded Message

--- End Message ---
--- Begin Message ---
Hi All,

 

Just wondering if anyone knows of a class that can perform a word count of
text in a string that ignores HTML?

 

IE, something that would correctly determine that the following string is 6
words long:

 

"<blockquote>

 

This string is six words long.

 

</blockuote>"

 

If such a beastie exists, I'd very much appreciate being pointed towards it.

 

Much warmth,

 

Murray

 <http://www.planetthoughtful.org/> http://www.planetthoughtful.org

Building a thoughtful planet,

One quirky comment at a time.

 


--- End Message ---
--- Begin Message --- Murray @ Planetthoughtful wrote:
Hi All,



Just wondering if anyone knows of a class that can perform a word count of
text in a string that ignores HTML?



IE, something that would correctly determine that the following string is 6
words long:



"<blockquote>



This string is six words long.



</blockuote>"



If such a beastie exists, I'd very much appreciate being pointed towards it.



Much warmth,



Murray

 <http://www.planetthoughtful.org/> http://www.planetthoughtful.org

Building a thoughtful planet,

One quirky comment at a time.




echo str_word_count(strip_tags($string));
--- End Message ---
--- Begin Message ---
On Sun, 21 Nov 2004 09:10:37 +1000, Murray @ PlanetThoughtful
<[EMAIL PROTECTED]> wrote:
> Hi All,
> 
> Just wondering if anyone knows of a class that can perform a word count of
> text in a string that ignores HTML?
> 
> IE, something that would correctly determine that the following string is 6
> words long:
> 
> "<blockquote>
> 
> This string is six words long.
> 
> </blockuote>"

Use strip_tags() to remove the html, then explode() the string by a
space, then count() the exploded array.


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

--- End Message ---
--- Begin Message ---
Hello PHP Community,

MySQLDiff is a PHP5 command-line utility that prints SQL statements to
sync two MySQL databases or tables.

This program works just like the original MySQLDiff
(http://www.mysqldiff.org/), but is much faster and is useful for
quickly comparing two databases.

The source code may be obtained from a public Subversion repository, and
tested as shown:

$ svn co http://www.svnhosting.org:8000/svn/mysqldiff/trunk mysqldiff
$ cd mysqldiff
$ sudo make install
.. installs to /usr/local/bin/mysqldiff
$ mysqldiff db1 db2
$ mysqldiff --paranoid db1.tbl db2.tbl

MySQLdiff is still alpha and requires heavy testing and
improvements. All required PEAR packages are packaged with MySQLDiff. Copyrights may have been violated with regards to PEAR::Text_Diff. If so, I'm prepared to take necessary action.


Please contact me (off-list) if you're interested in becoming a developer. Please send patches against the HEAD revision by executing `svn up && svn diff'

Bug reports, feature suggestions and help requests welcome.

--
Rajesh Kumar
MySQLDiff Maintainer

--- End Message ---
--- Begin Message ---
* Thus wrote Justin French:
> 
> For what it's worth, PHP5 under FastCGI on a nice server with a good 
> sysadmin is *incredibly* fast.  Shameless plug: TextDrive.com (a 
> hosting company in the US that just hired me) offers exactly that -- 
> blindingly fast PHP5 shared hosting with the works.

Another for what its worth..

php 5.1 is much faster than 4 and 5.0.X look forward to it :)


Curt
-- 
Quoth the Raven, "Nevermore."

--- End Message ---
--- Begin Message ---
Let me attack this. I'm bored.
I'm on Windows XP SP 2, and I'll try this from the command line.

I coded a simple server in PHP that just accepts the connection and listens. It doesn't attempt to send any data, its only select loop is to wait for a new connection attempt. I also wrote a load program. When attempted with 49 sockets (50 on the server), it worked fine, select and all.

        Server: http://labs.jed.bz/HCJ/server.php.txt
        Client: http://labs.jed.bz/HCJ/load.php.txt

However, when I tried 500, odd things happened.
The server (!) died due to Windows XP's DEP, which I removed for cli.exe and retried. It then died again (!) because of "an existing connection [being] forcibly closed".


I then lowered the limit to 70 and tried again. The server accepted 69:

accepted #68 of 70 accepted #69 of 70 .......................

Before I could telnet in to make 70, the client died:

connecting #69 of 69 ... ok waiting for spew Warning: socket_select(): unable to select [0]: An operation was attempted on something that is not a socket. in F:\Projects\HCJ\load.php on line 38 spew! done!

Curious. The problem replicates itself here.
I'm not sure. For the first time with PHP I honestly have no clue where to start attacking this problem. It could be a Windows limitation, but for that to be the case the scripts will have to be run on a UNIX system as well.


I simply don't know. Very strange indeed. It was worth the hour I put into it, because I'm interested -- I've been playing with PHP daemons on Win32 for a while now, and this select limitation concerns me.

I'll submit this as a bug report. Feel free to comment, bug #30852

Jed


Hans-Christian Jehg wrote:
Hi

Im building a TCP server in PHP 5.0.2 on Windows. It will have to serve a lot of clients (500+) with low traffic.

During this I have noticed that socket_select seems unable to supervise more than 64 connections at a time (Not good when I need 500+). It stops with a message that

"Socket select failed, error code is: 10038, error message is: An operation was at tempted on something that is not a socket."

These are the outputs of socket_last_error() and socket_strerror(socket_last_error()).

And now forthe questions:

Does any of you have the same experience?

Is it something to do with Windows? Does this limitation exist on Linux?

Is it just a bug?

Any good suggestions?

Best regards
and thanx in advance

HC


--
     _
    (_)___    Jed Smith, Code Ninja
    | / __|   RFBs: [email for info]
    | \__ \   +1 (541) 606-4145
   _/ |___/   [EMAIL PROTECTED] (Signed mail preferred: PGP 0x703F9124)
  |__/        http://personal.jed.bz/keys/jedsmith.asc

--- End Message ---

Reply via email to