|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general Digest 22 Jul 2004 06:46:03 -0000 Issue 2891
php-general-digest-help
lists.php.net
Date: Thu Jul 22 2004 - 01:46:03 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 22 Jul 2004 06:46:03 -0000 Issue 2891
Topics (messages 191372 through 191482):
Re: PHP5 - Weird Error - "cannot find element in variable"
191372 by: Scott Hyndman
191374 by: Scott Hyndman
191379 by: Scott Hyndman
191395 by: Curt Zirzow
Re: exec/system question..
191373 by: Michael Sims
191382 by: Justin Patrin
191385 by: Justin Patrin
191387 by: bruce
191388 by: Michael Sims
191389 by: bruce
191390 by: Lars Torben Wilson
191391 by: Michael Sims
191392 by: Lars Torben Wilson
191393 by: bruce
191396 by: Michael Sims
191397 by: bruce
Intant Messengers and PHP
191375 by: Jason Davidson
191403 by: Manuel Lemos
191408 by: Jason Davidson
191459 by: raditha dissanayake
Re: trim() white space from record set
191376 by: melissa atchley
191384 by: Justin Patrin
191386 by: melissa atchley
Re: Function with Optional Arguments
191377 by: Geethanandh Kandasamy
191378 by: Marek Kilimajer
191380 by: Frank Munch
191383 by: Justin Patrin
Re: Error when using HTTP Location header
191381 by: Jonathan Haddad
191394 by: Justin Patrin
191398 by: Chris Shiflett
191399 by: John W. Holmes
The Mail Server
191400 by: PHP Junkie
191402 by: Manuel Lemos
change value of session variable?
191401 by: Five
191407 by: Chris Shiflett
191409 by: Justin Patrin
191412 by: Harlequin
191414 by: John W. Holmes
191415 by: Five
191418 by: Five
191423 by: Justin Patrin
191425 by: Matt M.
191426 by: Justin Patrin
191430 by: Chris Shiflett
191437 by: Five
191438 by: Five
191443 by: Justin Patrin
191451 by: Five
191455 by: Chris Shiflett
191456 by: John W. Holmes
191462 by: Five
191463 by: Five
191464 by: Five
191465 by: Chris Shiflett
191466 by: Chris Shiflett
191472 by: Five
191473 by: John W. Holmes
191474 by: Justin Patrin
191476 by: Five
191477 by: Justin Patrin
191478 by: John W. Holmes
191479 by: Jason Wong
Unable To Gain Access to "phpMyAdmin" Through Internet Browser
191404 by: Harlequin
191427 by: Torsten Roehr
Re: Sending the output of a web page to a printer
191405 by: Manuel Lemos
191411 by: Jan Tore Morken
191413 by: Vern
191420 by: Manuel Lemos
191422 by: Justin Patrin
191431 by: Marek Kilimajer
191432 by: Vern
191436 by: Vern
191439 by: Ed Lazor
191440 by: Vern
191444 by: Ed Lazor
191445 by: Vern
191447 by: Manuel Lemos
191448 by: Justin Patrin
191449 by: Manuel Lemos
191450 by: Ed Lazor
Problem with file_exists() and clearstatcache()...
191406 by: Scott Fletcher
Re: PHP Bespoke Email Solutions
191410 by: Manuel Lemos
Firefox - IE differences
191416 by: Karl-Heinz Schulz
191424 by: Justin Patrin
191428 by: Marek Kilimajer
191435 by: John W. Holmes
Re: The Mail Server on Mac OS X
191417 by: PHP Junkie
191419 by: Manuel Lemos
Line breaks again....
191421 by: PHP User
191429 by: Torsten Roehr
191434 by: John W. Holmes
191469 by: PHP User
191475 by: Justin Patrin
191480 by: Jason Wong
Form values numeric, need to lookup value for sending in email
191433 by: rogue
191442 by: Justin Patrin
using exec/system function within php/apache app
191441 by: bruce
191452 by: Ed Lazor
191453 by: Justin Patrin
191454 by: bruce
191460 by: bruce
191468 by: Jason Wong
Quickbooks
191446 by: Ed Lazor
Re: Zend Enc and 0T Q
191457 by: raditha dissanayake
extracting substring from large text blob
191458 by: Redmond Militante
Re: preg_match question
191461 by: John Van Pelt
[Newbie Guide] For the benefit of new members
191467 by: Ma Siva Kumar
Help with a image upload class
191470 by: Joe Harman
191471 by: Jason Wong
Re: PHP-5 book
191481 by: Nadim Attari
PHP 5 and Implicit cloning
191482 by: Jules
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
Thanks, but that isn't the problem. I just rewrote the code wrong for the email. This is a PHP5 bug, I'm quite sure. I'm going to test under IIS, then give it a shot under linux.
-----Original Message-----
From: Jason Barnett [mailto:jasbarne
indiana.edu]
Sent: Wed 7/21/2004 1:45 AM
To: Scott Hyndman
Cc: php-general
lists.php.net
Subject: Re: PHP5 - Weird Error - "cannot find element in variable"
Reply to the group, not just to me - there are a lot of people smarter than I on
this list. Based on your class I can see that you're simply creating your
objects with the wrong parameters - you've switched position and name. Just
change your while loop to:
while (!$res->EOF)
{
$f = $res->fields;
// Position and name switched
$collection->Add(new Amenity($f['position'], $f['name'], $f['context']));
$res->MoveNext();
}
-------- Original Message --------
Subject: RE: [PHP] Re: PHP5 - Weird Error - "cannot find element in variable"
Date: Wed, 21 Jul 2004 00:27:29 -0400
From: Scott Hyndman <Scott
affsys.com>
To: Jason Barnett <jasbarne
indiana.edu>
Overwriting at that index is intended.
Object (Really called Amenity) is defined as such:
class Amenity
{
public $position;
public $name;
public $description;
public $context;
public $state = AMENITY_STATE_INHERIT;
/**
* Creates a new Amenity instance
*/
public function Amenity($position, $name, $context)
{
$this->position = $position;
$this->name = $name;
$this->context = $context;
}
/**
* Returns a string representation of the object
*
* Dependent on the value of the state member, ToString() returns
* one of the following
* - AMENITY_STATE_TRUE a "Y" is returned
* - AMENITY_STATE_FALSE an "N" is returned
* - AMENITY_STATE_INHERIT a "." is returned
*
*
returns string The string
*/
public function ToString()
{
switch ($this->state)
{
case AMENITY_STATE_TRUE:
return "Y";
break;
case AMENITY_STATE_FALSE:
return "N";
break;
case AMENITY_STATE_INHERIT:
return ".";
break;
}
}
}
As you can see, it is in order.
Even now that I’ve removed the iterators, I’m still running into this problem
when accessing the value of an array containing these objects (sometimes). Very
strange behaviour!
-Scott
attached mail follows:
The reason I know this is because it works the first time I create this collection, but then when I clone the object, and try to view it's insides using the debugger (Zend IDE 3.5) by pressing on the plus sign (indicating that it recognizes this as an instantiated object), it suddenly says the insides are null, and throughs a PHP notice (the one in the subject) to the debugging console.
How can you explain that?
-----Original Message-----
From: Curt Zirzow [mailto:php-general
zirzow.dyndns.org]
Sent: Wed 7/21/2004 12:58 AM
To: php-general
lists.php.net
Cc:
Subject: Re: [PHP] PHP5 - Weird Error - "cannot find element in variable"
* Thus wrote Scott Hyndman:
>
> Now here's the problem. When I'm debugging this thing, the line that
> I've marked doesn't actually add anything to the array. If I try to view
> the contents of the array, it gives me a "cannot find element in
> variable" error. Later, when I iterate through it, two elements are
> outputted (don't ask me why, my iterator is perfect, I checked). Can
> someone shed some light on this? It's pretty annoying...in the mean
> time, I'll just use arrays.
There are many things that can be going wrong. First thing is that
your collection object is relying on an external value for its
internal index.
Second, being that it is external, the value may be repeating
itself, or as what has been pointed out earlier, is being converted
to true/false.
Third, from the looks of the code, it looks like your trying to
force the index to be the order of the position of the object:
<?php
$ar[5] = 'last';
$ar[1] = 'first';
$ar[4] = 'second';
print_r($ar);
/*
Array
(
[5] => last
[1] => first
[4] => second
)
*/
As noted in the output, php simply pushes new key/values to the
end.
Fourth, how are you accessing the array to get the 'cannot find
element in variable' error. I've never heard of such an error.
And finally, print_r($this->arr_objects), each time you Add(), and
see how exactly the array looks each time. If you have more than
two elements after the last Add(), then your iterator is most
likely not working properly.
Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
You assume the order matters to me, and that overwriting isn't it's intended behaviour.
The fact remains that I'm creating this object, and it says "cannot find element in variable".
Does ANYONE know what this means?
-----Original Message-----
From: Curt Zirzow [mailto:php-general
zirzow.dyndns.org]
Sent: Wed 7/21/2004 12:58 AM
To: php-general
lists.php.net
Cc:
Subject: Re: [PHP] PHP5 - Weird Error - "cannot find element in variable"
* Thus wrote Scott Hyndman:
>
> Now here's the problem. When I'm debugging this thing, the line that
> I've marked doesn't actually add anything to the array. If I try to view
> the contents of the array, it gives me a "cannot find element in
> variable" error. Later, when I iterate through it, two elements are
> outputted (don't ask me why, my iterator is perfect, I checked). Can
> someone shed some light on this? It's pretty annoying...in the mean
> time, I'll just use arrays.
There are many things that can be going wrong. First thing is that
your collection object is relying on an external value for its
internal index.
Second, being that it is external, the value may be repeating
itself, or as what has been pointed out earlier, is being converted
to true/false.
Third, from the looks of the code, it looks like your trying to
force the index to be the order of the position of the object:
<?php
$ar[5] = 'last';
$ar[1] = 'first';
$ar[4] = 'second';
print_r($ar);
/*
Array
(
[5] => last
[1] => first
[4] => second
)
*/
As noted in the output, php simply pushes new key/values to the
end.
Fourth, how are you accessing the array to get the 'cannot find
element in variable' error. I've never heard of such an error.
And finally, print_r($this->arr_objects), each time you Add(), and
see how exactly the array looks each time. If you have more than
two elements after the last Add(), then your iterator is most
likely not working properly.
Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
* Thus wrote Scott Hyndman:
> Okay, I'm getting this error in a class I've written. I can't explain
> it.
it works perfectly fine for me:
http://zirzow.dyndns.org/html/php/oop5/IA.php
With the information you provided its near impossible to tell you
whats wrong.
Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!
attached mail follows:
Michael Sims wrote:
> Justin Patrin wrote:
>> On Wed, 21 Jul 2004 10:09:52 -0700, bruce <bedouglas
earthlink.net>
>> wrote:
>>> 2) i could run the perl script, and have it somehow run in the
>>> background.... this would ba good, if there's a way to essentially
> [...]
>> AFAIK there's no way to do this. When the request ends (user hits
>> stop, exit or die called) the process is ended. This includes
>> children.
>
> There are ways around that, though, at least if you're running unix:
>
> exec('bash -c "exec nohup setsid your_command > /dev/null 2>&1 &"');
Sorry to followup to my own post, but I just did some quick testing and apparently
none of the above (nohup, setsid) is really necessary. As long as the output of the
command is redirected somewhere and the "&" is used to start it in the background it
will continue to run even if the process that launched it exits or is killed. I
tested this with the following (named 'test.php'):
---
#!/usr/local/bin/php
<?
if (isset($argv[1])) {
exec('./test.php > /dev/null &');
}
sleep(10);
exec('wall testing - ignore '.getmypid());
?>
---
I opened two SSH sessions, ran the above script in one (using './test.php 1') then
immediately exited the SSH session. The PHP processes (both of them) continued to
execute and I saw the "wall" output from both scripts in my other SSH session. So
apparently the nohup setsid stuff is overkill...
attached mail follows:
On Wed, 21 Jul 2004 13:16:01 -0500, Michael Sims
<michaels
crye-leike.com> wrote:
> Justin Patrin wrote:
> > On Wed, 21 Jul 2004 10:09:52 -0700, bruce <bedouglas
earthlink.net>
> > wrote:
> >> 2) i could run the perl script, and have it somehow run in the
> >> background.... this would ba good, if there's a way to essentially
> [...]
> > AFAIK there's no way to do this. When the request ends (user hits
> > stop, exit or die called) the process is ended. This includes
> > children.
>
> There are ways around that, though, at least if you're running unix:
>
> exec('bash -c "exec nohup setsid your_command > /dev/null 2>&1 &"');
>
> I found this method in a user contributed note underneath the documentation for
> exec() and it works rather well. The exec call returns very quickly and the child
> process continues to run even after the parent process dies. The important part of
> the above command is "nohup" which runs a command that ignores hangup signals.
>
Of course...nohup. But that will only work if your provider allows it
(and has it installed).
> > If you could set it off asynchronously, there would be no
> > way of knowing when it ended as the process wouldn't have access to
> > that session any more.
>
> If the OP could reimplement his perl script in PHP it could be passed the session ID
> as an argument. The child process could then call session_id($argv[1]) before
> calling session_start(), and finally update the session data to indicate its current
> status.
>
> If that's out of the question the perl script could update its status in a database
> table as you suggested...
>
Or he could write a simple PHP wrapper that runs the perl script then
updates the session.
--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder
paperCrane --Justin Patrin--
attached mail follows:
On Wed, 21 Jul 2004 13:55:37 -0500, Michael Sims
<michaels
crye-leike.com> wrote:
> Michael Sims wrote:
> > Justin Patrin wrote:
> >> On Wed, 21 Jul 2004 10:09:52 -0700, bruce <bedouglas
earthlink.net>
> >> wrote:
> >>> 2) i could run the perl script, and have it somehow run in the
> >>> background.... this would ba good, if there's a way to essentially
> > [...]
> >> AFAIK there's no way to do this. When the request ends (user hits
> >> stop, exit or die called) the process is ended. This includes
> >> children.
> >
> > There are ways around that, though, at least if you're running unix:
> >
> > exec('bash -c "exec nohup setsid your_command > /dev/null 2>&1 &"');
>
> Sorry to followup to my own post, but I just did some quick testing and apparently
> none of the above (nohup, setsid) is really necessary. As long as the output of the
> command is redirected somewhere and the "&" is used to start it in the background it
> will continue to run even if the process that launched it exits or is killed. I
> tested this with the following (named 'test.php'):
>
> ---
> #!/usr/local/bin/php
> <?
>
> if (isset($argv[1])) {
> exec('./test.php > /dev/null &');
> }
>
> sleep(10);
>
> exec('wall testing - ignore '.getmypid());
> ?>
> ---
>
> I opened two SSH sessions, ran the above script in one (using './test.php 1') then
> immediately exited the SSH session. The PHP processes (both of them) continued to
> execute and I saw the "wall" output from both scripts in my other SSH session. So
> apparently the nohup setsid stuff is overkill...
>
Did you try it from the web? Just to be devil's advocate and be sure
that, say, clicking Stop doesn't stop the background process. Also,
does *killing* the original script kill the child?
--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder
paperCrane --Justin Patrin--
attached mail follows:
michael...
i had tried earlier to implement what you had seen.
my attempt (below) never seemed to work properly...
php -r 'exec("perl /home/test/college.pl /dev/null 2>&1 &");' <<< works, but
doesn't return until the perl app completes...
php -r 'exec("bash -c 'exec nohup perl /home/test/college.pl /dev/null 2>&1
&'");' <<< can't get this to work/return....
any ideas as to what i'm missing...
thanks
-bruce
-----Original Message-----
From: Michael Sims [mailto:michaels
crye-leike.com]
Sent: Wednesday, July 21, 2004 11:16 AM
To: php-general
lists.php.net
Subject: RE: [PHP] exec/system question..
Justin Patrin wrote:
> On Wed, 21 Jul 2004 10:09:52 -0700, bruce <bedouglas
earthlink.net>
> wrote:
>> 2) i could run the perl script, and have it somehow run in the
>> background.... this would ba good, if there's a way to essentially
[...]
> AFAIK there's no way to do this. When the request ends (user hits
> stop, exit or die called) the process is ended. This includes
> children.
There are ways around that, though, at least if you're running unix:
exec('bash -c "exec nohup setsid your_command > /dev/null 2>&1 &"');
I found this method in a user contributed note underneath the documentation
for
exec() and it works rather well. The exec call returns very quickly and the
child
process continues to run even after the parent process dies. The important
part of
the above command is "nohup" which runs a command that ignores hangup
signals.
> If you could set it off asynchronously, there would be no
> way of knowing when it ended as the process wouldn't have access to
> that session any more.
If the OP could reimplement his perl script in PHP it could be passed the
session ID
as an argument. The child process could then call session_id($argv[1])
before
calling session_start(), and finally update the session data to indicate its
current
status.
If that's out of the question the perl script could update its status in a
database
table as you suggested...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
bruce wrote:
> my attempt (below) never seemed to work properly...
>
> php -r 'exec("perl /home/test/college.pl /dev/null 2>&1 &");' <<<
> works, but doesn't return until the perl app completes...
>
>
> php -r 'exec("bash -c 'exec nohup perl /home/test/college.pl
> /dev/null 2>&1 &'");' <<< can't get this to work/return....
In what you've got above you are passing "/dev/null" as an argument to perl script
instead of redirecting to it, since you're missing the ">"...so change it to:
php -r 'exec("bash -c 'exec nohup perl /home/test/college.pl >/dev/null 2>&1 &'");'
attached mail follows:
michael...
something strange is happening/or i'm missing something basic... but here's
the sys response from your suggestion...
[root
lserver2 test]# php -r 'exec("bash -c 'exec nohup perl
/home/test/college.pl >/dev/null 2>&1 &'");'
[3] 2566
-bash: ");: command not found
-bruce
-----Original Message-----
From: Michael Sims [mailto:michaels
crye-leike.com]
Sent: Wednesday, July 21, 2004 12:26 PM
To: bedouglas
earthlink.net; php-general
lists.php.net
Subject: RE: [PHP] exec/system question..
bruce wrote:
> my attempt (below) never seemed to work properly...
>
> php -r 'exec("perl /home/test/college.pl /dev/null 2>&1 &");' <<<
> works, but doesn't return until the perl app completes...
>
>
> php -r 'exec("bash -c 'exec nohup perl /home/test/college.pl
> /dev/null 2>&1 &'");' <<< can't get this to work/return....
In what you've got above you are passing "/dev/null" as an argument to perl
script
instead of redirecting to it, since you're missing the ">"...so change it
to:
php -r 'exec("bash -c 'exec nohup perl /home/test/college.pl >/dev/null 2>&1
&'");'
attached mail follows:
Justin Patrin wrote:
> On Wed, 21 Jul 2004 13:55:37 -0500, Michael Sims
> <michaels
crye-leike.com> wrote:
>
>>Michael Sims wrote:
>>
>>>Justin Patrin wrote:
>>>
>>>>On Wed, 21 Jul 2004 10:09:52 -0700, bruce <bedouglas
earthlink.net>
>>>>wrote:
>>>>
>>>>>2) i could run the perl script, and have it somehow run in the
>>>>>background.... this would ba good, if there's a way to essentially
>>>
>>>[...]
>>>
>>>>AFAIK there's no way to do this. When the request ends (user hits
>>>>stop, exit or die called) the process is ended. This includes
>>>>children.
>>>
>>>There are ways around that, though, at least if you're running unix:
>>>
>>>exec('bash -c "exec nohup setsid your_command > /dev/null 2>&1 &"');
>>
>>Sorry to followup to my own post, but I just did some quick testing and apparently
>>none of the above (nohup, setsid) is really necessary. As long as the output of the
>>command is redirected somewhere and the "&" is used to start it in the background it
>>will continue to run even if the process that launched it exits or is killed. I
>>tested this with the following (named 'test.php'):
>>
>>---
>>#!/usr/local/bin/php
>><?
>>
>>if (isset($argv[1])) {
>> exec('./test.php > /dev/null &');
>>}
>>
>>sleep(10);
>>
>>exec('wall testing - ignore '.getmypid());
>>?>
>>---
>>
>>I opened two SSH sessions, ran the above script in one (using './test.php 1') then
>>immediately exited the SSH session. The PHP processes (both of them) continued to
>>execute and I saw the "wall" output from both scripts in my other SSH session. So
>>apparently the nohup setsid stuff is overkill...
>>
>
>
> Did you try it from the web? Just to be devil's advocate and be sure
> that, say, clicking Stop doesn't stop the background process. Also,
> does *killing* the original script kill the child?
It's a well-understood technique; I have used it quite a bit--mostly in
web-based scripts. If you like, you can even redirect your output to a file
instead of /dev/null, and put a refresh on the calling page which checks that
file, providing a progress update on each reload.
Hope this helps,
Torben <torben
php.net>
attached mail follows:
Justin Patrin wrote:
> On Wed, 21 Jul 2004 13:55:37 -0500, Michael Sims
> <michaels
crye-leike.com> wrote:
>> Sorry to followup to my own post, but I just did some quick testing
>> and apparently none of the above (nohup, setsid) is really
>> necessary. As long as the output of the command is redirected
>> somewhere and the "&" is used to start it in the background it will
>> continue to run even if the process that launched it exits or is
>> killed. I tested this with the following (named 'test.php'):
[...]
> Did you try it from the web?
No, I didn't actually try it via an apache request without the nohup. I should do
that...
> Just to be devil's advocate and be sure
> that, say, clicking Stop doesn't stop the background process. Also,
> does *killing* the original script kill the child?
No. I tried killing the script via kill and then kill -9, allowing the "parent"
script to exit normally BEFORE the child (by having the child sleep() longer than
the parent), and disconnnecting from the controlling tty before the process
finished. In all of the above tests the child process lived on and exited normally.
It seems to me that the PHP interpreter intentionally ignores hangup signals when it
detects that it's output is not being sent to a terminal. Of course, this is
getting a bit beyond my current understanding of processes, signals, etc. so I could
be completely full of it. :)
attached mail follows:
Justin Patrin wrote:
> On Wed, 21 Jul 2004 13:55:37 -0500, Michael Sims
> <michaels
crye-leike.com> wrote:
>
>>Michael Sims wrote:
>>
>>>Justin Patrin wrote:
>>>
>>>>On Wed, 21 Jul 2004 10:09:52 -0700, bruce <bedouglas
earthlink.net>
>>>>wrote:
>>>>
>>>>>2) i could run the perl script, and have it somehow run in the
>>>>>background.... this would ba good, if there's a way to essentially
>>>
>>>[...]
>>>
>>>>AFAIK there's no way to do this. When the request ends (user hits
>>>>stop, exit or die called) the process is ended. This includes
>>>>children.
>>>
>>>There are ways around that, though, at least if you're running unix:
>>>
>>>exec('bash -c "exec nohup setsid your_command > /dev/null 2>&1 &"');
>>
>>Sorry to followup to my own post, but I just did some quick testing and apparently
>>none of the above (nohup, setsid) is really necessary. As long as the output of the
>>command is redirected somewhere and the "&" is used to start it in the background it
>>will continue to run even if the process that launched it exits or is killed. I
>>tested this with the following (named 'test.php'):
>>
>>---
>>#!/usr/local/bin/php
>><?
>>
>>if (isset($argv[1])) {
>> exec('./test.php > /dev/null &');
>>}
>>
>>sleep(10);
>>
>>exec('wall testing - ignore '.getmypid());
>>?>
>>---
>>
>>I opened two SSH sessions, ran the above script in one (using './test.php 1') then
>>immediately exited the SSH session. The PHP processes (both of them) continued to
>>execute and I saw the "wall" output from both scripts in my other SSH session. So
>>apparently the nohup setsid stuff is overkill...
>>
>
>
> Did you try it from the web? Just to be devil's advocate and be sure
> that, say, clicking Stop doesn't stop the background process. Also,
> does *killing* the original script kill the child?
It's a well-understood technique; I have used it quite a bit--mostly in
web-based scripts. If you like, you can even redirect your output to a file
instead of /dev/null, and put a refresh on the calling page which checks that
file, providing a progress update on each reload.
Hope this helps,
Torben <torben
php.net>
attached mail follows:
ok...
php -r 'exec("perl /home/test/college.pl >/dev/null &");' seems to do the
trick... in that it returns, while running the perl process in the
background...
i assume that this process will work from a web app, regardless of the user
function, or even the behavior of the web server, although that may have
something to do with what process/priv is running the app....
thanks,
-bruce
-----Original Message-----
From: Justin Patrin [mailto:papercrane
gmail.com]
Sent: Wednesday, July 21, 2004 12:21 PM
To: Michael Sims
Cc: php-general
lists.php.net
Subject: Re: [PHP] exec/system question..
On Wed, 21 Jul 2004 13:55:37 -0500, Michael Sims
<michaels
crye-leike.com> wrote:
> Michael Sims wrote:
> > Justin Patrin wrote:
> >> On Wed, 21 Jul 2004 10:09:52 -0700, bruce <bedouglas
earthlink.net>
> >> wrote:
> >>> 2) i could run the perl script, and have it somehow run in the
> >>> background.... this would ba good, if there's a way to essentially
> > [...]
> >> AFAIK there's no way to do this. When the request ends (user hits
> >> stop, exit or die called) the process is ended. This includes
> >> children.
> >
> > There are ways around that, though, at least if you're running unix:
> >
> > exec('bash -c "exec nohup setsid your_command > /dev/null 2>&1 &"');
>
> Sorry to followup to my own post, but I just did some quick testing and
apparently
> none of the above (nohup, setsid) is really necessary. As long as the
output of the
> command is redirected somewhere and the "&" is used to start it in the
background it
> will continue to run even if the process that launched it exits or is
killed. I
> tested this with the following (named 'test.php'):
>
> ---
> #!/usr/local/bin/php
> <?
>
> if (isset($argv[1])) {
> exec('./test.php > /dev/null &');
> }
>
> sleep(10);
>
> exec('wall testing - ignore '.getmypid());
> ?>
> ---
>
> I opened two SSH sessions, ran the above script in one (using './test.php
1') then
> immediately exited the SSH session. The PHP processes (both of them)
continued to
> execute and I saw the "wall" output from both scripts in my other SSH
session. So
> apparently the nohup setsid stuff is overkill...
>
Did you try it from the web? Just to be devil's advocate and be sure
that, say, clicking Stop doesn't stop the background process. Also,
does *killing* the original script kill the child?
--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder
paperCrane --Justin Patrin--
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
bruce wrote:
> michael...
>
> something strange is happening/or i'm missing something basic... but
> here's the sys response from your suggestion...
>
> [root
lserver2 test]# php -r 'exec("bash -c 'exec nohup perl
> /home/test/college.pl >/dev/null 2>&1 &'");'
> [3] 2566
> -bash: ");: command not found
Sorry, you've got to either escape the embedded single quotes:
php -r 'exec("bash -c '\''exec nohup perl /home/test/college.pl >/dev/null 2>&1
&'\''");'
or just use double quotes and escape the embedded double quotes:
php -r "exec(\"bash -c 'exec nohup perl /home/test/college.pl >/dev/null 2>&1
&'\");"
attached mail follows:
my command line tests seem to work ok...
however, when i create a simple php test using the exec(...) it doesn't seem
to work. in fact i can't tell if the exec ever really gets executed!! i have
errors/warnings turned on within the php environment. as far as i can tell,
i have nothing within the php.ini file disabled/enabled which would cause
issues.
but i fail to see the child process in the process table.
any ideas/possible places i should look for the cause of this behavior..???
thanks
-bruce
-----Original Message-----
From: Michael Sims [mailto:michaels
crye-leike.com]
Sent: Wednesday, July 21, 2004 12:43 PM
To: papercrane
reversefold.com
Cc: php-general
lists.php.net
Subject: RE: [PHP] exec/system question..
Justin Patrin wrote:
> On Wed, 21 Jul 2004 13:55:37 -0500, Michael Sims
> <michaels
crye-leike.com> wrote:
>> Sorry to followup to my own post, but I just did some quick testing
>> and apparently none of the above (nohup, setsid) is really
>> necessary. As long as the output of the command is redirected
>> somewhere and the "&" is used to start it in the background it will
>> continue to run even if the process that launched it exits or is
>> killed. I tested this with the following (named 'test.php'):
[...]
> Did you try it from the web?
No, I didn't actually try it via an apache request without the nohup. I
should do
that...
> Just to be devil's advocate and be sure
> that, say, clicking Stop doesn't stop the background process. Also,
> does *killing* the original script kill the child?
No. I tried killing the script via kill and then kill -9, allowing the
"parent"
script to exit normally BEFORE the child (by having the child sleep() longer
than
the parent), and disconnnecting from the controlling tty before the process
finished. In all of the above tests the child process lived on and exited
normally.
It seems to me that the PHP interpreter intentionally ignores hangup signals
when it
detects that it's output is not being sent to a terminal. Of course, this
is
getting a bit beyond my current understanding of processes, signals, etc. so
I could
be completely full of it. :)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Has anyone every wrote script too send a message to any of the popular
messenger services, i see there is a perl module for jabber, however,
im more interested in using php to send to .. msn, or yahoo, and
jabber of coarse :)
Jason
attached mail follows:
Hello,
On 07/21/2004 04:00 PM, Jason Davidson wrote:
> Has anyone every wrote script too send a message to any of the popular
> messenger services, i see there is a perl module for jabber, however,
> im more interested in using php to send to .. msn, or yahoo, and
> jabber of coarse :)
Here you may find several solutions for at lease some of those systems:
http://www.phpclasses.org/browse/class/66.html
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
attached mail follows:
hey cool, thanks for the info
Jason
On Wed, 21 Jul 2004 18:15:12 -0300, Manuel Lemos <mlemos
acm.org> wrote:
> Hello,
>
>
>
> On 07/21/2004 04:00 PM, Jason Davidson wrote:
> > Has anyone every wrote script too send a message to any of the popular
> > messenger services, i see there is a perl module for jabber, however,
> > im more interested in using php to send to .. msn, or yahoo, and
> > jabber of coarse :)
>
> Here you may find several solutions for at lease some of those systems:
>
> http://www.phpclasses.org/browse/class/66.html
>
> --
>
> Regards,
> Manuel Lemos
>
> PHP Classes - Free ready to use OOP components written in PHP
> http://www.phpclasses.org/
>
> PHP Reviews - Reviews of PHP books and other products
> http://www.phpclasses.org/reviews/
>
> Metastorage - Data object relational mapping layer generator
> http://www.meta-language.net/metastorage.html
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
Jason Davidson wrote:
>Has anyone every wrote script too send a message to any of the popular
>messenger services, i see there is a perl module for jabber, however,
>im more interested in using php to send to .. msn, or yahoo, and
>jabber of coarse :)
>
>
Try jabberstudio.com this is a sourceforge like site specificaly for
jabber related projects.
--
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.
attached mail follows:
I have a search page with three parameters....author, title and journal.
I typed in "heart" in the title text area and hit the return button,
thinking it would activate the search button. it merely did a carriage
return in the text area, then I hit the submit button.
the result came back as null, as there is not title that has the word
"heart" in it with a carriage return afterwards. if I take our the return,
it finds the heart articles.
I tried a similar thing in the author section, putting a space after the
author name...same empty results.
I would like to fix that.
THANKS!!
----- Original Message -----
> What exactly are you trying to do? trim() only rmeoves whitespace from
> the beginning and end of a string. It doesn't work on a record / array
> and it doesn't pull all whitespace from the string.
>
> $str = ' whitespace before and after ';
> $trimmedStr = trim($str);
> $noWhitespaceStr = preg_replace('/\s/', '', $str);
>
> On Wed, 21 Jul 2004 13:54:22 -0400, melissa atchley
> <melissa
maddesignusa.com> wrote:
> > thanks guys...but with all of the >>>> in the message, the syntax is not
> > coming through.
> >
> > I have tried adding the trim() line in several ways and it isn't
working.
> > can you help me with the exact syntax?
> >
> >
> >
> > ----- Original Message -----
> > From: "Justin Patrin" <papercrane
gmail.com>
> > To: "John W. Holmes" <holmes072000
charter.net>
> > Cc: "msa" <melissa
maddesignusa.com>; <php-general
lists.php.net>
> > Sent: Wednesday, July 21, 2004 1:12 PM
> > Subject: Re: [PHP] trim() white space from record set
> >
> > > On Wed, 21 Jul 2004 12:41:55 -0400, John W. Holmes
> > > <holmes072000
charter.net> wrote:
> > > > msa wrote:
> > > >
> > > > > I created a search form with multiple search parameters. It
returns
> > nothing
> > > > > if there is a space after their text entry or if they hit return
in
> > the text
> > > > > area.
> > > > >
> > > > > $coltitle_rsResults = "0";
> > > > > if (isset($_GET['Title'])) {
> > > > $_GET['title'] = trim($_GET['title']);
> > > > > $coltitle_rsResults = (get_magic_quotes_gpc()) ? $_GET['Title']
:
> > > > > addslashes($_GET['Title']);
> > > > >
> > > > > where do i put the trim?
> > > >
> > > > See above. You have to assign the result of trim() to a variable. My
> > > > crystal ball (it's back off of loan now) says that was the issue. :)
> > > >
> > >
> > > Ugh....damn Perl and its auto-assign and $_ features. It makes people
> > > assume things...
> > >
> > >
> > > --
> > > DB_DataObject_FormBuilder - The database at your fingertips
> > > http://pear.php.net/package/DB_DataObject_FormBuilder
> > >
> > > paperCrane --Justin Patrin--
> >
> >
> > !DSPAM:40feabc142245912817392!
> >
> >
>
>
> --
> DB_DataObject_FormBuilder - The database at your fingertips
> http://pear.php.net/package/DB_DataObject_FormBuilder
>
> paperCrane --Justin Patrin--
attached mail follows:
On Wed, 21 Jul 2004 15:00:39 -0400, melissa atchley
<melissa
maddesignusa.com> wrote:
> I have a search page with three parameters....author, title and journal.
>
> I typed in "heart" in the title text area and hit the return button,
> thinking it would activate the search button. it merely did a carriage
> return in the text area, then I hit the submit button.
>
> the result came back as null, as there is not title that has the word
> "heart" in it with a carriage return afterwards. if I take our the return,
> it finds the heart articles.
>
> I tried a similar thing in the author section, putting a space after the
> author name...same empty results.
>
> I would like to fix that.
>
Ok, this is simple. Assuming you pass in author as the variable author
in POST...
$author = trim($_POST['author']);
>
>
>
> ----- Original Message -----
>
> > What exactly are you trying to do? trim() only rmeoves whitespace from
> > the beginning and end of a string. It doesn't work on a record / array
> > and it doesn't pull all whitespace from the string.
> >
> > $str = ' whitespace before and after ';
> > $trimmedStr = trim($str);
> > $noWhitespaceStr = preg_replace('/\s/', '', $str);
> >
> > On Wed, 21 Jul 2004 13:54:22 -0400, melissa atchley
> > <melissa
maddesignusa.com> wrote:
> > > thanks guys...but with all of the >>>> in the message, the syntax is not
> > > coming through.
> > >
> > > I have tried adding the trim() line in several ways and it isn't
> working.
> > > can you help me with the exact syntax?
> > >
> > >
> > >
> > > ----- Original Message -----
> > > From: "Justin Patrin" <papercrane
gmail.com>
> > > To: "John W. Holmes" <holmes072000
charter.net>
> > > Cc: "msa" <melissa
maddesignusa.com>; <php-general
lists.php.net>
> > > Sent: Wednesday, July 21, 2004 1:12 PM
> > > Subject: Re: [PHP] trim() white space from record set
> > >
> > > > On Wed, 21 Jul 2004 12:41:55 -0400, John W. Holmes
> > > > <holmes072000
charter.net> wrote:
> > > > > msa wrote:
> > > > >
> > > > > > I created a search form with multiple search parameters. It
> returns
> > > nothing
> > > > > > if there is a space after their text entry or if they hit return
> in
> > > the text
> > > > > > area.
> > > > > >
> > > > > > $coltitle_rsResults = "0";
> > > > > > if (isset($_GET['Title'])) {
> > > > > $_GET['title'] = trim($_GET['title']);
> > > > > > $coltitle_rsResults = (get_magic_quotes_gpc()) ? $_GET['Title']
> :
> > > > > > addslashes($_GET['Title']);
> > > > > >
> > > > > > where do i put the trim?
> > > > >
> > > > > See above. You have to assign the result of trim() to a variable. My
> > > > > crystal ball (it's back off of loan now) says that was the issue. :)
> > > > >
> > > >
> > > > Ugh....damn Perl and its auto-assign and $_ features. It makes people
> > > > assume things...
> > > >
> > > >
> > > > --
> > > > DB_DataObject_FormBuilder - The database at your fingertips
> > > > http://pear.php.net/package/DB_DataObject_FormBuilder
> > > >
> > > > paperCrane --Justin Patrin--
> > >
> > >
> > >
> > >
> > >
> >
> >
> > --
> > DB_DataObject_FormBuilder - The database at your fingertips
> > http://pear.php.net/package/DB_DataObject_FormBuilder
> >
> > paperCrane --Justin Patrin--
>
>
--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder
paperCrane --Justin Patrin--
attached mail follows:
aaah, simple for you..
I have to fit that line into the following:
$colauthor_rsResults = "0";
if (isset($_GET['Author'])) {
$colauthor_rsResults = (get_magic_quotes_gpc()) ? $_GET['Author'] :
addslashes($_GET['Author']);
}
and don't know how to do that.....also, I am using GET....
"Justin Patrin" <papercrane
gmail.com> wrote in message
news:432beae04072112181f6ef81
mail.gmail.com...
> On Wed, 21 Jul 2004 15:00:39 -0400, melissa atchley
> <melissa
maddesignusa.com> wrote:
> > I have a search page with three parameters....author, title and journal.
> >
> > I typed in "heart" in the title text area and hit the return button,
> > thinking it would activate the search button. it merely did a carriage
> > return in the text area, then I hit the submit button.
> >
> > the result came back as null, as there is not title that has the word
> > "heart" in it with a carriage return afterwards. if I take our the
return,
> > it finds the heart articles.
> >
> > I tried a similar thing in the author section, putting a space after the
> > author name...same empty results.
> >
> > I would like to fix that.
> >
>
> Ok, this is simple. Assuming you pass in author as the variable author
> in POST...
>
> $author = trim($_POST['author']);
>
> >
> >
> >
> > ----- Original Message -----
> >
> > > What exactly are you trying to do? trim() only rmeoves whitespace from
> > > the beginning and end of a string. It doesn't work on a record / array
> > > and it doesn't pull all whitespace from the string.
> > >
> > > $str = ' whitespace before and after ';
> > > $trimmedStr = trim($str);
> > > $noWhitespaceStr = preg_replace('/\s/', '', $str);
> > >
> > > On Wed, 21 Jul 2004 13:54:22 -0400, melissa atchley
> > > <melissa
maddesignusa.com> wrote:
> > > > thanks guys...but with all of the >>>> in the message, the syntax is
not
> > > > coming through.
> > > >
> > > > I have tried adding the trim() line in several ways and it isn't
> > working.
> > > > can you help me with the exact syntax?
> > > >
> > > >
> > > >
> > > > ----- Original Message -----
> > > > From: "Justin Patrin" <papercrane
gmail.com>
> > > > To: "John W. Holmes" <holmes072000
charter.net>
> > > > Cc: "msa" <melissa
maddesignusa.com>; <php-general
lists.php.net>
> > > > Sent: Wednesday, July 21, 2004 1:12 PM
> > > > Subject: Re: [PHP] trim() white space from record set
> > > >
> > > > > On Wed, 21 Jul 2004 12:41:55 -0400, John W. Holmes
> > > > > <holmes072000
charter.net> wrote:
> > > > > > msa wrote:
> > > > > >
> > > > > > > I created a search form with multiple search parameters. It
> > returns
> > > > nothing
> > > > > > > if there is a space after their text entry or if they hit
return
> > in
> > > > the text
> > > > > > > area.
> > > > > > >
> > > > > > > $coltitle_rsResults = "0";
> > > > > > > if (isset($_GET['Title'])) {
> > > > > > $_GET['title'] = trim($_GET['title']);
> > > > > > > $coltitle_rsResults = (get_magic_quotes_gpc()) ?
$_GET['Title']
> > :
> > > > > > > addslashes($_GET['Title']);
> > > > > > >
> > > > > > > where do i put the trim?
> > > > > >
> > > > > > See above. You have to assign the result of trim() to a
variable. My
> > > > > > crystal ball (it's back off of loan now) says that was the
issue. :)
> > > > > >
> > > > >
> > > > > Ugh....damn Perl and its auto-assign and $_ features. It makes
people
> > > > > assume things...
> > > > >
> > > > >
> > > > > --
> > > > > DB_DataObject_FormBuilder - The database at your fingertips
> > > > > http://pear.php.net/package/DB_DataObject_FormBuilder
> > > > >
> > > > > paperCrane --Justin Patrin--
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > > --
> > > DB_DataObject_FormBuilder - The database at your fingertips
> > > http://pear.php.net/package/DB_DataObject_FormBuilder
> > >
> > > paperCrane --Justin Patrin--
> >
> >
>
> --
> DB_DataObject_FormBuilder - The database at your fingertips
> http://pear.php.net/package/DB_DataObject_FormBuilder
>
> paperCrane --Justin Patrin--
attached mail follows:
check this link
simple example
http://perl.about.com/library/weekly/aa121002c.htm
On Wed, 21 Jul 2004 13:39:32 -0500, Alex Hogan
<alex.hogan
alliedelec.com> wrote:
> Hi All,
>
> How do I write a function with optional arguments? Is it possible in
> php?
>
> function myfunc($First, $Second,[$Third, $Fourth]){
> some stuff here
> }
>
> alex hogan
>
> *************************************************************************************
> The contents of this e-mail and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom it is addressed. The
> views stated herein do not necessarily represent the view of the company. If you are
> not the intended recipient of this e-mail you may not copy, forward, disclose, or
> otherwise use it or any part of it in any form whatsoever. If you have received this
> e-mail in error please e-mail the sender.
> *************************************************************************************
>
attached mail follows:
Alex Hogan wrote:
> Hi All,
>
> How do I write a function with optional arguments? Is it possible in
> php?
>
> function myfunc($First, $Second,[$Third, $Fourth]){
> some stuff here
> }
>
Yes, it's in the manual, I recomend you read it first.
function myfunc($First, $Second, $Third = 'third arguments default
value', $Fourth = 'fourt arguments default value'){
some stuff here
}
attached mail follows:
You can use default arguments:
func foo($first, $second=2, $third=3 etc.
or look at
function func_num_args(...
HIH
Frank
At 01:39 AM 7/22/2004, Alex Hogan wrote:
>Hi All,
>
>How do I write a function with optional arguments? Is it possible in
>php?
>
>function myfunc($First, $Second,[$Third, $Fourth]){
> some stuff here
>}
>
>
>
>alex hogan
>
>
>
>
>
>*************************************************************************************
>The contents of this e-mail and any files transmitted with it are
>confidential and
>intended solely for the use of the individual or entity to whom it is
>addressed. The
>views stated herein do not necessarily represent the view of the company.
>If you are
>not the intended recipient of this e-mail you may not copy, forward,
>disclose, or
>otherwise use it or any part of it in any form whatsoever. If you have
>received this
>e-mail in error please e-mail the sender.
>*************************************************************************************
attached mail follows:
On Wed, 21 Jul 2004 13:39:32 -0500, Alex Hogan
<alex.hogan
alliedelec.com> wrote:
> Hi All,
>
> How do I write a function with optional arguments? Is it possible in
> php?
>
> function myfunc($First, $Second,[$Third, $Fourth]){
> some stuff here
> }
>
Give them a default value and they become optional
function myfunc($First, $Second,$Third = 'something', $Fourth = 'something'){
some stuff here
}
If you want them empty, you can use $Third = '' or $Third = null
depending on what you need.
P.S. *WHY* do you include that outrageous footer? It serves absolutely
no purpose.
--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder
paperCrane --Justin Patrin--
attached mail follows:
I've seen it work with a relative URL, which suprised me, because until
I had saw that I would have agreed with you.
Jon
Chris Shiflett wrote:
>--- Arnout Boks <arnoutboks
hotmail.com> wrote:
>
>
>>header('Location: ' . urlencode('loginForm.php?error=Incorrect
>>password'));
>>
>>
>
>The Location header requires an absolute URL. Also, this is the header you
>are sending:
>
>Location: loginForm.php%3Ferror%3DIncorrect+password
>
>I doubt that's the URL you meant. URL encode the value of URL variables,
>not the entire URL.
>
>Lastly, I hope you're not blindly displaying $_GET['error'] on your
>loginForm.php page, otherwise you have a cross-site scripting
>vulnerability.
>
>Hope that helps.
>
>Chris
>
>=====
>Chris Shiflett - http://shiflett.org/
>
>PHP Security - O'Reilly
> Coming Fall 2004
>HTTP Developer's Handbook - Sams
> http://httphandbook.org/
>PHP Community Site
> http://phpcommunity.org/
>
>
>
attached mail follows:
Most browsers work fine with relative URLs in the Location header. The
spec says it has to be absolute, though, and a few browsers require
it.
On Wed, 21 Jul 2004 15:11:37 -0400, Jonathan Haddad
<jon
oldirtyhaddad.com> wrote:
> I've seen it work with a relative URL, which suprised me, because until
> I had saw that I would have agreed with you.
>
> Jon
>
>
>
> Chris Shiflett wrote:
>
> >--- Arnout Boks <arnoutboks
hotmail.com> wrote:
> >
> >
> >>header('Location: ' . urlencode('loginForm.php?error=Incorrect
> >>password'));
> >>
> >>
> >
> >The Location header requires an absolute URL. Also, this is the header you
> >are sending:
> >
> >Location: loginForm.php%3Ferror%3DIncorrect+password
> >
> >I doubt that's the URL you meant. URL encode the value of URL variables,
> >not the entire URL.
> >
> >Lastly, I hope you're not blindly displaying $_GET['error'] on your
> >loginForm.php page, otherwise you have a cross-site scripting
> >vulnerability.
> >
> >Hope that helps.
> >
> >Chris
> >
> >=====
> >Chris Shiflett - http://shiflett.org/
> >
> >PHP Security - O'Reilly
> > Coming Fall 2004
> >HTTP Developer's Handbook - Sams
> > http://httphandbook.org/
> >PHP Community Site
> > http://phpcommunity.org/
> >
> >
> >
>
--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder
paperCrane --Justin Patrin--
attached mail follows:
--- Jonathan Haddad <jon
oldirtyhaddad.com> wrote:
> I've seen it work with a relative URL, which suprised me,
> because until I had saw that I would have agreed with you.
I assume you mean that you disagree with me.
There is a difference between "works" and "right" (not that a malformed
Location header always works).
See RFC 2616, section 14.30.
Chris
=====
Chris Shiflett - http://shiflett.org/
PHP Security - O'Reilly
Coming Fall 2004
HTTP Developer's Handbook - Sams
http://httphandbook.org/
PHP Community Site
http://phpcommunity.org/
attached mail follows:
Chris Shiflett wrote:
> There is a difference between "works" and "right"
Man... where have I heard that before?!? ;)
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
attached mail follows:
Astrum Et Securis,
We're running our Apache Web Server with PHP & MySQL on a Power MAC G5
(MacOS X) system. And we're currently thinking of making it our web server
giving public access to our website hosted on this machine.
PHP, MySQL, FTP etcetera are all fine, but what about the Mail Server? How
does the mail() in the PHP work... It requires a Mail Server? If so, how can
I install/configure such a mail server so that the mail() can work from our
own server machine?
Thanks,
RSJ
attached mail follows:
Hello,
On 07/21/2004 06:05 PM, Php Junkie wrote:
> We're running our Apache Web Server with PHP & MySQL on a Power MAC G5
> (MacOS X) system. And we're currently thinking of making it our web server
> giving public access to our website hosted on this machine.
>
> PHP, MySQL, FTP etcetera are all fine, but what about the Mail Server? How
> does the mail() in the PHP work... It requires a Mail Server? If so, how can
> I install/configure such a mail server so that the mail() can work from our
> own server machine?
I think there is sendmail for OS X now.
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
attached mail follows:
Is it possible to assign a value to a session variable on say, page1.php:
$_SESSION['favcolor'] = 'blue';
and then on another page, say page2.php reassign the value:
$_SESSION['favcolor'] = 'green'; ?
So far experimentation says no.
attached mail follows:
--- Five <primeooze
hotmail.com> wrote:
> Is it possible to assign a value to a session variable on say,
> page1.php:
>
> $_SESSION['favcolor'] = 'blue';
>
> and then on another page, say page2.php reassign the value:
>
> $_SESSION['favcolor'] = 'green'; ?
Yes.
> So far experimentation says no.
Show us the code! :-)
Chris
=====
Chris Shiflett - http://shiflett.org/
PHP Security - O'Reilly
Coming Fall 2004
HTTP Developer's Handbook - Sams
http://httphandbook.org/
PHP Community Site
http://phpcommunity.org/
attached mail follows:
On Wed, 21 Jul 2004 16:54:14 -0400, Five <primeooze
hotmail.com> wrote:
> Is it possible to assign a value to a session variable on say, page1.php:
>
> $_SESSION['favcolor'] = 'blue';
>
> and then on another page, say page2.php reassign the value:
>
> $_SESSION['favcolor'] = 'green'; ?
>
> So far experimentation says no.
>
Of course it is. How are you testing this? Are you calling
session_start() on page2.php?
--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder
paperCrane --Justin Patrin--
attached mail follows:
My understanding of session variables Five is that you can write and
re-write on the fly.
I know from using VB that this is true and I am assuming that it is true of
PHP. However, you may need to "Empty" the variable first Five.
Hope that helped.
--
-----------------------------
Michael Mason
Arras People
www.arraspeople.co.uk
-----------------------------
"Five" <primeooze
hotmail.com> wrote in message
news:20040721211059.86656.qmail
pb1.pair.com...
> Is it possible to assign a value to a session variable on say, page1.php:
>
> $_SESSION['favcolor'] = 'blue';
>
> and then on another page, say page2.php reassign the value:
>
> $_SESSION['favcolor'] = 'green'; ?
>
> So far experimentation says no.
attached mail follows:
Five wrote:
> Is it possible to assign a value to a session variable on say, page1.php:
>
> $_SESSION['favcolor'] = 'blue';
>
> and then on another page, say page2.php reassign the value:
>
> $_SESSION['favcolor'] = 'green'; ?
>
> So far experimentation says no.
PHP says Yes. Crystal ball says to put session_start() on page2.php
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
attached mail follows:
page1.php
<?php
session_start();
echo 'page #1<br>';
echo $_SESSION['favcolor'];
$_SESSION['favcolor'] = 'green';
echo '<br><a href="page2.php">page 2</a>';
?>
----------------------------------------------------
page2.php
<?php
session_start();
echo 'page #2<br>';
echo $_SESSION['favcolor'];
$_SESSION['favcolor'] = 'blue';
echo '<br><a href="page1.php">page 1</a>';
?>
attached mail follows:
"Five" <primeooze
hotmail.com> wrote in message news:20040721214448.52761.qmail
pb1.pair.com...
> page1.php
> <?php
> session_start();
> echo 'page #1<br>';
>
> echo $_SESSION['favcolor'];
> $_SESSION['favcolor'] = 'green';
>
> echo '<br><a href="page2.php">page 2</a>';
> ?>
>
> ----------------------------------------------------
> page2.php
> <?php
> session_start();
> echo 'page #2<br>';
>
> echo $_SESSION['favcolor'];
> $_SESSION['favcolor'] = 'blue';
>
> echo '<br><a href="page1.php">page 1</a>';
> ?>
Actually the above code doesn't initialize the variable as either green or blue. It leaves it blank.
attached mail follows:
On Wed, 21 Jul 2004 17:45:23 -0400, Five <primeooze
hotmail.com> wrote:
> page1.php
> <?php
> session_start();
> echo 'page #1<br>';
>
> echo $_SESSION['favcolor'];
> $_SESSION['favcolor'] = 'green';
>
> echo '<br><a href="page2.php">page 2</a>';
> ?>
>
> ----------------------------------------------------
> page2.php
> <?php
> session_start();
> echo 'page #2<br>';
>
> echo $_SESSION['favcolor'];
> $_SESSION['favcolor'] = 'blue';
>
> echo '<br><a href="page1.php">page 1</a>';
> ?>
>
So you go to page1.php and it has only a link.
You click the link to page2.php and you have 'green' and the link.
You click the link to page1.php and you have 'blue' and the link.
Is this not what happens?
--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder
paperCrane --Justin Patrin--
attached mail follows:
what do you get when you print_r($_SESSION) ?
try session_write_close() at the end of your scripts.
attached mail follows:
On Wed, 21 Jul 2004 17:50:36 -0400, Five <primeooze
hotmail.com> wrote:
>
> "Five" <primeooze
hotmail.com&g