Re: [PHP] Could this be a bug?

2010-09-14 Thread Thijs Lensselink

 On 09/14/2010 11:31 PM, Camilo Sperberg wrote:

On Tue, Sep 14, 2010 at 02:46, Thijs Lensselink  wrote:


  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.


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.


You're right... However I don't like leaving non-default value in functions
so I did something like if(empty($errctx)) $errctx = array() in the first
line of the custom error handler which threw out the error message and
everything works ok now.
I think from 5.2 and up you can use the array keyword to force an array 
as parameter..

But -and correct me if I'm wrong- isn't isset (or empty) supposed to return
a FALSE whenever that variable doesn't exist?

With your help, I could reduce the test case into:

$asdf = 'hello world';
if (empty($asdf[4]['inventing'])) echo 'nice little world';
if (isset($asdf['inventing'][6])) echo 'little nice world';
// This works ok.
This works because the string $asdf is set with a value. So $asdf[4] 
exists but ['inventing'] doesn't so it will return false

$asdf = '';
if (empty($asdf[4]['inventing'])) echo 'nice little world';
if (isset($asdf['inventing'][6])) echo 'little nice world';
// This returns E_NOTICE
This doesn't work because the string $asdf is empty. So calling $asdf[4] 
will trigger a notice since there is no 4th character

Shouldn't these 2 examples work exactly the same way? (AKA as Nº 1). If
not... why not? Both are string types, onyl difference is that one has no
characters in it while the other does, but essentialy they are both the
same.

Greetings !




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



Re: [PHP] php cli question

2010-09-14 Thread J Ravi Menon
On Tue, Sep 14, 2010 at 1:15 PM, Per Jessen  wrote:
> J Ravi Menon wrote:
>
>> On Tue, Sep 14, 2010 at 12:43 AM, Per Jessen  wrote:
>>> 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.
>>
>> Just to clarify, you mean we don't need the op-code cache here right?
>
> That is correct.
>
 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.
>>
>> So 'unset($some_big_array)'  or 'unset($some_big_object)' etc.. is the
>> right way to go for non-resource based items? i.e. it needs to be
>> explicitly done?
>
> It's not quite like C - if you reassign something, the previous contents
> are automagically freed.  I use unset() if I know it could be a while
> (hours) before it'll likely be reassigned, but it won't be used in the
> meantime.
>

Thanks Per for clarifying this for me. Now on my follow up question:

[Note: I think it is related to the issues discussed above hence
keeping it on this thread but if I am violating any guidelines here,
do let me know]

One reason the aforesaid questions got triggered was that in our
company right now, there is a big discussion on moving away from
apache+mod_php solution to nginx+fast-cgi based model for handling all
php-based services. The move seems to be more based some anecdotal
observations and possibly not based on a typical php-based app (i.e.
the php script involved was trivial one acting as some proxy to
another backend service).

I have written fast-cgi servers in the past in C++, and I am aware how
the apahce<>fast-cgi-servers work (in unix socket setups).  All
our php apps are written with apache+mod_php in mind (no explicit
resource mgmt ), so this was a concern to me.

If the same scripts now need to run 'forever' as a fastcgi server, are
we forced to do such manual resource mgmt? Or are there solutions here
that work just as in mod_php?

This reminded me of the cli daemons that I had written earlier where
such manual cleanups were done, and hence my doubts on this
nginx+fast-cgi approach.

thx,
Ravi


>
>
> --
> Per Jessen, Zürich (14.6°C)
>
>
> --
> 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] 1984 (Big Brother)

2010-09-14 Thread Nathan Rixham

Daniel Brown wrote:

On Mon, Sep 13, 2010 at 19:47, Micky Hulse  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.


I fear this is the implementation needed to make "boss" see sense, however..


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.


