php-general Digest 5 Feb 2011 02:56:21 -0000 Issue 7166
Topics (messages 311144 through 311155):
Re: bread and buytter php
311144 by: Daniel Brown
311155 by: David Robley
Re: override built-in mail()
311145 by: Jim Lucas
311146 by: Steve Staples
311147 by: Thijs Lensselink
311148 by: Steve Staples
311149 by: Thijs Lensselink
311150 by: Thijs Lensselink
311151 by: Hansen, Mike
311152 by: David Harkness
311154 by: Thijs Lensselink
Re: Memcache problems
311153 by: Jostein Eriksen
Administrivia:
To subscribe to the digest, e-mail:
[email protected]
To unsubscribe from the digest, e-mail:
[email protected]
To post to the list, e-mail:
[email protected]
----------------------------------------------------------------------
--- Begin Message ---
On Thu, Feb 3, 2011 at 22:47, Kirk Bailey <[email protected]> wrote:
> Where is a good place for bread and butter day in day out routinely needed
> functionality in php?
They're two separate things. For routinely-needed functionality
in PHP, it's pretty much built-in, but PEAR and PECL are good - and
oft-underestimated and forgotten - points of reference.
For bread and butter, try the Winn-Dixie on Seminole.
--
</Daniel P. Brown>
Network Infrastructure Manager
Documentation, Webmaster Teams
http://www.php.net/
--- End Message ---
--- Begin Message ---
On Sat, 5 Feb 2011, Kirk Bailey wrote:
> If I wanted to reinvent the wheel, I would not have wasted the
> list's bandwidth, I would go burn the hours I do not have to spare
> on rewriting things already written years before by someone else.
>
> On 2/4/2011 12:46 AM, David Robley wrote:
> > Kirk Bailey wrote:
> >> Where is a good place for bread and butter day in day out routinely
> >> needed functionality in php?
> >
> > Content management system? Framework? PEAR? Write your own
> > library/classes?
> >
> >
> >
> > Cheers
Well, I fear I could not be more specific as your request fitted in the
category of IDFMA
It must be Friday still somewhere...
Cheers
--
David Robley
Math is the language God used to write the universe.
Today is Sweetmorn, the 36th day of Chaos in the YOLD 3177.
--- End Message ---
--- Begin Message ---
On 2/4/2011 5:37 AM, Steve Staples wrote:
> Hello Guys/Gals,
>
> it's friday (at least where I am it is) and I have an issue with a
> script that I just started using again. The problem is, is that it uses
> the built in PHP mail() function, and on my testing server, mail()
> doesn't work. The other issue, is that I use SMTP Auth to connect to my
> mail server, so that when mail sends out, it comes from my mail server
> so that there is less of a chance for being marked as SPAM.
>
> So, what I am looking to do, is use either the trust old Pear::Mail or
> PHPMailer scripts (I am sure there are other ones out there, but those
> are the 2 I am most familiar with).
>
> So now to my actual question. How can I override the built-in PHP
> mail() function, to let either of those 2 (or something else someone may
> suggest) to act in the same manner as the mail() function?
>
> Is this easy? I've googled, but haven't seen any reference to doing
> what I am looking to do (maybe I just can't google)
>
> Steve
>
>
You cannot "override" a function. You will have to write a new function,
"my_mail" or some such. Have it take the same arguments as the built in mail
function, but internally it uses phpmailer or the likes. Then, do a search and
replace for " mail(" with " my_mail("
One other possible option, which I had not contemplated until now, would be to
actually specify a replacement sendmail executable when setting up the sendmail
option in the php.ini. You could specify a php script that can run as though it
was sendmail, accept the same arguments, etc... but do all the phpmailer stuff
inside.
Jim Lucas
--- End Message ---
--- Begin Message ---
On Fri, 2011-02-04 at 07:51 -0800, Jim Lucas wrote:
> On 2/4/2011 5:37 AM, Steve Staples wrote:
> > Hello Guys/Gals,
> >
> > it's friday (at least where I am it is) and I have an issue with a
> > script that I just started using again. The problem is, is that it uses
> > the built in PHP mail() function, and on my testing server, mail()
> > doesn't work. The other issue, is that I use SMTP Auth to connect to my
> > mail server, so that when mail sends out, it comes from my mail server
> > so that there is less of a chance for being marked as SPAM.
> >
> > So, what I am looking to do, is use either the trust old Pear::Mail or
> > PHPMailer scripts (I am sure there are other ones out there, but those
> > are the 2 I am most familiar with).
> >
> > So now to my actual question. How can I override the built-in PHP
> > mail() function, to let either of those 2 (or something else someone may
> > suggest) to act in the same manner as the mail() function?
> >
> > Is this easy? I've googled, but haven't seen any reference to doing
> > what I am looking to do (maybe I just can't google)
> >
> > Steve
> >
> >
>
> You cannot "override" a function. You will have to write a new function,
> "my_mail" or some such. Have it take the same arguments as the built in mail
> function, but internally it uses phpmailer or the likes. Then, do a search
> and
> replace for " mail(" with " my_mail("
>
> One other possible option, which I had not contemplated until now, would be to
> actually specify a replacement sendmail executable when setting up the
> sendmail
> option in the php.ini. You could specify a php script that can run as though
> it
> was sendmail, accept the same arguments, etc... but do all the phpmailer stuff
> inside.
>
> Jim Lucas
>
after posting this, and doing some more googleing, I found this:
http://ca.php.net/manual/en/function.override-function.php
it says you can override built-in php functions... I haven't tested to
see if i can do it, but it seems possible... has anyone used this
before? and will it do what I need? (this has been put on the back
burner for today, so tonight I will look more deeper into this unless
someone else has any luck in the mean time)
TIA!
Steve
--- End Message ---
--- Begin Message ---
On 02/04/2011 04:59 PM, Steve Staples wrote:
> On Fri, 2011-02-04 at 07:51 -0800, Jim Lucas wrote:
>> On 2/4/2011 5:37 AM, Steve Staples wrote:
>>> Hello Guys/Gals,
>>>
>>> it's friday (at least where I am it is) and I have an issue with a
>>> script that I just started using again. The problem is, is that it uses
>>> the built in PHP mail() function, and on my testing server, mail()
>>> doesn't work. The other issue, is that I use SMTP Auth to connect to my
>>> mail server, so that when mail sends out, it comes from my mail server
>>> so that there is less of a chance for being marked as SPAM.
>>>
>>> So, what I am looking to do, is use either the trust old Pear::Mail or
>>> PHPMailer scripts (I am sure there are other ones out there, but those
>>> are the 2 I am most familiar with).
>>>
>>> So now to my actual question. How can I override the built-in PHP
>>> mail() function, to let either of those 2 (or something else someone may
>>> suggest) to act in the same manner as the mail() function?
>>>
>>> Is this easy? I've googled, but haven't seen any reference to doing
>>> what I am looking to do (maybe I just can't google)
>>>
>>> Steve
>>>
>>>
>>
>> You cannot "override" a function. You will have to write a new function,
>> "my_mail" or some such. Have it take the same arguments as the built in mail
>> function, but internally it uses phpmailer or the likes. Then, do a search
>> and
>> replace for " mail(" with " my_mail("
>>
>> One other possible option, which I had not contemplated until now, would be
>> to
>> actually specify a replacement sendmail executable when setting up the
>> sendmail
>> option in the php.ini. You could specify a php script that can run as
>> though it
>> was sendmail, accept the same arguments, etc... but do all the phpmailer
>> stuff
>> inside.
>>
>> Jim Lucas
>>
>
> after posting this, and doing some more googleing, I found this:
> http://ca.php.net/manual/en/function.override-function.php
>
> it says you can override built-in php functions... I haven't tested to
> see if i can do it, but it seems possible... has anyone used this
> before? and will it do what I need? (this has been put on the back
> burner for today, so tonight I will look more deeper into this unless
> someone else has any luck in the mean time)
>
> TIA!
>
> Steve
>
>
In PHP versions < 5.3 you need something like runkit or apd. In PHP 5.3
and up you could use monkey patching
<?php
namespace somenamespace;
function mail() {
// do something!
}
You don't actually overwrite the core function but it's close.
<?php
use somenamespace;
mail() // will call the namespaced function
\mail() // will call the core function
--- End Message ---
--- Begin Message ---
On Fri, 2011-02-04 at 20:25 +0100, Thijs Lensselink wrote:
> On 02/04/2011 04:59 PM, Steve Staples wrote:
> > On Fri, 2011-02-04 at 07:51 -0800, Jim Lucas wrote:
> >> On 2/4/2011 5:37 AM, Steve Staples wrote:
> >>> Hello Guys/Gals,
> >>>
> >>> it's friday (at least where I am it is) and I have an issue with a
> >>> script that I just started using again. The problem is, is that it uses
> >>> the built in PHP mail() function, and on my testing server, mail()
> >>> doesn't work. The other issue, is that I use SMTP Auth to connect to my
> >>> mail server, so that when mail sends out, it comes from my mail server
> >>> so that there is less of a chance for being marked as SPAM.
> >>>
> >>> So, what I am looking to do, is use either the trust old Pear::Mail or
> >>> PHPMailer scripts (I am sure there are other ones out there, but those
> >>> are the 2 I am most familiar with).
> >>>
> >>> So now to my actual question. How can I override the built-in PHP
> >>> mail() function, to let either of those 2 (or something else someone may
> >>> suggest) to act in the same manner as the mail() function?
> >>>
> >>> Is this easy? I've googled, but haven't seen any reference to doing
> >>> what I am looking to do (maybe I just can't google)
> >>>
> >>> Steve
> >>>
> >>>
> >>
> >> You cannot "override" a function. You will have to write a new function,
> >> "my_mail" or some such. Have it take the same arguments as the built in
> >> mail
> >> function, but internally it uses phpmailer or the likes. Then, do a
> >> search and
> >> replace for " mail(" with " my_mail("
> >>
> >> One other possible option, which I had not contemplated until now, would
> >> be to
> >> actually specify a replacement sendmail executable when setting up the
> >> sendmail
> >> option in the php.ini. You could specify a php script that can run as
> >> though it
> >> was sendmail, accept the same arguments, etc... but do all the phpmailer
> >> stuff
> >> inside.
> >>
> >> Jim Lucas
> >>
> >
> > after posting this, and doing some more googleing, I found this:
> > http://ca.php.net/manual/en/function.override-function.php
> >
> > it says you can override built-in php functions... I haven't tested to
> > see if i can do it, but it seems possible... has anyone used this
> > before? and will it do what I need? (this has been put on the back
> > burner for today, so tonight I will look more deeper into this unless
> > someone else has any luck in the mean time)
> >
> > TIA!
> >
> > Steve
> >
> >
>
> In PHP versions < 5.3 you need something like runkit or apd. In PHP 5.3
> and up you could use monkey patching
>
> <?php
>
> namespace somenamespace;
>
> function mail() {
> // do something!
> }
>
>
> You don't actually overwrite the core function but it's close.
>
> <?php
>
> use somenamespace;
>
> mail() // will call the namespaced function
>
> \mail() // will call the core function
>
The reason i was hoping to override the function, was because then if
the script has updates, then i would need to change all references of
mail() to my_mail() or if i am not using < 5.3 (and what is runkit or
apd??)
--- End Message ---
--- Begin Message ---
On 02/04/2011 08:38 PM, Steve Staples wrote:
> On Fri, 2011-02-04 at 20:25 +0100, Thijs Lensselink wrote:
>> On 02/04/2011 04:59 PM, Steve Staples wrote:
>>> On Fri, 2011-02-04 at 07:51 -0800, Jim Lucas wrote:
>>>> On 2/4/2011 5:37 AM, Steve Staples wrote:
>>>>> Hello Guys/Gals,
>>>>>
>>>>> it's friday (at least where I am it is) and I have an issue with a
>>>>> script that I just started using again. The problem is, is that it uses
>>>>> the built in PHP mail() function, and on my testing server, mail()
>>>>> doesn't work. The other issue, is that I use SMTP Auth to connect to my
>>>>> mail server, so that when mail sends out, it comes from my mail server
>>>>> so that there is less of a chance for being marked as SPAM.
>>>>>
>>>>> So, what I am looking to do, is use either the trust old Pear::Mail or
>>>>> PHPMailer scripts (I am sure there are other ones out there, but those
>>>>> are the 2 I am most familiar with).
>>>>>
>>>>> So now to my actual question. How can I override the built-in PHP
>>>>> mail() function, to let either of those 2 (or something else someone may
>>>>> suggest) to act in the same manner as the mail() function?
>>>>>
>>>>> Is this easy? I've googled, but haven't seen any reference to doing
>>>>> what I am looking to do (maybe I just can't google)
>>>>>
>>>>> Steve
>>>>>
>>>>>
>>>>
>>>> You cannot "override" a function. You will have to write a new function,
>>>> "my_mail" or some such. Have it take the same arguments as the built in
>>>> mail
>>>> function, but internally it uses phpmailer or the likes. Then, do a
>>>> search and
>>>> replace for " mail(" with " my_mail("
>>>>
>>>> One other possible option, which I had not contemplated until now, would
>>>> be to
>>>> actually specify a replacement sendmail executable when setting up the
>>>> sendmail
>>>> option in the php.ini. You could specify a php script that can run as
>>>> though it
>>>> was sendmail, accept the same arguments, etc... but do all the phpmailer
>>>> stuff
>>>> inside.
>>>>
>>>> Jim Lucas
>>>>
>>>
>>> after posting this, and doing some more googleing, I found this:
>>> http://ca.php.net/manual/en/function.override-function.php
>>>
>>> it says you can override built-in php functions... I haven't tested to
>>> see if i can do it, but it seems possible... has anyone used this
>>> before? and will it do what I need? (this has been put on the back
>>> burner for today, so tonight I will look more deeper into this unless
>>> someone else has any luck in the mean time)
>>>
>>> TIA!
>>>
>>> Steve
>>>
>>>
>>
>> In PHP versions < 5.3 you need something like runkit or apd. In PHP 5.3
>> and up you could use monkey patching
>>
>> <?php
>>
>> namespace somenamespace;
>>
>> function mail() {
>> // do something!
>> }
>>
>>
>> You don't actually overwrite the core function but it's close.
>>
>> <?php
>>
>> use somenamespace;
>>
>> mail() // will call the namespaced function
>>
>> \mail() // will call the core function
>>
>
> The reason i was hoping to override the function, was because then if
> the script has updates, then i would need to change all references of
> mail() to my_mail() or if i am not using < 5.3 (and what is runkit or
> apd??)
>
>
APD is the Advanced PHP Debugger. That reffers to the first link you
added. And runkit is a PHP extension which allows you to override
functions, classes, etc.
http://php.net/manual/en/book.runkit.php
--- End Message ---
--- Begin Message ---
On 02/04/2011 08:44 PM, Thijs Lensselink wrote:
> On 02/04/2011 08:38 PM, Steve Staples wrote:
>> On Fri, 2011-02-04 at 20:25 +0100, Thijs Lensselink wrote:
>>> On 02/04/2011 04:59 PM, Steve Staples wrote:
>>>> On Fri, 2011-02-04 at 07:51 -0800, Jim Lucas wrote:
>>>>> On 2/4/2011 5:37 AM, Steve Staples wrote:
>>>>>> Hello Guys/Gals,
>>>>>>
>>>>>> it's friday (at least where I am it is) and I have an issue with a
>>>>>> script that I just started using again. The problem is, is that it uses
>>>>>> the built in PHP mail() function, and on my testing server, mail()
>>>>>> doesn't work. The other issue, is that I use SMTP Auth to connect to my
>>>>>> mail server, so that when mail sends out, it comes from my mail server
>>>>>> so that there is less of a chance for being marked as SPAM.
>>>>>>
>>>>>> So, what I am looking to do, is use either the trust old Pear::Mail or
>>>>>> PHPMailer scripts (I am sure there are other ones out there, but those
>>>>>> are the 2 I am most familiar with).
>>>>>>
>>>>>> So now to my actual question. How can I override the built-in PHP
>>>>>> mail() function, to let either of those 2 (or something else someone may
>>>>>> suggest) to act in the same manner as the mail() function?
>>>>>>
>>>>>> Is this easy? I've googled, but haven't seen any reference to doing
>>>>>> what I am looking to do (maybe I just can't google)
>>>>>>
>>>>>> Steve
>>>>>>
>>>>>>
>>>>>
>>>>> You cannot "override" a function. You will have to write a new function,
>>>>> "my_mail" or some such. Have it take the same arguments as the built in
>>>>> mail
>>>>> function, but internally it uses phpmailer or the likes. Then, do a
>>>>> search and
>>>>> replace for " mail(" with " my_mail("
>>>>>
>>>>> One other possible option, which I had not contemplated until now, would
>>>>> be to
>>>>> actually specify a replacement sendmail executable when setting up the
>>>>> sendmail
>>>>> option in the php.ini. You could specify a php script that can run as
>>>>> though it
>>>>> was sendmail, accept the same arguments, etc... but do all the phpmailer
>>>>> stuff
>>>>> inside.
>>>>>
>>>>> Jim Lucas
>>>>>
>>>>
>>>> after posting this, and doing some more googleing, I found this:
>>>> http://ca.php.net/manual/en/function.override-function.php
>>>>
>>>> it says you can override built-in php functions... I haven't tested to
>>>> see if i can do it, but it seems possible... has anyone used this
>>>> before? and will it do what I need? (this has been put on the back
>>>> burner for today, so tonight I will look more deeper into this unless
>>>> someone else has any luck in the mean time)
>>>>
>>>> TIA!
>>>>
>>>> Steve
>>>>
>>>>
>>>
>>> In PHP versions < 5.3 you need something like runkit or apd. In PHP 5.3
>>> and up you could use monkey patching
>>>
>>> <?php
>>>
>>> namespace somenamespace;
>>>
>>> function mail() {
>>> // do something!
>>> }
>>>
>>>
>>> You don't actually overwrite the core function but it's close.
>>>
>>> <?php
>>>
>>> use somenamespace;
>>>
>>> mail() // will call the namespaced function
>>>
>>> \mail() // will call the core function
>>>
>>
>> The reason i was hoping to override the function, was because then if
>> the script has updates, then i would need to change all references of
>> mail() to my_mail() or if i am not using < 5.3 (and what is runkit or
>> apd??)
>>
>>
>
> APD is the Advanced PHP Debugger. That reffers to the first link you
refers :)
> added. And runkit is a PHP extension which allows you to override
> functions, classes, etc.
>
> http://php.net/manual/en/book.runkit.php
>
--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Thijs Lensselink [mailto:[email protected]]
> Sent: Friday, February 04, 2011 12:48 PM
> To: [email protected]
> Subject: Re: [PHP] override built-in mail()
>
> On 02/04/2011 08:44 PM, Thijs Lensselink wrote:
> > On 02/04/2011 08:38 PM, Steve Staples wrote:
> >> On Fri, 2011-02-04 at 20:25 +0100, Thijs Lensselink wrote:
> >>> On 02/04/2011 04:59 PM, Steve Staples wrote:
> >>>> On Fri, 2011-02-04 at 07:51 -0800, Jim Lucas wrote:
> >>>>> On 2/4/2011 5:37 AM, Steve Staples wrote:
> >>>>>> Hello Guys/Gals,
> >>>>>>
> >>>>>> it's friday (at least where I am it is) and I have an
> issue with a
> >>>>>> script that I just started using again. The problem
> is, is that it uses
> >>>>>> the built in PHP mail() function, and on my testing
> server, mail()
> >>>>>> doesn't work. The other issue, is that I use SMTP Auth
> to connect to my
> >>>>>> mail server, so that when mail sends out, it comes
> from my mail server
> >>>>>> so that there is less of a chance for being marked as SPAM.
> >>>>>>
> >>>>>> So, what I am looking to do, is use either the trust
> old Pear::Mail or
> >>>>>> PHPMailer scripts (I am sure there are other ones out
> there, but those
> >>>>>> are the 2 I am most familiar with).
> >>>>>>
> >>>>>> So now to my actual question. How can I override the
> built-in PHP
> >>>>>> mail() function, to let either of those 2 (or
> something else someone may
> >>>>>> suggest) to act in the same manner as the mail() function?
> >>>>>>
> >>>>>> Is this easy? I've googled, but haven't seen any
> reference to doing
> >>>>>> what I am looking to do (maybe I just can't google)
> >>>>>>
> >>>>>> Steve
> >>>>>>
> >>>>>>
> >>>>>
> >>>>> You cannot "override" a function. You will have to
> write a new function,
> >>>>> "my_mail" or some such. Have it take the same
> arguments as the built in mail
> >>>>> function, but internally it uses phpmailer or the
> likes. Then, do a search and
> >>>>> replace for " mail(" with " my_mail("
> >>>>>
> >>>>> One other possible option, which I had not contemplated
> until now, would be to
> >>>>> actually specify a replacement sendmail executable when
> setting up the sendmail
> >>>>> option in the php.ini. You could specify a php script
> that can run as though it
> >>>>> was sendmail, accept the same arguments, etc... but do
> all the phpmailer stuff
> >>>>> inside.
> >>>>>
> >>>>> Jim Lucas
> >>>>>
> >>>>
> >>>> after posting this, and doing some more googleing, I found this:
> >>>> http://ca.php.net/manual/en/function.override-function.php
> >>>>
> >>>> it says you can override built-in php functions... I
> haven't tested to
> >>>> see if i can do it, but it seems possible... has anyone used this
> >>>> before? and will it do what I need? (this has been put
> on the back
> >>>> burner for today, so tonight I will look more deeper
> into this unless
> >>>> someone else has any luck in the mean time)
> >>>>
> >>>> TIA!
> >>>>
> >>>> Steve
I would opt for using my_mail and not overriding a built-in function. It seems
to me that it would just cause confusion for the next developer who takes care
of your code. You know, that psychopathic programmer that knows your address. =)
--- End Message ---
--- Begin Message ---
On Fri, Feb 4, 2011 at 12:42 PM, Hansen, Mike <[email protected]> wrote:
> I would opt for using my_mail and not overriding a built-in function. It
> seems to me that it would just cause confusion for the next developer who
> takes care of your code. You know, that psychopathic programmer that knows
> your address. =)
>
Yes, better to create your own function (or class) to abstract the mail()
API of your choosing is the better route. You'll have to retrofit the script
to use it, but you can then swap in different mail systems later without
changing the client. Even when you don't anticipate needing to switch to a
different provider, adding an abstraction layer from the start is often
cheap enough to warrant the risk of never needing to change the
implementation underneath.
David
--- End Message ---
--- Begin Message ---
On 02/04/2011 09:49 PM, David Harkness wrote:
> On Fri, Feb 4, 2011 at 12:42 PM, Hansen, Mike <[email protected]> wrote:
>
>> I would opt for using my_mail and not overriding a built-in function. It
>> seems to me that it would just cause confusion for the next developer who
>> takes care of your code. You know, that psychopathic programmer that knows
>> your address. =)
>>
>
> Yes, better to create your own function (or class) to abstract the mail()
> API of your choosing is the better route. You'll have to retrofit the script
> to use it, but you can then swap in different mail systems later without
> changing the client. Even when you don't anticipate needing to switch to a
> different provider, adding an abstraction layer from the start is often
> cheap enough to warrant the risk of never needing to change the
> implementation underneath.
>
> David
>
I should have added.
Running APD or runkit in production is probably not a good idea. And
renaming a core function just the same. Monkey patching is a nice
solution. But can cause confusion as well.
Like Mike and David say. Better role your own function / class for this.
--- End Message ---
--- Begin Message ---
Thanks for your help so far. I've just started noticing a bunch of
"zend_mm_heap corrupted" in logs, Could this be the reason?
On 02/03/2011 11:12 PM, Alex Nikitin wrote:
Short of some process going crazy, which you should check for, some psing,
top and netstat, i cant think of any reason you should ever get a connection
drop, short of a hardware failure (memory perhaps), or an experimental
kernel settings or modules or something... i cant think of any way that a
connection to 127.0.0.1 would ever possibly get dropped, loopback device
never hits your network hardware...
~Alex
On Thu, Feb 3, 2011 at 5:00 PM, Jostein Eriksen<[email protected]> wrote:
On 02/03/2011 10:49 PM, Adam Richardson wrote:
On Thu, Feb 3, 2011 at 4:19 PM, Jostein Eriksen<[email protected]>
wrote:
Both php and memcached is running on the same server.
memcached version 1.2.2
php5-memcache version 2.2.0
php version 5.2.4
here is a snippet from my code that may be of interest
$cfg['serverList'] = array('127.0.0.1', 11211, 1, 1);
...
$this->memcache = new Memcache();
foreach($cfg['serverList'] as $value){
/** host, port, persistent, weight,
timeout,
retry interval, status, failure callback */
$this->memcache->addServer($value[0],
$value[1], false, $value[2], $value[3], 2, true, array($this, 'fail'));
}
Are you sure you copied this correctly?
In the code above, you set the array key 'serverList' to an array
containing
('127.0.0.1', 11211, 1, 1);
Then, you foreach through the values of the 'serverList' array (first
iteration, value would equal '127.0.0.1', second, value would equal 11211,
etc.)
Then, you use array notation to access the first position of $value. In
the
first iteration of the foreach, $value would equal '127.0.0.1', so
$value[0]
would give you '1', $value[1] would give you '2', etc.
Do you see what I'm saying? Did you forget or omit other relevant code?
Or,
I'm just having a really bad code day (in this case, I'll likely see my
error just after sending this email.)
Adam
My bad.
it should be:
'serverList' => array(
/** host, port, weight, timeout */
'default' => array('127.0.0.1',
11211, 1, 1),
)),
Didn't copy/paste the $cfg = line, so it got messed up.
/Jostein
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---