php-general Digest 14 Sep 2010 10:12:09 -0000 Issue 6940

Topics (messages 308035 through 308059):

Re: 1984 (Big Brother)
        308035 by: chris h
        308037 by: Daevid Vincent
        308042 by: Micky Hulse
        308045 by: Daniel Brown
        308048 by: Micky Hulse
        308049 by: Andy McKenzie
        308055 by: viraj
        308056 by: viraj
        308057 by: Gary
        308059 by: Richard Quadling

Re: [!! SPAM]  Re: [PHP] 1984 (Big Brother)
        308036 by: Tim Thorburn
        308044 by: Phpster

Question about news.php.net
        308038 by: MikeB
        308041 by: Daniel Brown
        308043 by: MikeB
        308046 by: Daniel Brown
        308047 by: Shawn McKenzie
        308050 by: MikeB

Could this be a bug?
        308039 by: Camilo Sperberg
        308040 by: Tamara Temple
        308051 by: Camilo Sperberg
        308052 by: Camilo Sperberg
        308053 by: Thijs Lensselink
        308054 by: Thijs Lensselink

Re: php cli question
        308058 by: Per Jessen

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

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


----------------------------------------------------------------------
--- Begin Message ---
On Mon, Sep 13, 2010 at 5:09 PM, Daevid Vincent <dae...@daevid.com> wrote:

>
>
> > -----Original Message-----
> > From: tedd [mailto:t...@sperling.com]
> > Sent: Sunday, September 12, 2010 9:32 AM
> > To: PHP-General list
> > Subject: [PHP] 1984 (Big Brother)
> >
> > Hi gang:
> >
> > I have a client who wants his employees' access to their online
> > business database restricted to only times when he is logged on.
> > (Don't ask why)
> >
> > In other words, when the boss is not logged on, then his employees
> > cannot access the business database in any fashion whatsoever
> > including checking to see if the boss is logged on, or not. No access
> > whatsoever!
> >
> > Normally, I would just set up a field in the database and have that
> > set to "yes" or "no" as to if the employees could access the
> > database, or not. But in this case, the boss does not want even that
> > type of access to the database permitted. Repeat -- No access
> > whatsoever!
> >
> > I was thinking of the boss' script writing to a file that
> > accomplished the "yes" or "no" thing, but if the boss did not log off
> > properly then the file would remain in the "yes" state allowing
> > employees undesired access. That would not be acceptable.
> >
> > So, what methods would you suggest?
> >
> > Cheers,
> >
> > tedd
>
> You sure know how to pick'em Tedd.
>
> This is the second "whacky" client you've posted about on the list...
>
> This guy sounds like a real control-freak (read: tool).
>
> One other thing I'll throw out is the use of a crontab to start/stop mysql
> during "boss's hours". I don't have a complete solution for you as I just
> don't care enough about helping this Dbag lord over his employees like
> that, but I suspect you could have "/etc/init.d/mysql start" or "stop" at
> some pre-determined times like 8am - noon. Then noon till 5pm. Or
> something.
>
> RDBMS are not really designed to be turned on and off like that.
>
> Another option is to maybe use M$ Access instead (which does have a
> multi-user mode). Use ODBC to connect via PHP to it. So then he would start
> up the DB when he likes and shut it down when he likes. (note that a logout
> of Windows will NOT prevent the ODBC connection as it is a service -- as
> God intended RDBMS to be)
> http://www.configure-all.com/php_access.php
>
> This guy is making me angry just thinking about it!
>
> d
>
>

Yes I've been following this post purely in the hope that someone gets Tedd
is explain the client's "logic" on this one.  It's one thing for a layman to
have this kind of requirement, but another entirely for them to STILL have
it after an explanation.  I mean part of consulting is to tell the client
when they're wrong, for someone to not heed that when they are paying for
the advice is mind boggling. *sigh* if only everyone were perfect like me...
 :p

"Hey lets pay someone to consult us on a subject that we're ignorant of."
"Great idea! And when he makes a suggestion we can totally ignore him! SQL -
Shmeequal"


Rant aside; I would defer the logistics to the client.  He wants the DB to
shutdown when he's not in the office? Ok no problem - not what it was
designed to do, but no problem!

"How would you like the system to be aware of rather or not you're in the
office? It can assume you are between these hours; You can log into a screen
that unlocked it, but then you have to logout; we can put a motion detector
in your office; ... etc."

This would put the consequences of the system off on the client. Because if
this system works then there will be consequences and you'll look like a
jerk  :-)

Btw, are there no cron / batch jobs that need to run over night?



Chris

--- End Message ---
--- Begin Message ---
> have been you'll have fun getting paid to re-do everything.  Having 
> everything require a usb stick to launch sounds secure, until 
> he loses 
> the stick or forgets it at home one day.  For fun I'd suggest tagging 

...or pulls it out before all the writes have taken place from the cache or
mysql's DELAYED WRITES and so the DB is corrupt or lost integrity.

*sigh*


--- End Message ---
--- Begin Message ---
On Mon, Sep 13, 2010 at 2:43 PM, chris h <chris...@gmail.com> wrote:
> "How would you like the system to be aware of rather or not you're in the
> office?

On his way in to the office:

Motion sensing camera connected to a mechanical pointer stick aimed to
trigger the server power button.

On his way out of the office:

Clap on/clap off Clapper connected to computer power cable.

:D

--- End Message ---
--- Begin Message ---
On Mon, Sep 13, 2010 at 19:47, Micky Hulse <mickyhulse.li...@gmail.com> wrote:
>
> Motion sensing camera connected to a mechanical pointer stick aimed to
> trigger the server power button.
>
> On his way out of the office:
>
> Clap on/clap off Clapper connected to computer power cable.

    It would be cheaper to employ the same method used on some