The main problem here is in using a stateless protocol (HTTP) in a 
stateful manner (with sessions), it makes this, technically, impossible. 
That said, you could do this in a stateless manner quite easily by 
giving the boss full control of granting and denying access, that way he 
is always accountable (with his described nature, it might be good for 
the buck to stop with him, rather than your code). I'd suggest having a 
simple boolean flag, usersCanAccess and giving him a button to toggle 
the flags state from true to false. Real life implementation could be an 
empty file which is `touch`ed and `unlink`ed, php implementation being 
an if(file_exists('boss_man_say_okay') ){ // let monkeys work } type 
solution.


Best,

Nathan

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



Re: [PHP] php cli question

2010-09-14 Thread Nathan Rixham

Per Jessen wrote:

J Ravi Menon wrote:

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.

So 'unset($some_big_array)'  or 'unset($some_big_object)' etc.. is the
right way to go for non-resource based items? i.e. it needs to be
explicitly done?


It's not quite like C - if you reassign something, the previous contents
are automagically freed.  I use unset() if I know it could be a while
(hours) before it'll likely be reassigned, but it won't be used in the
meantime. 


Has anybody done a comparison of setting to null rather than unset'ing; 
does unset invoke the garbage collector instantly? i.e. is unset the 
best approach to clearing objects from memory quickly?


Best,

Nathan

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



Re: [PHP] Question about news.php.net

2010-09-14 Thread Daniel Brown
Good to know there's a workaround.  I am thinking of using one (or more) of
the old VOOM boxes to mirror the news server for NNTP-only access.

Sent from my DROID. Apologies if formatting is off or I'm top-posting on a
list.

On Sep 14, 2010 8:59 PM, "Nathan Rixham"  wrote:
> Daniel Brown wrote:
>> On Mon, Sep 13, 2010 at 18:09, MikeB  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.
>
> Dan, Mike,
>
> I can confirm this happens "all the time" in thunderbird, and always has
> for many years now, on all PHP NNTP lists.
>
> However, the problem can be worked around simply, for some reason the
> timeout generally only happens with the first call to view a mailing
> list, after X minutes of inactivity. Thus, I simply subscribe to a few
> different PHP lists (like .soap .test and general) then when I open
> thunderbird I quickly click a list I *don't* want to see, then click on
> .general, .general then loads nicely as expected letting the other one
> timeout :)
>
> It's hardly a fix, but it works - may be worth checking if this is the
> case with the latest thunderbird revision and then reporting it as a
> "bug" (in either thunderbird or the mailing list software that PHP is
> running).
>
> Best,
>
> Nathan


[PHP] Re: Adjusting Session Times

2010-09-14 Thread Nathan Rixham

Floyd Resler wrote:

We just got a client whose requirement is that user sessions expire after 30 
minutes of inactivity.  Our other clients are happy with not having their 
sessions expire during the work day (i.e. life is 8 hours).  I am using a MySQL 
database to store the session data.  My thought is to adjust the session 
expiration in the table based on the client currently logged in.  Is this a 
good approach or would there be better ways to do it?  And just to clarify: all 
clients use the same Web site.


It may be worth storing sessions in something like redis [1] instead, 
which let's you expire data [2] after a given time, then you can 
configure however you want easily.


The other benefit is that sessions will be extremely fast given that 
they'll all be stored in ram :)


[1] http://code.google.com/p/redis/
[2] http://code.google.com/p/redis/wiki/ExpireCommand

Best,

Nathan

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



Re: [PHP] Question about news.php.net

2010-09-14 Thread Nathan Rixham

Daniel Brown wrote:

On Mon, Sep 13, 2010 at 18:09, MikeB  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.


Dan, Mike,

I can confirm this happens "all the time" in thunderbird, and always has 
for many years now, on all PHP NNTP lists.


However, the problem can be worked around simply, for some reason the 
timeout generally only happens with the first call to view a mailing 
list, after X minutes of inactivity. Thus, I simply subscribe to a few 
different PHP lists (like .soap .test and general) then when I open 
thunderbird I quickly click a list I *don't* want to see, then click on 
.general, .general then loads nicely as expected letting the other one 
timeout :)


It's hardly a fix, but it works - may be worth checking if this is the 
case with the latest thunderbird revision and then reporting it as a 
"bug" (in either thunderbird or the mailing list software that PHP is 
running).


Best,

Nathan

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



Re: [PHP] Could this be a bug?

2010-09-14 Thread Camilo Sperberg
On Tue, Sep 14, 2010 at 02:46, Thijs Lensselink  wrote:

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


You're right... However I don't like leaving non-default value in functions
so I did something like if(empty($errctx)) $errctx = array() in the first
line of the custom error handler which threw out the error message and
everything works ok now.

But -and correct me if I'm wrong- isn't isset (or empty) supposed to return
a FALSE whenever that variable doesn't exist?

With your help, I could reduce the test case into:

$asdf = 'hello world';
if (empty($asdf[4]['inventing'])) echo 'nice little world';
if (isset($asdf['inventing'][6])) echo 'little nice world';
// This works ok.