lawnmowers and required on Jet Skis and Skidoos: a cable with a clip
worn by the rider.  The rider falls off, the cable releases from the
vehicle, disengaging the throttle and cutting the engine.  The boss
stands up, his entire infrastructure collapses, everyone's connections
are closed, and all PCs subsequently catch fire.

    Realistically, a simple desktop-based application running in the
system tray (presuming Windows) would send a kill signal to a
predefined script to issue safe closing routines to the database
first, then any other systems he wants to close out.  It could even
have simple options to poll if there's a screensaver activated, which
would initiate the process automatically, should he choose to be
extremely paranoid.  The same could be automated to work in reverse,
to automatically bring the systems up, when the local desktop session
becomes active (from hibernation, logoff, or screensaver), or even
with an override ("Pause Sessions") by right-clicking the systray
icon.

    It's no surprise to several here that I'm not a big fan of
Windows.... but I do still like to stay on top of programming
languages, and at least give each one a try.  Something of interest to
no one: my first full-production, open-source project that included
PHP was actually a combination of a PHP server-side script and Windows
client script, written in VB, back in 2000.  It was named phpCourier,
and was used as a client-server CMS for simple news postings (before
"blog" became a catchphrase).  It was downloaded a few thousand times,
and then I quit hosting it.  I may actually have that server with
those files and a bunch of other old projects in my basement.  Now I'm
suddenly interested in unpacking and organizing everything.

-- 
</Daniel P. Brown>
Network Infrastructure Manager
Documentation, Webmaster Teams
http://www.php.net/

--- End Message ---
--- Begin Message ---
On Mon, Sep 13, 2010 at 5:05 PM, Daniel Brown <danbr...@php.net> wrote:
>    It would be cheaper to employ the same method used on some
> lawnmowers and required on Jet Skis and Skidoos: a cable with a clip
> worn by the rider.  The rider falls off, the cable releases from the
> vehicle, disengaging the throttle and cutting the engine.  The boss
> stands up, his entire infrastructure collapses, everyone's connections
> are closed, and all PCs subsequently catch fire.

Lol! That would make a great Dilbert and/or Farside cartoon. :)

--- End Message ---
--- Begin Message ---
On Mon, Sep 13, 2010 at 8:11 PM, Micky Hulse <mickyhulse.li...@gmail.com> wrote:
> On Mon, Sep 13, 2010 at 5:05 PM, Daniel Brown <danbr...@php.net> wrote:
>>    It would be cheaper to employ the same method used on some
>> lawnmowers and required on Jet Skis and Skidoos: a cable with a clip
>> worn by the rider.  The rider falls off, the cable releases from the
>> vehicle, disengaging the throttle and cutting the engine.  The boss
>> stands up, his entire infrastructure collapses, everyone's connections
>> are closed, and all PCs subsequently catch fire.
>
> Lol! That would make a great Dilbert and/or Farside cartoon. :)


It would, wouldn't it?

Anyway.  Something you could do is a script that turns mysqld on and
off:  set him up with an SSH connection to the server, and he can run
the script when he gets in to turn it on, and run it again whenever he
leaves to turn it off.  A cron job to turn mysqld off at whatever time
he usually leaves would probably be a reasonable failsafe.  If he
really wants you could probably link it to a swipe card system or just
a keyboard on his desk (enter your PIN to turn it on, enter it again
to turn it off).

All that aside, I can't help feeling that this has gotten into "I'm
afraid you know too much for us to let you leave:  Guards!  Take him
away!" territory.

-Alex

--- End Message ---
--- Begin Message ---
got another idea.. setup the database on a machine which can detect
the availability of the boss. if the boss machine is on.. and
connected to network.. the script will try to verify the availability
of the bosses's ip and interface hardware address. (if the boss change
the nic or machine, mac has to be updated manually in the script) and
starts or stops the database.

this can be done with bit of shellexec and bit of shellscripting, if
on linux with 'arp' (all employees and boss has to be in same subnet i
guess.. )

~viraj

On Tue, Sep 14, 2010 at 7:17 AM, Andy McKenzie <amckenz...@gmail.com> wrote:
> On Mon, Sep 13, 2010 at 8:11 PM, Micky Hulse <mickyhulse.li...@gmail.com> 
> wrote:
>> On Mon, Sep 13, 2010 at 5:05 PM, Daniel Brown <danbr...@php.net> wrote:
>>>    It would be cheaper to employ the same method used on some
>>> lawnmowers and required on Jet Skis and Skidoos: a cable with a clip
>>> worn by the rider.  The rider falls off, the cable releases from the
>>> vehicle, disengaging the throttle and cutting the engine.  The boss
>>> stands up, his entire infrastructure collapses, everyone's connections
>>> are closed, and all PCs subsequently catch fire.
>>
>> Lol! That would make a great Dilbert and/or Farside cartoon. :)
>
>
> It would, wouldn't it?
>
> Anyway.  Something you could do is a script that turns mysqld on and
> off:  set him up with an SSH connection to the server, and he can run
> the script when he gets in to turn it on, and run it again whenever he
> leaves to turn it off.  A cron job to turn mysqld off at whatever time
> he usually leaves would probably be a reasonable failsafe.  If he
> really wants you could probably link it to a swipe card system or just
> a keyboard on his desk (enter your PIN to turn it on, enter it again
> to turn it off).
>
> All that aside, I can't help feeling that this has gotten into "I'm
> afraid you know too much for us to let you leave:  Guards!  Take him
> away!" territory.
>
> -Alex
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
On Tue, Sep 14, 2010 at 12:25 PM, viraj <kali...@gmail.com> wrote:
> got another idea.. setup the database on a machine which can detect
> the availability of the boss. if the boss machine is on.. and
> connected to network.. the script will try to verify the availability
> of the bosses's ip and interface hardware address. (if the boss change
> the nic or machine, mac has to be updated manually in the script) and
> starts or stops the database.
>
> this can be done with bit of shellexec and bit of shellscripting, if
> on linux with 'arp' (all employees and boss has to be in same subnet i
> guess.. )

and yeah, the script has to be run at some reasonable time interval using a cron

~viraj

>
> ~viraj
>
> On Tue, Sep 14, 2010 at 7:17 AM, Andy McKenzie <amckenz...@gmail.com> wrote:
>> On Mon, Sep 13, 2010 at 8:11 PM, Micky Hulse <mickyhulse.li...@gmail.com> 
>> wrote:
>>> On Mon, Sep 13, 2010 at 5:05 PM, Daniel Brown <danbr...@php.net> wrote:
>>>>    It would be cheaper to employ the same method used on some
>>>> lawnmowers and required on Jet Skis and Skidoos: a cable with a clip
>>>> worn by the rider.  The rider falls off, the cable releases from the
>>>> vehicle, disengaging the throttle and cutting the engine.  The boss
>>>> stands up, his entire infrastructure collapses, everyone's connections
>>>> are closed, and all PCs subsequently catch fire.
>>>
>>> Lol! That would make a great Dilbert and/or Farside cartoon. :)
>>
>>
>> It would, wouldn't it?
>>
>> Anyway.  Something you could do is a script that turns mysqld on and
>> off:  set him up with an SSH connection to the server, and he can run
>> the script when he gets in to turn it on, and run it again whenever he
>> leaves to turn it off.  A cron job to turn mysqld off at whatever time
>> he usually leaves would probably be a reasonable failsafe.  If he
>> really wants you could probably link it to a swipe card system or just
>> a keyboard on his desk (enter your PIN to turn it on, enter it again
>> to turn it off).
>>
>> All that aside, I can't help feeling that this has gotten into "I'm
>> afraid you know too much for us to let you leave:  Guards!  Take him
>> away!" territory.
>>
>> -Alex
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>