$asdf = '';
if (empty($asdf[4]['inventing'])) echo 'nice little world';
if (isset($asdf['inventing'][6])) echo 'little nice world';
// This returns E_NOTICE

Shouldn't these 2 examples work exactly the same way? (AKA as Nº 1). If
not... why not? Both are string types, onyl difference is that one has no
characters in it while the other does, but essentialy they are both the
same.

Greetings !

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


[PHP] Image question for runways

2010-09-14 Thread Alexis

Hi,

I am trying to create an on the fly image of runway layouts but am 
hitting a brick wall.


I have both the starting and ending coordinates of each runway, it's 
length, as well as it's angle of direction (heading).


I can draw one runway without any problem, but where I am falling short 
is how to 'scale', if that is the right word, the other runway(s) to 
display properly in a 500x500px image



function imagepolarline($image,$x1,$y1,$length,$angle,$color)
{
$length=($length/500)*20;
$x2 = $x1 + cos( deg2rad($angle-90)) * $length;
$y2 = $y1 + sin( deg2rad($angle-90)) * $length;
imageline($image, $x1,$y1,$x2,$y2, $color); 
}

//'base' coords
$x1=200;$y1=200;

$scale=1;

//if first runway
if ($d==0) {$xbase=abs($lon1);$ybase=abs($lat1);}
//for all others
else
{
$x1=$x1+(($xbase-(abs($lon1)))*$scale);
$y1=$y1+(($ybase-(abs($lat1)))*$scale);
}


Here is some test data if that would help:
"length","lat_start","lon_start","heading","lat_stop","lon_stop"
"6869","38.8424","-77.0368","355.5000","38.8612","-77.0387"
"4911","38.8423","-77.0408","26.","38.8544","-77.0333"
"5204","38.8617","-77.0438","142.7000","38.8503","-77.0327"

Any suggestions would be most appreciated.

Alexis

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



Re: [PHP] php cli question

2010-09-14 Thread Per Jessen
J Ravi Menon wrote:

> On Tue, Sep 14, 2010 at 12:43 AM, Per Jessen  wrote:
>> 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.
> 
> Just to clarify, you mean we don't need the op-code cache here right?

That is correct.

>>> 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.
> 
> So 'unset($some_big_array)'  or 'unset($some_big_object)' etc.. is the
> right way to go for non-resource based items? i.e. it needs to be
> explicitly done?

It's not quite like C - if you reassign something, the previous contents
are automagically freed.  I use unset() if I know it could be a while
(hours) before it'll likely be reassigned, but it won't be used in the
meantime. 



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


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



[PHP] bcompiler: compile in a diferent directory

2010-09-14 Thread Ramiro Gonzalez
I use bcompiler in my php
code(bcompiler_write_header+bcompiler_write_file+bcompiler_write_footer).
If the original phps are not located in the deployment directory I get an
error: require_once use the path to the not compiled phps.
I'd like to know if there is any way to compile the phps and use the
compiled versión from a different directory.

Thanks
Ramiro


Re: [PHP] php cli question

2010-09-14 Thread J Ravi Menon
On Tue, Sep 14, 2010 at 12:43 AM, Per Jessen  wrote:
> 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.

Just to clarify, you mean we don't need the op-code cache here right?


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

So 'unset($some_big_array)'  or 'unset($some_big_object)' etc.. is the
right way to go for non-resource based items? i.e. it needs to be
explicitly done?

thx,
Ravi



>> 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)
>
>
> --
> 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] Filestat.c erorrs when building php-5.3.3 on solaris

2010-09-14 Thread STANFIELD, VICKI CTR DFAS
For the record, the problem appears to have been that the gcc version
was too old. It compiles with gcc 3.4.6 

  -Vicki Stanfield, RHCE, CISSP
Web Management Group
tso-cs-web-t...@dfas.mil

Defense Finance and Accounting Service
Technical Services Organization - Corporate Services
vicki.stanfield@dfas.mil
(317)510-3375

-Original Message-
From: Tom Rogers [mailto:trog...@kwikin.com] 
Sent: Thursday, September 09, 2010 10:05 PM
To: STANFIELD, VICKI CTR DFAS
Cc: php-general@lists.php.net
Subject: Re: [PHP] Filestat.c erorrs when building php-5.3.3 on solaris

Hi,