--- End Message ---
--- Begin Message ---
tedd wrote:
> I have a client who wants his employees' access to their online business
> database restricted to only times when he is logged on. (Don't ask why)

Simply put a "dead man's handle" under his seat which turns on the power
to the server when he sits on it.

-- 
Gary        Please do NOT send me 'courtesy' replies off-list.
PHP 5.2.12 (cli) (built: Jan 14 2010 14:54:11) 
1.7.7(0.230/5/3) 2010-08-31 09:58 Cygwin


--- End Message ---
--- Begin Message ---
On 14 September 2010 08:05, Gary <php-gene...@garydjones.name> wrote:
> tedd wrote:
>> I have a client who wants his employees' access to their online business
>> database restricted to only times when he is logged on. (Don't ask why)
>
> Simply put a "dead man's handle" under his seat which turns on the power
> to the server when he sits on it.
>
> --
> Gary        Please do NOT send me 'courtesy' replies off-list.
> PHP 5.2.12 (cli) (built: Jan 14 2010 14:54:11)
> 1.7.7(0.230/5/3) 2010-08-31 09:58 Cygwin
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Hmm.

I think there is a really easy, cost free, way to deal with this.

You get all the employees in a room, with the boss.

And then you tell them that when the boss isn't in, they don't have to
do any work.

I'm pretty sure the employees will be your new BFFs.



-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

--- End Message ---
--- Begin Message ---
 On 9/13/2010 9:10 AM, Steve Staples wrote:
here's a silly idea...

put the database on his computer (or the entire app).  that way, when
he's *there* he is logged in.  if the computer is off, he's not there,
the app wont work (and the database).

Steve



On Mon, 2010-09-13 at 11:26 +0100, Richard Quadling wrote:
On 12 September 2010 17:32, tedd<t...@sperling.com>  wrote:
Hi gang:

I have a client who wants his employees' access to their online business
database restricted to only times when he is logged on. (Don't ask why)

In other words, when the boss is not logged on, then his employees cannot
access the business database in any fashion whatsoever including checking to
see if the boss is logged on, or not. No access whatsoever!

Normally, I would just set up a field in the database and have that set to
"yes" or "no" as to if the employees could access the database, or not. But
in this case, the boss does not want even that type of access to the
database permitted. Repeat -- No access whatsoever!

I was thinking of the boss' script writing to a file that accomplished the
"yes" or "no" thing, but if the boss did not log off properly then the file
would remain in the "yes" state allowing employees undesired access. That
would not be acceptable.

So, what methods would you suggest?

Cheers,

tedd
What operating system is he using?

Does he (for example), log into his computer and logoff/shutdown when
he goes home?

If he is using Windows (and I'm sure there are many ways to achieve
this), then in the Startup folder, a small PHP script which sets a
flag "I'm here", would allow the DB to know he's at least logged in.

There are different ways to do this.
http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Windows/XP/Q_21195727.html
covers login/logout/startup/shutdown.


Do they have a clock card system for clocking in/out the building?
Could you read the database that the clockings are logged in? An odd
number for the day = he's in, even = he's out, missed clocking =
screwed/guess.

Ideally you want to "hook" into his normal activity if you can.



--
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY



I'm pretty sure I'd have run for the hills after my first meeting with this client, but if you're sure you want to proceed ... Beyond the options mentioned, you could set it up so that the boss would log in each morning with a session that times out at the end of the work day (8, 10, 12, w/e hours later). To make it even more secure, you could have the boss create new logins for each employee at the start of each day. Since yesterdays passwords will no longer work, the boss will have to be there to issue new passwords to whomever he deems worthy of access on this day. These passwords would of course expire at the normal leaving time, so if someone came in late for a password at 4pm and work ends at 6pm, their password would only last two more hours.

All in all, I'd still grill him more about what it is he actually wants and why, as all of the ideas presented thus far have at least a dozen different ways things can go wrong. Putting the app on the bosses computer sounds great and all, but if he's sick or away on business suddenly no one in the office is doing any work. Or when his hdd gives out or is replaced and IT's backup system wasn't as great as it could have been you'll have fun getting paid to re-do everything. Having everything require a usb stick to launch sounds secure, until he loses the stick or forgets it at home one day. For fun I'd suggest tagging him with a microchip which your application will constantly scan for and only activate when he's within a certain radius of his desk. Retna scans shouldn't be overlooked either. <insert Mission Impossible theme here>

May the force be with you on this one.

-Tim

--- End Message ---
--- Begin Message ---

On Sep 13, 2010, at 17:49, Tim Thorburn <immor...@nwconx.net> wrote:

> On 9/13/2010 9:10 AM, Steve Staples wrote:
>> here's a silly idea...
>> 
>> put the database on his computer (or the entire app).  that way, when
>> he's *there* he is logged in.  if the computer is off, he's not there,
>> the app wont work (and the database).
>> 
>> Steve
>> 
>> 
>> 
>> On Mon, 2010-09-13 at 11:26 +0100, Richard Quadling wrote:
>>> On 12 September 2010 17:32, tedd<t...@sperling.com>  wrote:
>>>> Hi gang:
>>>> 
>>>> I have a client who wants his employees' access to their online business
>>>> database restricted to only times when he is logged on. (Don't ask why)
>>>> 
>>>> In other words, when the boss is not logged on, then his employees cannot
>>>> access the business database in any fashion whatsoever including checking 
>>>> to
>>>> see if the boss is logged on, or not. No access whatsoever!
>>>> 
>>>> Normally, I would just set up a field in the database and have that set to
>>>> "yes" or "no" as to if the employees could access the database, or not. But
>>>> in this case, the boss does not want even that type of access to the
>>>> database permitted. Repeat -- No access whatsoever!
>>>> 
>>>> I was thinking of the boss' script writing to a file that accomplished the
>>>> "yes" or "no" thing, but if the boss did not log off properly then the file
>>>> would remain in the "yes" state allowing employees undesired access. That
>>>> would not be acceptable.
>>>> 
>>>> So, what methods would you suggest?
>>>> 
>>>> Cheers,
>>>> 
>>>> tedd
>>> What operating system is he using?
>>> 
>>> Does he (for example), log into his computer and logoff/shutdown when
>>> he goes home?
>>> 
>>> If he is using Windows (and I'm sure there are many ways to achieve
>>> this), then in the Startup folder, a small PHP script which sets a
>>> flag "I'm here", would allow the DB to know he's at least logged in.
>>> 
>>> There are different ways to do this.
>>> http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Windows/XP/Q_21195727.html
>>> covers login/logout/startup/shutdown.
>>> 
>>> 
>>> Do they have a clock card system for clocking in/out the building?
>>> Could you read the database that the clockings are logged in? An odd
>>> number for the day = he's in, even = he's out, missed clocking =
>>> screwed/guess.
>>> 
>>> Ideally you want to "hook" into his normal activity if you can.
>>> 
>>> 
>>> 
>>> -- 
>>> Richard Quadling
>>> Twitter : EE : Zend
>>> @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY
>>> 
>> 
>> 
> I'm pretty sure I'd have run for the hills after my first meeting with this 
> client, but if you're sure you want to proceed ... Beyond the options 
> mentioned, you could set it up so that the boss would log in each morning 
> with a session that times out at the end of the work day (8, 10, 12, w/e 
> hours later).  To make it even more secure, you could have the boss create 
> new logins for each employee at the start of each day.  Since yesterdays 
> passwords will no longer work, the boss will have to be there to issue new 
> passwords to whomever he deems worthy of access on this day.  These passwords 
> would of course expire at the normal leaving time, so if someone came in late 
> for a password at 4pm and work ends at 6pm, their password would only last 
> two more hours.
> 
> All in all, I'd still grill him more about what it is he actually wants and 
> why, as all of the ideas presented thus far have at least a dozen different 
> ways things can go wrong.  Putting the app on the bosses computer sounds 
> great and all, but if he's sick or away on business suddenly no one in the 
> office is doing any work.  Or when his hdd gives out or is replaced and IT's 
> backup system wasn't as great as it could have been you'll have fun getting 
> paid to re-do everything.  Having everything require a usb stick to launch 
> sounds secure, until he loses the stick or forgets it at home one day.  For 
> fun I'd suggest tagging him with a microchip which your application will 
> constantly scan for and only activate when he's within a certain radius of 
> his desk.  Retna scans shouldn't be overlooked either. <insert Mission 
> Impossible theme here>
> 
> May the force be with you on this one.
> 
> -Tim

Well, if we are going down this route, many new laptops are offering some form 
of biometrics for access. If your client has one, you could potentially launch 
a script to start/ stop the db at that time. 

Or if we follow the new password suggestion, his morning login could run a 
script to reset and email all users their passwords automatically. 

Bastien

Sent from my iPod



--- End Message ---
--- Begin Message --- If there is a more appropriate place to ask this, I apologize. Please point me in the right direction.

I understand that the news server is based on a mailing list, but I can't handle another high-volume source dumping stuff into my email (even if I filter it into a separate folder) so I am trying to subscribe through the news group.

However, getting access seems to be hit-and-miss, since I more often than not get a message that the connection to news.php.net timed out.

Is this an indication that the server is just very busy? I don't get this on any other news server I'm using on the smae news reader and I have gotten this on two different news readers that I have tried.
--- End Message ---
--- Begin Message ---
On Mon, Sep 13, 2010 at 18:09, MikeB <mpbr...@gmail.com> wrote:
>
> However, getting access seems to be hit-and-miss, since I more often than
> not get a message that the connection to news.php.net timed out.
>
> Is this an indication that the server is just very busy? I don't get this on
> any other news server I'm using on the smae news reader and I have gotten
> this on two different news readers that I have tried.

    I don't believe that we've been having any issues with the server,
no.  Are you using NNTP to connect?  You may want to consider using
the HTTP-based RSS and/or RDF feeds if it continues to be an issue.
In addition, if you continue to have problems, file a bug report at
http://bugs.php.net/ and we'll look into it further.

-- 
</Daniel P. Brown>
Network Infrastructure Manager
Documentation, Webmaster Teams
http://www.php.net/

--- End Message ---
--- Begin Message ---
Daniel Brown wrote:

     I don't believe that we've been having any issues with the server,
no.  Are you using NNTP to connect?

yes, NNTP.

You may want to consider using
the HTTP-based RSS and/or RDF feeds if it continues to be an issue.

If this persists, I'll look into the alternatives you suggest, but that's another hill to climb when all I'm trying to do is learn PHP and web and mySQL and javascrip and... :) (not complaining, just that right now I've got a lot on my plate and the scope of new things just seem to keep expanding faster than I can get a handle on it).

In addition, if you continue to have problems, file a bug report at
http://bugs.php.net/ and we'll look into it further.

Thanks, I did that. In the process I found a 2005 bug report that said nntp was deliberately throttled to discourage its use... :)

As part of the bug report I included a link to an image of my nntp config.



--- End Message ---
--- Begin Message ---
On Mon, Sep 13, 2010 at 19:51, MikeB <mpbr...@gmail.com> wrote:
>
> As part of the bug report I included a link to an image of my nntp config.

    I saw that, thanks.  I'll look into creating a mirror of the news
server, as well, for NNTP-only access.  I won't lie and say that it's
a priority, but I'll try to get to it as soon as I have time, Mike.

-- 
</Daniel P. Brown>
Network Infrastructure Manager
Documentation, Webmaster Teams
http://www.php.net/

--- End Message ---
--- Begin Message ---
On 09/13/2010 06:51 PM, MikeB wrote:
> Daniel Brown wrote:
>>
>>      I don't believe that we've been having any issues with the server,
>> no.  Are you using NNTP to connect?
> 
> yes, NNTP.
> 
>> You may want to consider using
>> the HTTP-based RSS and/or RDF feeds if it continues to be an issue.
> 
> If this persists, I'll look into the alternatives you suggest, but
> that's another hill to climb when all I'm trying to do is learn PHP and
> web and mySQL and javascrip and...   :)  (not complaining, just that
> right now I've got a lot on my plate and the scope of new things just
> seem to keep expanding faster than I can get a handle on it).
> 
>> In addition, if you continue to have problems, file a bug report at
>> http://bugs.php.net/ and we'll look into it further.
>>
> Thanks, I did that. In the process I found a 2005 bug report that said
> nntp was deliberately throttled to discourage its use... :)
> 
> As part of the bug report I included a link to an image of my nntp config.
> 
> 

I have had this problem every day for years.  I can read a message and
then click another one and it times out.  It does this for hours at a
time.  Also, many times when sending a reply it times out.  Just learned
to live with it because I don't want mailing list mails either.


-- 
Thanks!
-Shawn
http://www.spidean.com

--- End Message ---
--- Begin Message ---
Daniel Brown wrote:
On Mon, Sep 13, 2010 at 19:51, MikeB<mpbr...@gmail.com>  wrote:

As part of the bug report I included a link to an image of my nntp config.

     I saw that, thanks.  I'll look into creating a mirror of the news
server, as well, for NNTP-only access.  I won't lie and say that it's
a priority, but I'll try to get to it as soon as I have time, Mike.

That is much appreciated. I can understand the situation, mostly I just wanted to know that it wasn't something I'm doing wrong. ANything you can do to improve it is, of course, appreciated.
--- End Message ---
--- Begin Message ---
I have some really strange behaviour going on here, and I think it could be
a (minor) PHP's bug.
I am not really sure about what happens internally, but my best guess would
be that after a memory exhaustion, when I try to execute a custom error
handler with the register_shutdown_function (which is executed even after a
fatal error) and try to access the element that provoked the memory
exhaustion, no error should raise instead of *Uninitialized string offset:
0.

I have prepared a little test case to reproduce the error and (I hope) can
explain the error.

<?php
date_default_timezone_set('America/Santiago');
ini_set('memory_limit','1M');
ini_set('display_errors',1);
error_reporting(-1);