Friday, September 10, 2010, 2:49:36 AM, you wrote:
SVCD> Ok, I tried removing the --disable-posix and adding
--with-tsrm-pthreads
SVCD> to the configure options. 
SVCD> The resulting configure looks like this:

SVCD> CC='/usr/local/bin/gcc' \
SVCD> './configure' \
SVCD> '--prefix=/app/php533' \
SVCD> '--enable-shared' \
SVCD> '--with-tsrm-pthreads' \
SVCD> '--with-gnu-ld' \
SVCD> '--with-apxs2=/app/apache2216/bin/apxs' \
SVCD> '--with-zlib' \
SVCD> '--with-zlib-dir=/usr/lib' \
SVCD> '--with-png-dir=/usr/include/libpng' \
SVCD> '--with-openssl=/shared_ro/openssl_098' \
SVCD> '--with-oci8=/shared_ro/users.oracle/11.1.0'

SVCD> Now I get this:

SVCD> /users/0/php-5.3.3/ext/posix/posix.c: In function
SVCD> `zif_posix_getgrnam':
SVCD> /users/0/php-5.3.3/ext/posix/posix.c:1017: error: too many
arguments
SVCD> to function `getgrnam_r'
SVCD> /users/0/php-5.3.3/ext/posix/posix.c: In function
SVCD> `zif_posix_getgrgid':
SVCD> /users/0/php-5.3.3/ext/posix/posix.c:1067: error: too many
arguments
SVCD> to function `getgrgid_r'
SVCD> /users/0/php-5.3.3/ext/posix/posix.c:1067: warning: assignment
makes
SVCD> integer from pointer without a cast
SVCD> /users/0/php-5.3.3/ext/posix/posix.c: In function
SVCD> `zif_posix_getpwnam':
SVCD> /users/0/php-5.3.3/ext/posix/posix.c:1136: error: too many
arguments
SVCD> to function `getpwnam_r'
SVCD> /users/0/php-5.3.3/ext/posix/posix.c: In function
SVCD> `zif_posix_getpwuid':
SVCD> /users/0/php-5.3.3/ext/posix/posix.c:1184: error: too many
arguments
SVCD> to function `getpwuid_r'
SVCD> /users/0/php-5.3.3/ext/posix/posix.c:1184: warning: assignment
makes
SVCD> integer from pointer without a cast
SVCD> gmake: *** [ext/posix/posix.lo] Error 1

SVCD> Do I need to add the -D_POSIX_PTHREAD_SEMANTICS in the makefile or
SVCD> configure.in somewhere? Can you point me in the right direction?

SVCD>   -Vicki Stanfield, RHCE, CISSP

SVCD> -Original Message-
SVCD> From: Tom Rogers [mailto:trog...@kwikin.com] 
SVCD> Sent: Wednesday, September 08, 2010 10:06 PM
SVCD> To: Tom Rogers
SVCD> Cc: php-general@lists.php.net
SVCD> Subject: Re: [PHP] Filestat.c erorrs when building php-5.3.3 on
solaris

SVCD> Hi,

SVCD> Thursday, September 9, 2010, 11:31:06 AM, you wrote:
TR>> Hi,

TR>> Thursday, September 9, 2010, 2:07:50 AM, you wrote:
SVCD>>> I am trying to build php-5.3.3 and getting the following error: 

SVCD>>> /users/0/php-5.3.3/TSRM -I/users/0/php-5.3.3/Zend
SVCD>>> -I/usr/local/include -g -O2 -DZTS   -c
SVCD>>> /users/0/php-5.3.3/ext/standard/filestat.c -o
SVCD>>> ext/standard/filestat.lo 
SVCD>>> /users/0/php-5.3.3/ext/standard/filestat.c: In function
SVCD>>> `php_do_chgrp':
SVCD>>> /users/0/php-5.3.3/ext/standard/filestat.c:416: error: too
SVCD> many
SVCD>>> arguments to function `getgrnam_r'
SVCD>>> /users/0/php-5.3.3/ext/standard/filestat.c: In function
SVCD>>> `php_do_chown':
SVCD>>> /users/0/php-5.3.3/ext/standard/filestat.c:517: error: too
SVCD> many
SVCD>>> arguments to function `getpwnam_r'
SVCD>>> make: *** [ext/standard/filestat.lo] Error 1

SVCD>>> I have set my ORACLE_HOME, my PATH, and my LD_LIBRARY_PATH
SVCD>>> And used the following configure command:

SVCD>>> ./configure --prefix=/app/php533
SVCD> --with-apxs2=/app/apache2215/bin/apxs
SVCD>>> --with-zlib --with-zlib-dir=/usr/lib
SVCD>>> --with-png-dir=/usr/include/libpng
SVCD>>> --with-openssl=/shared_ro/openssl_098
SVCD>>> --with-oci8=/shared_ro/users.oracle/11.1.0

SVCD>>> I am using gmake 3.80. Can anyone give me a hint as to what I am
SVCD> doing
SVCD>>> wrong in this build?

SVCD>>>   -Vicki Stanfield, RHCE, CISSP


TR>> From   the   error  message  it  would  seem  the  operating
SVCD> system's
TR>> getpwnam_r() function is not POSIX compatible.
TR>> What system are you compiling on?

TR>> -- 
TR>> regards,
TR>> Tom



SVCD> It  would  seem  you  need to add -D_POSIX_PTHREAD_SEMANTICS to
the cc
SVCD> flags to get the right function.

SVCD> -- 
SVCD> regards,
SVCD> Tom



That  should  get  added  automatically  when  you run configure if it
recognizes that the system is solaris.

Try adding --host=solaris to configure and see if that helps

-- 
regards,
Tom


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



Re: [PHP] Adjusting Session Times

2010-09-14 Thread Floyd Resler
Tedd,
I really like your solution.  The idea of storing the expiration in the 
SESSION makes it easier for me and makes it more flexible.  Someone else had 
provided a solution that would actually allow me to take it down to a user 
level if I needed to.  I loved the idea for flexibility but would have required 
a major rewrite.  Your idea gives me the flexibility and doesn't require any 
major rewriting - just a little tweaking.

Thanks!
Floyd

On Sep 14, 2010, at 12:58 PM, tedd wrote:

> At 10:26 AM -0400 9/14/10, Floyd Resler wrote:
>> We just got a client whose requirement is that user sessions expire after 30 
>> minutes of inactivity.  Our other clients are happy with not having their 
>> sessions expire during the work day (i.e. life is 8 hours).  I am using a 
>> MySQL database to store the session data.  My thought is to adjust the 
>> session expiration in the table based on the client currently logged in.  Is 
>> this a good approach or would there be better ways to do it?  And just to 
>> clarify: all clients use the same Web site.
>> 
>> Thanks!
>> Floyd
> 
> Floyd:
> 
> I don't know how others solve this, but my solution is pretty straightforward 
> (see code below).
> 
> I require this code for every script that is in the secured area. Simply put, 
> if the user runs a script, then this script is also run.
> 
> As a result, if the user is not logged in they are directed to the login 
> script. If the user is logged in, but has exceeded the expiration time due to 
> inactivity, then the user is redirected to the same login script with a GET 
> value to trigger the login script to report that they timed out due to 
> inactivity.
> 
> I find it bad practice to tell a user that they are not logged in when they 
> did log in. It's better to explain why they have to log on again.
> 
> Now, with respect to your storing the expiration time in the database, that 
> could be done easily enough by this script accessing the database, getting, 
> and setting the time-limit -- OR -- at the start of any logon have the script 
> pull the time-limit from the database and store that value in a SESSION. 
> Either way would work.
> 
> In any event, this is what I do.
> 
> Cheers,
> 
> tedd
> 
> == code
> 
>  
> $redirect = 'http://yourdomain.com/admin/logon.php';
> 
> // standard security
> 
> $secure = isset($_SESSION['security']) ? $_SESSION['security'] : 0;
> 
> if ($secure == 0) // if admin is not logged in -- then redirect to the admin 
> logon
>   {
>   header("location:$redirect");
>   exit();
>   }
> 
> // timed security
> 
> $_SESSION['start'] = isset($_SESSION['start']) ? $_SESSION['start'] : 0;
> 
> $timelimit = 15 * 60; // 15 minutes
> $now = time();
> 
> if($now > $_SESSION['start'] + $timelimit)
>   {
>   logOff();
>   $t = '?t=1';
>   header("location:$redirect$t");
>   exit();
>   }
> 
> $_SESSION['start'] = time();
> 
> // properly logged on pass here
> 
> ?>
> 
> 
>  // to destroy the current session
> 
> function logOff()
>   {
>   $_SESSION = array();
> 
>   if(isset($_COOKIE[session_name()]))
>  {
>  setcookie(session_name(), '', time()-86400, '/');
>  }
>   session_destroy();
>   }
> 
> -- 
> ---
> http://sperling.com/
> 
> -- 
> 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] Adjusting Session Times