function my_error_handler($errno = '0', $errstr = '[FATAL] General Error',
$errfile = 'N/A', $errline = 'N/A', $errctx = '') {
  global $clean_exit;
  if(empty($clean_exit)) {
    ini_set('memory_limit','16M');
    ob_start();
    echo '<h1>PHP v'.PHP_VERSION.', error N&deg; '.$errno.'</h1>';
?><h4>-- BEGIN COPY --</h4><p style="font-size:110%;margin:50px 0 20px
25px"><em>Error N&deg;:</em><br /><?php
  echo '<strong>'.$errno.'</strong><br />';
?><em>Error Detail:</em><br /><?php
    echo '<strong>'.$errstr.'</strong><br /><em>File:</em><br
/><strong>'.$errfile.'</strong><br /><em>Line:</em><br
/><strong>'.$errline.'</strong><br /><em>Debug:</em><br />';
    if (isset($errctx['r']['print'])) echo '<p>THIS LINE GIVES THE ERROR,
WHAT SHOULD IT RETURN?</p>';
?></p><h4>-- END COPY --</h4><?php
    $content = ob_get_contents();
    ob_end_clean();
    die($content);
  }
}
set_error_handler('my_error_handler');
register_shutdown_function('my_error_handler');

for ($i = 0; $i < 10000; $i++) $a[$i] = mt_rand(1,254);
$r['print'] = print_r($a,TRUE);
echo '<p>Everything fine.</p>';

$clean_exit = TRUE;

*
Would this be a bug or is this expected behaviour? I have tested this on PHP
v5.2.14, I've not tested it yet on 5.3.3, but I guess it would have the same
behaviour.

Greetings!

-- 
Mailed by:
UnReAl4U - unreal4u
ICQ #: 54472056
www1: http://www.chw.net/
www2: http://unreal4u.com/

--- End Message ---
--- Begin Message ---
This isn't to answer your question, but...

On Sep 13, 2010, at 5:16 PM, Camilo Sperberg wrote:
function my_error_handler($errno = '0', $errstr = '[FATAL] General Error',
$errfile = 'N/A', $errline = 'N/A', $errctx = '') {
 global $clean_exit;
 if(empty($clean_exit)) {
   ini_set('memory_limit','16M');
   ob_start();
   echo '<h1>PHP v'.PHP_VERSION.', error N&deg; '.$errno.'</h1>';
?><h4>-- BEGIN COPY --</h4><p style="font-size:110%;margin:50px 0 20px
25px"><em>Error N&deg;:</em><br /><?php
 echo '<strong>'.$errno.'</strong><br />';
?><em>Error Detail:</em><br /><?php
   echo '<strong>'.$errstr.'</strong><br /><em>File:</em><br
/><strong>'.$errfile.'</strong><br /><em>Line:</em><br
/><strong>'.$errline.'</strong><br /><em>Debug:</em><br />';
if (isset($errctx['r']['print'])) echo '<p>THIS LINE GIVES THE ERROR,
WHAT SHOULD IT RETURN?</p>';
?></p><h4>-- END COPY --</h4><?php
   $content = ob_get_contents();
   ob_end_clean();
   die($content);
 }
}

Why do you put <?php echo...?> inside an echo statement in php space?


--- End Message ---
--- Begin Message ---
On Mon, Sep 13, 2010 at 18:56, Tamara Temple <tamouse.li...@gmail.com>wrote:

> This isn't to answer your question, but...
>
>
> On Sep 13, 2010, at 5:16 PM, Camilo Sperberg wrote:
>
>> function my_error_handler($errno = '0', $errstr = '[FATAL] General Error',
>> $errfile = 'N/A', $errline = 'N/A', $errctx = '') {
>>  global $clean_exit;
>>  if(empty($clean_exit)) {
>>   ini_set('memory_limit','16M');
>>   ob_start();
>>   echo '<h1>PHP v'.PHP_VERSION.', error N&deg; '.$errno.'</h1>';
>> ?><h4>-- BEGIN COPY --</h4><p style="font-size:110%;margin:50px 0 20px
>> 25px"><em>Error N&deg;:</em><br /><?php
>>  echo '<strong>'.$errno.'</strong><br />';
>> ?><em>Error Detail:</em><br /><?php
>>   echo '<strong>'.$errstr.'</strong><br /><em>File:</em><br
>> /><strong>'.$errfile.'</strong><br /><em>Line:</em><br
>> /><strong>'.$errline.'</strong><br /><em>Debug:</em><br />';
>>   if (isset($errctx['r']['print'])) echo '<p>THIS LINE GIVES THE ERROR,
>> WHAT SHOULD IT RETURN?</p>';
>> ?></p><h4>-- END COPY --</h4><?php
>>   $content = ob_get_contents();
>>   ob_end_clean();
>>   die($content);
>>  }
>> }
>>
>
> Why do you put <?php echo...?> inside an echo statement in php space?
>
>

I think you may have mis-readed the code, I can't find where I put an <?php
echo inside an echo. I do a lot of opening/closing tags which contributes to
messing things up estetically but it works...

Any way, the posted code had a lot of remniscants of the production code,
here is a simplified version which does the same as above but .. well,
simplified :P

<?php
date_default_timezone_set('America/Santiago');
ini_set('memory_limit','1M');
ini_set('display_errors',1);
error_reporting(-1);

function my_error_handler($errno = '0', $errstr = '[FATAL] General Error',
$errfile = 'N/A', $errline = 'N/A', $errctx = '') {
  global $clean_exit;
  if(empty($clean_exit)) { // if isset or !empty, the script would have been
exited cleanly.
    ini_set('memory_limit','16M'); // This would be just to have enough
memory to print out the error.
    echo '<h5>-- BEGIN ERROR --</h5>Error N&deg;:
<strong>'.$errno.'</strong><br />Error Description:
<strong>'.$errstr.'</strong><br />File: <strong>'.$errfile.'</strong><br
/>Line: <strong>'.$errline.'</strong>';
    if (isset($errctx['r']['print'])) echo '<p>THIS LINE GIVES THE ERROR,
WHAT SHOULD IT RETURN?</p>'; // isset or empty gives the same error
    echo '<h5>-- END ERROR --</h5>';
    die(); // shutdown_function == manual die() or else it will continue to
execute.
  }
}
set_error_handler('my_error_handler');
register_shutdown_function('my_error_handler');

for ($i = 0; $i < 15000; $i++) $a[$i] = mt_rand(1,255);
$r['print'] = (string)$a[1]; // Just to asign something to that variable.
echo '<p>Everything fine.</p>';
$clean_exit = TRUE;

Greetings :)

-- 
Mailed by:
UnReAl4U - unreal4u
ICQ #: 54472056
www1: http://www.chw.net/
www2: http://unreal4u.com/

--- End Message ---
--- Begin Message ---
Well, after some more testing I'm almost sure it is some kind of strange
minor bug... so I've submitted a bug report:
http://bugs.php.net/bug.php?id=52833

Greetings !

On Tue, Sep 14, 2010 at 00:51, Camilo Sperberg <unrea...@gmail.com> wrote:

>
> On Mon, Sep 13, 2010 at 18:56, Tamara Temple <tamouse.li...@gmail.com>wrote:
>
>> This isn't to answer your question, but...
>>
>>
>> On Sep 13, 2010, at 5:16 PM, Camilo Sperberg wrote:
>>
>>> function my_error_handler($errno = '0', $errstr = '[FATAL] General
>>> Error',
>>> $errfile = 'N/A', $errline = 'N/A', $errctx = '') {
>>>  global $clean_exit;
>>>  if(empty($clean_exit)) {
>>>   ini_set('memory_limit','16M');
>>>   ob_start();
>>>   echo '<h1>PHP v'.PHP_VERSION.', error N&deg; '.$errno.'</h1>';
>>> ?><h4>-- BEGIN COPY --</h4><p style="font-size:110%;margin:50px 0 20px
>>> 25px"><em>Error N&deg;:</em><br /><?php
>>>  echo '<strong>'.$errno.'</strong><br />';
>>> ?><em>Error Detail:</em><br /><?php
>>>   echo '<strong>'.$errstr.'</strong><br /><em>File:</em><br
>>> /><strong>'.$errfile.'</strong><br /><em>Line:</em><br
>>> /><strong>'.$errline.'</strong><br /><em>Debug:</em><br />';
>>>   if (isset($errctx['r']['print'])) echo '<p>THIS LINE GIVES THE ERROR,
>>> WHAT SHOULD IT RETURN?</p>';
>>> ?></p><h4>-- END COPY --</h4><?php
>>>   $content = ob_get_contents();
>>>   ob_end_clean();
>>>   die($content);
>>>  }
>>> }
>>>
>>
>> Why do you put <?php echo...?> inside an echo statement in php space?
>>
>>
>
> I think you may have mis-readed the code, I can't find where I put an <?php
> echo inside an echo. I do a lot of opening/closing tags which contributes to
> messing things up estetically but it works...
>
> Any way, the posted code had a lot of remniscants of the production code,
> here is a simplified version which does the same as above but .. well,
> simplified :P
>
> <?php
> date_default_timezone_set('America/Santiago');
> ini_set('memory_limit','1M');
> ini_set('display_errors',1);
> error_reporting(-1);
>
> function my_error_handler($errno = '0', $errstr = '[FATAL] General Error',
> $errfile = 'N/A', $errline = 'N/A', $errctx = '') {
>   global $clean_exit;
>   if(empty($clean_exit)) { // if isset or !empty, the script would have
> been exited cleanly.
>     ini_set('memory_limit','16M'); // This would be just to have enough
> memory to print out the error.
>     echo '<h5>-- BEGIN ERROR --</h5>Error N&deg;:
> <strong>'.$errno.'</strong><br />Error Description:
> <strong>'.$errstr.'</strong><br />File: <strong>'.$errfile.'</strong><br
> />Line: <strong>'.$errline.'</strong>';
>     if (isset($errctx['r']['print'])) echo '<p>THIS LINE GIVES THE ERROR,
> WHAT SHOULD IT RETURN?</p>'; // isset or empty gives the same error
>     echo '<h5>-- END ERROR --</h5>';
>     die(); // shutdown_function == manual die() or else it will continue to
> execute.
>
>   }
> }
> set_error_handler('my_error_handler');
> register_shutdown_function('my_error_handler');
>
> for ($i = 0; $i < 15000; $i++) $a[$i] = mt_rand(1,255);
> $r['print'] = (string)$a[1]; // Just to asign something to that variable.
>
> echo '<p>Everything fine.</p>';
> $clean_exit = TRUE;
>
>
> Greetings :)
>
> --
> Mailed by:
> UnReAl4U - unreal4u
> ICQ #: 54472056
> www1: http://www.chw.net/
> www2: http://unreal4u.com/
>



-- 
Mailed by:
UnReAl4U - unreal4u
ICQ #: 54472056
www1: http://www.chw.net/
www2: http://unreal4u.com/

--- End Message ---
--- Begin Message ---
 On 09/14/2010 12:16 AM, Camilo Sperberg wrote:
I have some really strange behaviour going on here, and I think it could be
a (minor) PHP's bug.
I am not really sure about what happens internally, but my best guess would
be that after a memory exhaustion, when I try to execute a custom error
handler with the register_shutdown_function (which is executed even after a
fatal error) and try to access the element that provoked the memory
exhaustion, no error should raise instead of *Uninitialized string offset:
0.

I have prepared a little test case to reproduce the error and (I hope) can
explain the error.

<?php
date_default_timezone_set('America/Santiago');
ini_set('memory_limit','1M');
ini_set('display_errors',1);
error_reporting(-1);