2010-09-14 Thread tedd

At 10:26 AM -0400 9/14/10, Floyd Resler wrote:
We just got a client whose requirement is that user sessions expire 
after 30 minutes of inactivity.  Our other clients are happy with 
not having their sessions expire during the work day (i.e. life is 8 
hours).  I am using a MySQL database to store the session data.  My 
thought is to adjust the session expiration in the table based on 
the client currently logged in.  Is this a good approach or would 
there be better ways to do it?  And just to clarify: all clients use 
the same Web site.


Thanks!
Floyd


Floyd:

I don't know how others solve this, but my solution is pretty 
straightforward (see code below).


I require this code for every script that is in the secured area. 
Simply put, if the user runs a script, then this script is also run.


As a result, if the user is not logged in they are directed to the 
login script. If the user is logged in, but has exceeded the 
expiration time due to inactivity, then the user is redirected to the 
same login script with a GET value to trigger the login script to 
report that they timed out due to inactivity.


I find it bad practice to tell a user that they are not logged in 
when they did log in. It's better to explain why they have to log on 
again.


Now, with respect to your storing the expiration time in the 
database, that could be done easily enough by this script accessing 
the database, getting, and setting the time-limit -- OR -- at the 
start of any logon have the script pull the time-limit from the 
database and store that value in a SESSION. Either way would work.


In any event, this is what I do.

Cheers,

tedd

== code

http://yourdomain.com/admin/logon.php';

// standard security

$secure = isset($_SESSION['security']) ? $_SESSION['security'] : 0;

if ($secure == 0) // if admin is not logged in -- then redirect to 
the admin logon

   {
   header("location:$redirect");
   exit();
   }

// timed security

$_SESSION['start'] = isset($_SESSION['start']) ? $_SESSION['start'] : 0;

$timelimit = 15 * 60; // 15 minutes
$now = time();

if($now > $_SESSION['start'] + $timelimit)
   {
   logOff();
   $t = '?t=1';
   header("location:$redirect$t");
   exit();
   }

$_SESSION['start'] = time();

// properly logged on pass here

?>


http://sperling.com/

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



Re: [PHP] 1984 (Big Brother)

2010-09-14 Thread tedd

At 8:05 PM -0400 9/13/10, Daniel Brown wrote:

The boss stands up, his entire infrastructure collapses, everyone's
connections are closed, and all PCs subsequently catch fire.


LOL

Sounds good to me.

After that happens a couple of times, maybe things will change. If 
it's the private sector, they investigate and find a better solution. 
If it's the public sector, they will probably require water based 
fire extinguishers.


Cheers,

tedd

--
---
http://sperling.com/

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



Re: [PHP] Adjusting Session Times

2010-09-14 Thread Andrew Ballard
On Tue, Sep 14, 2010 at 10:26 AM, Floyd Resler  wrote:
> We just got a client whose requirement is that user sessions expire after 30 
> minutes of inactivity.  Our other clients are happy with not having their 
> sessions expire during the work day (i.e. life is 8 hours).  I am using a 
> MySQL database to store the session data.  My thought is to adjust the 
> session expiration in the table based on the client currently logged in.  Is 
> this a good approach or would there be better ways to do it?  And just to 
> clarify: all clients use the same Web site.
>
> Thanks!
> Floyd

I store the date and time of the last page access and the session
lifetime in minutes in the database. Then when I fetch the session
from the database, the WHERE clause includes a condition that the
number of minutes elapsed between the current date/time and the time
stored in the session table is less than the session lifetime (maximum
duration of inactivity for that session). That way, each individual
user could have his or her own session timeout period if needed.

Andrew

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



Re: [PHP] Adjusting Session Times

2010-09-14 Thread chris h
> My thought is to adjust the session expiration in the table based on the
> client currently logged in.
>
>
I don't know if there's a better way, but I would probably just do that.
 The expiration would be set to whatever the client's preference is, and
default to 8 hours if he doesn't have one.  You may want to set some checks
to ensure that the client's preference is within a specific range (e.g.
between 30 minutes and 16 hours).


Chris.


[PHP] Adjusting Session Times