function my_error_handler($errno = '0', $errstr = '[FATAL] General Error',
$errfile = 'N/A', $errline = 'N/A', $errctx = '') {
   global $clean_exit;
   if(empty($clean_exit)) {
     ini_set('memory_limit','16M');
     ob_start();
     echo '<h1>PHP v'.PHP_VERSION.', error N&deg; '.$errno.'</h1>';
?><h4>-- BEGIN COPY --</h4><p style="font-size:110%;margin:50px 0 20px
25px"><em>Error N&deg;:</em><br /><?php
   echo '<strong>'.$errno.'</strong><br />';
?><em>Error Detail:</em><br /><?php
     echo '<strong>'.$errstr.'</strong><br /><em>File:</em><br
/><strong>'.$errfile.'</strong><br /><em>Line:</em><br
/><strong>'.$errline.'</strong><br /><em>Debug:</em><br />';
     if (isset($errctx['r']['print'])) echo '<p>THIS LINE GIVES THE ERROR,
WHAT SHOULD IT RETURN?</p>';

Maybe i'm missing something here (kinda sick at home) but..
What do you expect to happen here? When i do a var_dump() on $errctx i get

string(0) ""

That would explain the error you are seeing.

?></p><h4>-- END COPY --</h4><?php
     $content = ob_get_contents();
     ob_end_clean();
     die($content);
   }
}
set_error_handler('my_error_handler');
register_shutdown_function('my_error_handler');

for ($i = 0; $i<  10000; $i++) $a[$i] = mt_rand(1,254);
$r['print'] = print_r($a,TRUE);
echo '<p>Everything fine.</p>';

$clean_exit = TRUE;

*
Would this be a bug or is this expected behaviour? I have tested this on PHP
v5.2.14, I've not tested it yet on 5.3.3, but I guess it would have the same
behaviour.

Greetings!



--- End Message ---
--- Begin Message ---
 On 09/14/2010 08:33 AM, Thijs Lensselink wrote:
 On 09/14/2010 12:16 AM, Camilo Sperberg wrote:
I have some really strange behaviour going on here, and I think it could be
a (minor) PHP's bug.
I am not really sure about what happens internally, but my best guess would
be that after a memory exhaustion, when I try to execute a custom error
handler with the register_shutdown_function (which is executed even after a
fatal error) and try to access the element that provoked the memory
exhaustion, no error should raise instead of *Uninitialized string offset:
0.

I have prepared a little test case to reproduce the error and (I hope) can
explain the error.

<?php
date_default_timezone_set('America/Santiago');
ini_set('memory_limit','1M');
ini_set('display_errors',1);
error_reporting(-1);

function my_error_handler($errno = '0', $errstr = '[FATAL] General Error',
$errfile = 'N/A', $errline = 'N/A', $errctx = '') {

This seems to be your error. You set $errctx to be a string. But later on you use it as an array.
Remove the = '' part. And it will function as expected.

   global $clean_exit;
   if(empty($clean_exit)) {
     ini_set('memory_limit','16M');
     ob_start();
     echo '<h1>PHP v'.PHP_VERSION.', error N&deg; '.$errno.'</h1>';
?><h4>-- BEGIN COPY --</h4><p style="font-size:110%;margin:50px 0 20px
25px"><em>Error N&deg;:</em><br /><?php
   echo '<strong>'.$errno.'</strong><br />';
?><em>Error Detail:</em><br /><?php
     echo '<strong>'.$errstr.'</strong><br /><em>File:</em><br
/><strong>'.$errfile.'</strong><br /><em>Line:</em><br
/><strong>'.$errline.'</strong><br /><em>Debug:</em><br />';
if (isset($errctx['r']['print'])) echo '<p>THIS LINE GIVES THE ERROR,
WHAT SHOULD IT RETURN?</p>';

Maybe i'm missing something here (kinda sick at home) but..
What do you expect to happen here? When i do a var_dump() on $errctx i get

string(0) ""

That would explain the error you are seeing.

?></p><h4>-- END COPY --</h4><?php
     $content = ob_get_contents();
     ob_end_clean();
     die($content);
   }
}
set_error_handler('my_error_handler');
register_shutdown_function('my_error_handler');

for ($i = 0; $i<  10000; $i++) $a[$i] = mt_rand(1,254);
$r['print'] = print_r($a,TRUE);
echo '<p>Everything fine.</p>';

$clean_exit = TRUE;

*
Would this be a bug or is this expected behaviour? I have tested this on PHP v5.2.14, I've not tested it yet on 5.3.3, but I guess it would have the same
behaviour.

Greetings!





--- End Message ---
--- Begin Message ---
J Ravi Menon wrote:

> Few questions:
> 
> 1) Does opcode cache really matter in such cli-based daemons? As
> 'SomeClass' is instantiated at every loop, I am assuming it is only
> compiled once as it has already been 'seen'.

Yup.

> 2) What about garbage collection? In a standard apache-mod-php setup,
> we rely on the end of a request-cycle to free up resources - close
> file descriptiors, free up memory etc..
>     I am assuming in the aforesaid standalone daemon case, we would
> have to do this manually?  

Yes.

> Note: I have written pre-forker deamons in php directly and
> successfully deployed them in the past, but never looked at in depth
> to understand all the nuances. Anecdotally, I have
> done 'unset()' at some critical places were large arrays were used,
> and I think it helped. AFAIK, unlike Java, there is no 'garbage
> collector' thread that does all the magic?

Correct.



-- 
Per Jessen, Zürich (12.9°C)


--- End Message ---

Reply via email to