2010-09-14 Thread Floyd Resler
We just got a client whose requirement is that user sessions expire after 30 
minutes of inactivity.  Our other clients are happy with not having their 
sessions expire during the work day (i.e. life is 8 hours).  I am using a MySQL 
database to store the session data.  My thought is to adjust the session 
expiration in the table based on the client currently logged in.  Is this a 
good approach or would there be better ways to do it?  And just to clarify: all 
clients use the same Web site.

Thanks!
Floyd


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



Re: [PHP] Re: 1984 (Big Brother)

2010-09-14 Thread Kevin Kinsey

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



I figured we'd get here sooner or later, esp. after I saw Daniel B. talking
about lawnmowers.

And now you can tell the client with a straight face ... "if you want any
work to get done today you'd best sit your @$$ down right here"

Then, of course, for fun, you could encourage PHB to bounce up & down a
few times a day "to keep the employees on their toes."  He'd dig it, I'm
sure, and you'd pick up a good parcel of extra work recovering DB's ...
and disks.

Richard Quadling:

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.


+11.

We should ABSOLUTELY copy Scot Adams on this.

Wait a minute, maybe Tedd's client IS Scot Adams.

Kevin Kinsey

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



[PHP] Re: Counting Children!

2010-09-14 Thread Sridhar Pandurangiah
I managed to solve this myself. Here is the code. For some reason 
"foreach" works for the first set of non unique tags and doesn't work if 
the non unique tags are nested within the first set. Use the following 
code to access the tag values of the nested non unique tags. (see the 
XML file  below if this seems confusing)


$chi = count($member->line);
for ($i = 0; $i < $chi; $i++)
{
echo $member->line[$i]->particular1;
echo $member->line[$i]->amount1;
echo $member->line[$i]->particular2;
echo $member->line[$i]->amount2;
}


Best regards

Sridhar


Sridhar Pandurangiah wrote:

Hi

I have an XML generated by another computer application. The format is
as below. (Don't worry about the data in the XML. Its the test
data).

I am able to locate the correct member bill using XPATH.
However I have hit a bottleneck. I am unable to echo all the  
elements. This is what happens


$row = simplexml_load_string($member->asXML());

echo $line->particular1;
echo $line->amount1;
echo $line->particular2;
echo $line->amount2;

Echoes the first  element of the member bill. If I add the same 
set of statements it echoes the second  element and so on. But 
then if I put the following code which I feel is correct

$row = simplexml_load_string($member->asXML());

foreach ($row->line as $line);
{
echo $line->particular1;
echo $line->amount1;
echo $line->particular2;
echo $line->amount2;
}

Echoes only the last  element of the member. Can someone tell me 
what's wrong


-The XML file 
-



The Great Eastern Club
Anna Road
Madras
BILL

A0099
Bill no. : A0099/APRIL 10
Raman C V
Run date : 03/05/2010
NO 33,MUGAPPAIR ROAD,
PADI,
CHENNAI
600032
9840012345
STATEMENT OF ACCOUNTS AND BILL FOR THE MONTH OF
APRIL-2010
Particulars
Debit
Receivables
Credit

Opening Balance
275.14
-
0.00


CHARGES
33.09


MINIMUM USAGE
220.60


SUBSCRIPTION CHARGES
220.60


WATER CHARGE
22.06


Total Debit
771.49
Total Credit
0.00


Amount to be Received
771.49

Hereafter no reminders will be sent for payment of
monthly/Arrears bills.


A0100
Bill no. : A0100/APRIL 10
Sandeep
Run date : 03/05/2010
NO 12,
TNAGAR,
CHENNAI
600017
9840012365
STATEMENT OF ACCOUNTS AND BILL FOR THE MONTH OF
APRIL-2010
Particulars
Debit
Receivables
Credit

Opening Balance
496.38
-
0.00


ENTERTAINMENT CHARGES
33.09
17/06/2010 CASH PCR/000544/10-11
124.00


MINIMUM USAGE
124.00


SUBSCRIPTION CHARGES
220.60


WATER CHARGE
22.06


Total Debit
896.13
Total Credit
124.00


Amount to be Received
772.13

Hereafter no reminders will be sent for payment of
monthly/Arrears bills.




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



Re: [PHP] Re: 1984 (Big Brother)

2010-09-14 Thread Richard Quadling
On 14 September 2010 08:05, Gary  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

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



Re: [PHP] php cli question

2010-09-14 Thread Per Jessen
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)


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