php-general Digest 27 Oct 2009 03:35:13 -0000 Issue 6412

Topics (messages 299344 through 299363):

Re: dynamic menu with show hide capabilities - understanding possible workflow
        299344 by: MEM
        299345 by: Ashley Sheridan
        299348 by: Jim Lucas
        299349 by: Ashley Sheridan
        299357 by: MEM

(nginx) fcgi+PHP+memcache on RedHat: Class 'Memcache' not found...
        299346 by: Tom Barrett
        299347 by: Eddie Drapkin
        299350 by: Tom Barrett
        299351 by: Eddie Drapkin
        299352 by: Tom Barrett
        299353 by: Eddie Drapkin

simple xml object
        299354 by: Chris W

simplexml_load_file() improvement
        299355 by: Marco Barbieri

Re: Issues with MySQL connectivity ... on only one machine, and for a while now
        299356 by: Michael Shadle

Re: How to Get the Sub Classes of a Parent Class
        299358 by: Raymond Irving
        299360 by: David Otton
        299361 by: Martin Scotta
        299362 by: Martin Scotta

Strange behaviour with uploaded files .. XAMPP on Windows
        299359 by: Angus Mann
        299363 by: Brady Mitchell

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 ---
Thank you all.
 
Ok. Please stay with me, cause I still have some doubts. 
Not only do I need to display the subitems on click but also, when the user 
clicks on one menu item, I need to change the URI as well.
Why? Because, each time the user clicks on a menu item (whateaver that item as 
childs or not), I want to display a list of products related to the clicked 
item.
 
So, I was trying to avoid js, because, I don’t know that much about js. 
However, I’d like to do it properly, so, the only way I was allowing the use of 
js, was by do not disabling the back button functionality and by allowing a add 
to favorites option as well, allowing the URI changing… O.o
 
Anyway, let’s face it: 
Js is my only option, could this be a nice workflow, for an unobtrusive 
solution?
 
 
1)      Generate the multidimensional array from query.
2)      Generate the ul / li menu (echo + foreach) displaying all child 
elements as well.
3)      Apply the anchor to the list items.
4)      Apply some js to that ul / li that: 
4.1) will be responsible for show/hide elements.
4.2) Will be responsible to show/hide elements only when some DOM node(?) as 
children.
4.3) Change the URI on click, so that some information can be showed based on 
uri segment. 
 
Can I have your help to fill the blanks here, or, if there are to many, just an 
orientation reference, in order to get started…
 
 
 
Thanks a lot once again,
Márcio
 
 
 
 
From: Ashley Sheridan [mailto:[email protected]] 
Sent: segunda-feira, 26 de Outubro de 2009 14:38
To: MEM
Cc: [email protected]
Subject: Re: [PHP] dynamic menu with show hide capabilities - understanding 
possible workflow
 
On Mon, 2009-10-26 at 13:28 +0000, MEM wrote: 
 
Hello all,
 
I'm on my way to build my first dynamic menu using php.
However, each time I say this, people start jumping at me crying out loud:
"Jquery" .
I don't need js for this. Really. (At least, this is what I believe).
 
So I was wondering if It's possible to accomplish it, by using css and php
only.
 
 
If so, I'm wondering if something like this it's a good way for doing this:
 
1)
Generate a multidimensional array from database table containing categories
and subcategories.
 
2)
Create a css file with two classes one that shows, another that hides.
 
3)
Grab that array and: 
 3.1) print it recursively (no idea how to accomplish this)
 3.2) print it with some sort of class="showThis" inside the generated html
element.
 3.3) make a conditional somewhere (I really don't know where, and this may
be related with the recursion doubt), in order to display the children
elements, only when we click the parent element.
 
And here resides my main doubt: Is the point 3.3 feasible without the use of
js?
 
 
 
I just need some directions please,
 
Regards,
Márcio
 
 
 

Everything there is feasible without Javascript except for the clicking part, 
which is pretty essential to what you want. Pure CSS-only menus are still 
unavailable because of IE, so using some Javascript is your only option really.

Is there a particular reason you are shying away from Javascript in this case? 
There are ways you can construct drop-down menus in a way that if Javascript is 
unavailable, then they fall back to becoming a bog-standard navigation bar.

Also, before anyone mentions them, <select> lists are not the same thing as a 
drop-down menu, and navigating to different parts of a document upon changing 
the selected option is actually breaking their default behavior, and can become 
confusing to people who expect them to work as select lists.

Thanks,
Ash
http://www.ashleysheridan.co.uk


 

--- End Message ---
--- Begin Message ---
On Mon, 2009-10-26 at 15:01 +0000, MEM wrote:
> Thank you all.
> 
>  
> 
> Ok. Please stay with me, cause I still have some doubts. 
> 
> Not only do I need to display the subitems on click but also, when the
> user clicks on one menu item, I need to change the URI as well.
> 
> Why? Because, each time the user clicks on a menu item (whateaver that
> item as childs or not), I want to display a list of products related
> to the clicked item.
> 
>  
> 
> So, I was trying to avoid js, because, I don’t know that much about
> js. However, I’d like to do it properly, so, the only way I was
> allowing the use of js, was by do not disabling the back button
> functionality and by allowing a add to favorites option as well,
> allowing the URI changing… O.o
> 
>  
> 
> Anyway, let’s face it: 
> 
> Js is my only option, could this be a nice workflow, for an
> unobtrusive solution?
> 
>  
> 
>  
> 
> 1)      Generate the multidimensional array from query.
> 
> 2)      Generate the ul / li menu (echo + foreach) displaying all
> child elements as well.
> 
> 3)      Apply the anchor to the list items.
> 
> 4)      Apply some js to that ul / li that: 
> 
> 4.1) will be responsible for show/hide elements.
> 
> 4.2) Will be responsible to show/hide elements only when some DOM
> node(?) as children.
> 
> 4.3) Change the URI on click, so that some information can be showed
> based on uri segment. 
> 
>  
> 
> Can I have your help to fill the blanks here, or, if there are to
> many, just an orientation reference, in order to get started…
> 
>  
> 
>  
> 
>  
> 
> Thanks a lot once again,
> 
> Márcio
> 
>  
> 
>  
> 
>  
> 
>  
> 
> 
> From: Ashley Sheridan [mailto:[email protected]] 
> Sent: segunda-feira, 26 de Outubro de 2009 14:38
> To: MEM
> Cc: [email protected]
> Subject: Re: [PHP] dynamic menu with show hide capabilities -
> understanding possible workflow
> 
> 
> 
>  
> 
> On Mon, 2009-10-26 at 13:28 +0000, MEM wrote: 
> 
> 
>  
> Hello all,
>  
> I'm on my way to build my first dynamic menu using php.
> However, each time I say this, people start jumping at me crying out loud:
> "Jquery" .
> I don't need js for this. Really. (At least, this is what I believe).
>  
> So I was wondering if It's possible to accomplish it, by using css and php
> only.
>  
>  
> If so, I'm wondering if something like this it's a good way for doing this:
>  
> 1)
> Generate a multidimensional array from database table containing categories
> and subcategories.
>  
> 2)
> Create a css file with two classes one that shows, another that hides.
>  
> 3)
> Grab that array and: 
>  3.1) print it recursively (no idea how to accomplish this)
> 3.2) print it with some sort of class="showThis" inside the generated html
> element.
> 3.3) make a conditional somewhere (I really don't know where, and this may
> be related with the recursion doubt), in order to display the children
> elements, only when we click the parent element.
>  
> And here resides my main doubt: Is the point 3.3 feasible without the use of
> js?
>  
>  
>  
> I just need some directions please,
>  
> Regards,
> Márcio
>  
>  
>  
> 
> 
> 
> Everything there is feasible without Javascript except for the
> clicking part, which is pretty essential to what you want. Pure
> CSS-only menus are still unavailable because of IE, so using some
> Javascript is your only option really.
> 
> Is there a particular reason you are shying away from Javascript in
> this case? There are ways you can construct drop-down menus in a way
> that if Javascript is unavailable, then they fall back to becoming a
> bog-standard navigation bar.
> 
> Also, before anyone mentions them, <select> lists are not the same
> thing as a drop-down menu, and navigating to different parts of a
> document upon changing the selected option is actually breaking their
> default behavior, and can become confusing to people who expect them
> to work as select lists.
> 
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
> 
> 
> 
> 
> 
>  
> 
> 

In that case, what you need to do is navigate to a new URL each time, as
there is no way you can change the URL at all. The only way to change it
without reloading is to alter the #anchor part of the URL, but that is
not too flexible.

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
MEM wrote:
> Thank you all.
>  
> Ok. Please stay with me, cause I still have some doubts. 
> Not only do I need to display the subitems on click but also, when the user 
> clicks on one menu item, I need to change the URI as well.
> Why? Because, each time the user clicks on a menu item (whateaver that item 
> as childs or not), I want to display a list of products related to the 
> clicked item.
>  
> So, I was trying to avoid js, because, I don’t know that much about js. 
> However, I’d like to do it properly, so, the only way I was allowing the use 
> of js, was by do not disabling the back button functionality and by allowing 
> a add to favorites option as well, allowing the URI changing… O.o

The JS part isn't for clicking at all.  Rather, it is for hovering.

Since IE doesn't have hover on any element besides the anchor, it is used to
mimic hovering in IE.

Use the following example to add the hover ability to your app.

http://snipplr.com/view/1912/internet-explorer-ie6-css-hover/

>  
> Anyway, let’s face it: 
> Js is my only option, could this be a nice workflow, for an unobtrusive 
> solution?

Remember, JS is only used to create the ability for IE to hover over elements :)

>  
>  
> 1)      Generate the multidimensional array from query.
> 2)      Generate the ul / li menu (echo + foreach) displaying all child 
> elements as well.
> 3)      Apply the anchor to the list items.

NO!!!  don't do the following!

> 4)      Apply some js to that ul / li that: 
> 4.1) will be responsible for show/hide elements.
> 4.2) Will be responsible to show/hide elements only when some DOM node(?) as 
> children.
> 4.3) Change the URI on click, so that some information can be showed based on 
> uri segment. 
>  
> Can I have your help to fill the blanks here, or, if there are to many, just 
> an orientation reference, in order to get started…
>  
>  

Now to satisfy the people that are going to ask the inevitable question "What if
JS is turned off??"

Show everything by default. Then, using JS, hide all that should be hidden and
go from their.

>  
> Thanks a lot once again,
> Márcio
>  
>  
>  
>  
> From: Ashley Sheridan [mailto:[email protected]] 
> Sent: segunda-feira, 26 de Outubro de 2009 14:38
> To: MEM
> Cc: [email protected]
> Subject: Re: [PHP] dynamic menu with show hide capabilities - understanding 
> possible workflow
>  
> On Mon, 2009-10-26 at 13:28 +0000, MEM wrote: 
>  
> Hello all,
>  
> I'm on my way to build my first dynamic menu using php.
> However, each time I say this, people start jumping at me crying out loud:
> "Jquery" .
> I don't need js for this. Really. (At least, this is what I believe).
>  
> So I was wondering if It's possible to accomplish it, by using css and php
> only.
>  
>  
> If so, I'm wondering if something like this it's a good way for doing this:
>  
> 1)
> Generate a multidimensional array from database table containing categories
> and subcategories.
>  
> 2)
> Create a css file with two classes one that shows, another that hides.
>  
> 3)
> Grab that array and: 
>  3.1) print it recursively (no idea how to accomplish this)
>  3.2) print it with some sort of class="showThis" inside the generated html
> element.
>  3.3) make a conditional somewhere (I really don't know where, and this may
> be related with the recursion doubt), in order to display the children
> elements, only when we click the parent element.
>  
> And here resides my main doubt: Is the point 3.3 feasible without the use of
> js?
>  
>  
>  
> I just need some directions please,
>  
> Regards,
> Márcio
>  
>  
>  
> 
> Everything there is feasible without Javascript except for the clicking part, 
> which is pretty essential to what you want. Pure CSS-only menus are still 
> unavailable because of IE, so using some Javascript is your only option 
> really.
> 
> Is there a particular reason you are shying away from Javascript in this 
> case? There are ways you can construct drop-down menus in a way that if 
> Javascript is unavailable, then they fall back to becoming a bog-standard 
> navigation bar.
> 
> Also, before anyone mentions them, <select> lists are not the same thing as a 
> drop-down menu, and navigating to different parts of a document upon changing 
> the selected option is actually breaking their default behavior, and can 
> become confusing to people who expect them to work as select lists.
> 
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
> 
> 
>  
> 


--- End Message ---
--- Begin Message ---
On Mon, 2009-10-26 at 08:49 -0700, Jim Lucas wrote:

> MEM wrote:
> > Thank you all.
> >  
> > Ok. Please stay with me, cause I still have some doubts. 
> > Not only do I need to display the subitems on click but also, when the user 
> > clicks on one menu item, I need to change the URI as well.
> > Why? Because, each time the user clicks on a menu item (whateaver that item 
> > as childs or not), I want to display a list of products related to the 
> > clicked item.
> >  
> > So, I was trying to avoid js, because, I don’t know that much about js. 
> > However, I’d like to do it properly, so, the only way I was allowing the 
> > use of js, was by do not disabling the back button functionality and by 
> > allowing a add to favorites option as well, allowing the URI changing… O.o
> 
> The JS part isn't for clicking at all.  Rather, it is for hovering.
> 
> Since IE doesn't have hover on any element besides the anchor, it is used to
> mimic hovering in IE.
> 
> Use the following example to add the hover ability to your app.
> 
> http://snipplr.com/view/1912/internet-explorer-ie6-css-hover/
> 
> >  
> > Anyway, let’s face it: 
> > Js is my only option, could this be a nice workflow, for an unobtrusive 
> > solution?
> 
> Remember, JS is only used to create the ability for IE to hover over elements 
> :)
> 
> >  
> >  
> > 1)      Generate the multidimensional array from query.
> > 2)      Generate the ul / li menu (echo + foreach) displaying all child 
> > elements as well.
> > 3)      Apply the anchor to the list items.
> 
> NO!!!  don't do the following!
> 
> > 4)      Apply some js to that ul / li that: 
> > 4.1) will be responsible for show/hide elements.
> > 4.2) Will be responsible to show/hide elements only when some DOM node(?) 
> > as children.
> > 4.3) Change the URI on click, so that some information can be showed based 
> > on uri segment. 
> >  
> > Can I have your help to fill the blanks here, or, if there are to many, 
> > just an orientation reference, in order to get started…
> >  
> >  
> 
> Now to satisfy the people that are going to ask the inevitable question "What 
> if
> JS is turned off??"
> 
> Show everything by default. Then, using JS, hide all that should be hidden and
> go from their.
> 
> >  
> > Thanks a lot once again,
> > Márcio
> >  
> >  
> >  
> >  
> > From: Ashley Sheridan [mailto:[email protected]] 
> > Sent: segunda-feira, 26 de Outubro de 2009 14:38
> > To: MEM
> > Cc: [email protected]
> > Subject: Re: [PHP] dynamic menu with show hide capabilities - understanding 
> > possible workflow
> >  
> > On Mon, 2009-10-26 at 13:28 +0000, MEM wrote: 
> >  
> > Hello all,
> >  
> > I'm on my way to build my first dynamic menu using php.
> > However, each time I say this, people start jumping at me crying out loud:
> > "Jquery" .
> > I don't need js for this. Really. (At least, this is what I believe).
> >  
> > So I was wondering if It's possible to accomplish it, by using css and php
> > only.
> >  
> >  
> > If so, I'm wondering if something like this it's a good way for doing this:
> >  
> > 1)
> > Generate a multidimensional array from database table containing categories
> > and subcategories.
> >  
> > 2)
> > Create a css file with two classes one that shows, another that hides.
> >  
> > 3)
> > Grab that array and: 
> >  3.1) print it recursively (no idea how to accomplish this)
> >  3.2) print it with some sort of class="showThis" inside the generated html
> > element.
> >  3.3) make a conditional somewhere (I really don't know where, and this may
> > be related with the recursion doubt), in order to display the children
> > elements, only when we click the parent element.
> >  
> > And here resides my main doubt: Is the point 3.3 feasible without the use of
> > js?
> >  
> >  
> >  
> > I just need some directions please,
> >  
> > Regards,
> > Márcio
> >  
> >  
> >  
> > 
> > Everything there is feasible without Javascript except for the clicking 
> > part, which is pretty essential to what you want. Pure CSS-only menus are 
> > still unavailable because of IE, so using some Javascript is your only 
> > option really.
> > 
> > Is there a particular reason you are shying away from Javascript in this 
> > case? There are ways you can construct drop-down menus in a way that if 
> > Javascript is unavailable, then they fall back to becoming a bog-standard 
> > navigation bar.
> > 
> > Also, before anyone mentions them, <select> lists are not the same thing as 
> > a drop-down menu, and navigating to different parts of a document upon 
> > changing the selected option is actually breaking their default behavior, 
> > and can become confusing to people who expect them to work as select lists.
> > 
> > Thanks,
> > Ash
> > http://www.ashleysheridan.co.uk
> > 
> > 
> >  
> > 
> 


I've always gone the route of having the drop-downs just accompany a
standard, regular, functioning navigation bar. That way, if someone has
Javascript turned off, they are still able to use a standard, regular,
functioning navigation bar.

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
Thanks a lot for your replies. 

Let's see if I understand, if not, please, let me know, I'm not that proficient 
in English. 
Second try, in order to accomplish this, I have to:


1) Generate the multidimensional array from query.

2) Generate the ul / li menu (echo + foreach) displaying all child elements as 
well.

3) Apply the anchor to the list items.
 
 3.1) Each anchor on this list should point to a new URL (I don't care if the 
page refreshes on this case).

4) Print all this on a nice way to the browser. (unobtrusive)

5) Apply js to:
 5.1) HIDE the elements that need to be hidden. 
 5.2) SHOW what needs to be displayed.


I don't want to have any onHover effect. The submenus will not appear on a 
onhover effect. 
They should appear when the user either clicks on a parent menu item, or 
navigates to a specific URL. 

Should this make me change this workflow somehow? 



Please have patience... :s

Thanks again,
Márcio


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

I have installed:
 - libevent
 - libmemcached (http://tangent.org/552/libmemcached.html)
 - Done a PECL installation (pecl download memcached, phpize &&
./configure && make)
 - memcached

> cat /etc/php.d/memcached.ini
; Memcached default settings
extension=memcache.so

> ls -1  /usr/lib64/php/modules/memcache*
/usr/lib64/php/modules/memcached.so
/usr/lib64/php/modules/memcache.so

> memcached -h
memcached 1.2.6
...

> php -v
PHP 5.1.6 (cli) (built: Feb 26 2009 07:01:12)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies


/var/www/php_fcgi_memcache> cat memcache.php
<?php
$memcache = new Memcache;
print_r($memcache);
?>

/var/www/php_fcgi_memcache> php memcache.php
PHP Fatal error:  Class 'Memcache' not found in
/var/www/php_fcgi_memcache/memcache.php on line 2

Memcached is working fine (being use by Perl quite happily).

PHP/FCGI is working OK and phpinfo() shows:
memcached support enabled
Version 1.0.0
libmemcached version 0.34
Session support yes

Any pointers in the right direction would so very much appreciated.

--- End Message ---
--- Begin Message ---
On Mon, Oct 26, 2009 at 11:45 AM, Tom Barrett <[email protected]> wrote:
> Hello
>
> I have installed:
>  - libevent
>  - libmemcached (http://tangent.org/552/libmemcached.html)
>  - Done a PECL installation (pecl download memcached, phpize &&
> ./configure && make)
>  - memcached
>
>> cat /etc/php.d/memcached.ini
> ; Memcached default settings
> extension=memcache.so
>
>> ls -1  /usr/lib64/php/modules/memcache*
> /usr/lib64/php/modules/memcached.so
> /usr/lib64/php/modules/memcache.so
>
>> memcached -h
> memcached 1.2.6
> ...
>
>> php -v
> PHP 5.1.6 (cli) (built: Feb 26 2009 07:01:12)
> Copyright (c) 1997-2006 The PHP Group
> Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
>
>
> /var/www/php_fcgi_memcache> cat memcache.php
> <?php
> $memcache = new Memcache;
> print_r($memcache);
> ?>
>
> /var/www/php_fcgi_memcache> php memcache.php
> PHP Fatal error:  Class 'Memcache' not found in
> /var/www/php_fcgi_memcache/memcache.php on line 2
>
> Memcached is working fine (being use by Perl quite happily).
>
> PHP/FCGI is working OK and phpinfo() shows:
> memcached support enabled
> Version 1.0.0
> libmemcached version 0.34
> Session support yes
>
> Any pointers in the right direction would so very much appreciated.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Try instantiating a Memcached instance, not a Memcache instance.
They're two different PECL extensions!

--- End Message ---
--- Begin Message ---
2009/10/26 Eddie Drapkin <[email protected]>:
> On Mon, Oct 26, 2009 at 11:45 AM, Tom Barrett <[email protected]> wrote:
>> Hello
>>
>> I have installed:
>>  - libevent
>>  - libmemcached (http://tangent.org/552/libmemcached.html)
>>  - Done a PECL installation (pecl download memcached, phpize &&
>> ./configure && make)
>>  - memcached
>>
>>> cat /etc/php.d/memcached.ini
>> ; Memcached default settings
>> extension=memcache.so
>>
>>> ls -1  /usr/lib64/php/modules/memcache*
>> /usr/lib64/php/modules/memcached.so
>> /usr/lib64/php/modules/memcache.so
>>
>>> memcached -h
>> memcached 1.2.6
>> ...
>>
>>> php -v
>> PHP 5.1.6 (cli) (built: Feb 26 2009 07:01:12)
>> Copyright (c) 1997-2006 The PHP Group
>> Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
>>
>>
>> /var/www/php_fcgi_memcache> cat memcache.php
>> <?php
>> $memcache = new Memcache;
>> print_r($memcache);
>> ?>
>>
>> /var/www/php_fcgi_memcache> php memcache.php
>> PHP Fatal error:  Class 'Memcache' not found in
>> /var/www/php_fcgi_memcache/memcache.php on line 2
>>
>> Memcached is working fine (being use by Perl quite happily).
>>
>> PHP/FCGI is working OK and phpinfo() shows:
>> memcached support enabled
>> Version 1.0.0
>> libmemcached version 0.34
>> Session support yes
>>
>> Any pointers in the right direction would so very much appreciated.
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
> Try instantiating a Memcached instance, not a Memcache instance.
> They're two different PECL extensions!

Hi

That just auto-instantiates an empty object?

> cat memcached.php
<?php
$memcache = new Memcached;
print_r($memcache);
?>

> php memcached.php
Memcached Object
(
)

I have used the $m=new Memcache; syntax on another server, which works fine.

Or have I mixed up my libraries somehow?

--- End Message ---
--- Begin Message ---
On Mon, Oct 26, 2009 at 11:59 AM, Tom Barrett <[email protected]> wrote:
> 2009/10/26 Eddie Drapkin <[email protected]>:
>> On Mon, Oct 26, 2009 at 11:45 AM, Tom Barrett <[email protected]> wrote:
>>> Hello
>>>
>>> I have installed:
>>>  - libevent
>>>  - libmemcached (http://tangent.org/552/libmemcached.html)
>>>  - Done a PECL installation (pecl download memcached, phpize &&
>>> ./configure && make)
>>>  - memcached
>>>
>>>> cat /etc/php.d/memcached.ini
>>> ; Memcached default settings
>>> extension=memcache.so
>>>
>>>> ls -1  /usr/lib64/php/modules/memcache*
>>> /usr/lib64/php/modules/memcached.so
>>> /usr/lib64/php/modules/memcache.so
>>>
>>>> memcached -h
>>> memcached 1.2.6
>>> ...
>>>
>>>> php -v
>>> PHP 5.1.6 (cli) (built: Feb 26 2009 07:01:12)
>>> Copyright (c) 1997-2006 The PHP Group
>>> Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
>>>
>>>
>>> /var/www/php_fcgi_memcache> cat memcache.php
>>> <?php
>>> $memcache = new Memcache;
>>> print_r($memcache);
>>> ?>
>>>
>>> /var/www/php_fcgi_memcache> php memcache.php
>>> PHP Fatal error:  Class 'Memcache' not found in
>>> /var/www/php_fcgi_memcache/memcache.php on line 2
>>>
>>> Memcached is working fine (being use by Perl quite happily).
>>>
>>> PHP/FCGI is working OK and phpinfo() shows:
>>> memcached support enabled
>>> Version 1.0.0
>>> libmemcached version 0.34
>>> Session support yes
>>>
>>> Any pointers in the right direction would so very much appreciated.
>>>
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>>
>> Try instantiating a Memcached instance, not a Memcache instance.
>> They're two different PECL extensions!
>
> Hi
>
> That just auto-instantiates an empty object?
>
>> cat memcached.php
> <?php
> $memcache = new Memcached;
> print_r($memcache);
> ?>
>
>> php memcached.php
> Memcached Object
> (
> )
>
> I have used the $m=new Memcache; syntax on another server, which works fine.
>
> Or have I mixed up my libraries somehow?
>

They're actually two different classes from two different PECL
extensions.  Memcached is the newer (imo better) extension written by
Andrei (at digg) to use libmemcached.  Memcache is the older, entirely
custom (no external deps) PECL extension that's been around forever.
So, I'm guessing you have Memcache on one machine and Memcached on
another.  They have slightly different APIs, so I'd make sure you're
aware of which one you're using.  :)

--- End Message ---
--- Begin Message ---
2009/10/26 Eddie Drapkin <[email protected]>:
> On Mon, Oct 26, 2009 at 11:59 AM, Tom Barrett <[email protected]> wrote:
>> 2009/10/26 Eddie Drapkin <[email protected]>:
>>> On Mon, Oct 26, 2009 at 11:45 AM, Tom Barrett <[email protected]> wrote:
>>>> Hello
>>>>
>>>> I have installed:
>>>>  - libevent
>>>>  - libmemcached (http://tangent.org/552/libmemcached.html)
>>>>  - Done a PECL installation (pecl download memcached, phpize &&
>>>> ./configure && make)
>>>>  - memcached
>>>>
>>>>> cat /etc/php.d/memcached.ini
>>>> ; Memcached default settings
>>>> extension=memcache.so
>>>>
>>>>> ls -1  /usr/lib64/php/modules/memcache*
>>>> /usr/lib64/php/modules/memcached.so
>>>> /usr/lib64/php/modules/memcache.so
>>>>
>>>>> memcached -h
>>>> memcached 1.2.6
>>>> ...
>>>>
>>>>> php -v
>>>> PHP 5.1.6 (cli) (built: Feb 26 2009 07:01:12)
>>>> Copyright (c) 1997-2006 The PHP Group
>>>> Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
>>>>
>>>>
>>>> /var/www/php_fcgi_memcache> cat memcache.php
>>>> <?php
>>>> $memcache = new Memcache;
>>>> print_r($memcache);
>>>> ?>
>>>>
>>>> /var/www/php_fcgi_memcache> php memcache.php
>>>> PHP Fatal error:  Class 'Memcache' not found in
>>>> /var/www/php_fcgi_memcache/memcache.php on line 2
>>>>
>>>> Memcached is working fine (being use by Perl quite happily).
>>>>
>>>> PHP/FCGI is working OK and phpinfo() shows:
>>>> memcached support enabled
>>>> Version 1.0.0
>>>> libmemcached version 0.34
>>>> Session support yes
>>>>
>>>> Any pointers in the right direction would so very much appreciated.
>>>>
>>>> --
>>>> PHP General Mailing List (http://www.php.net/)
>>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>>
>>>>
>>>
>>> Try instantiating a Memcached instance, not a Memcache instance.
>>> They're two different PECL extensions!
>>
>> Hi
>>
>> That just auto-instantiates an empty object?
>>
>>> cat memcached.php
>> <?php
>> $memcache = new Memcached;
>> print_r($memcache);
>> ?>
>>
>>> php memcached.php
>> Memcached Object
>> (
>> )
>>
>> I have used the $m=new Memcache; syntax on another server, which works fine.
>>
>> Or have I mixed up my libraries somehow?
>>
>
> They're actually two different classes from two different PECL
> extensions.  Memcached is the newer (imo better) extension written by
> Andrei (at digg) to use libmemcached.  Memcache is the older, entirely
> custom (no external deps) PECL extension that's been around forever.
> So, I'm guessing you have Memcache on one machine and Memcached on
> another.  They have slightly different APIs, so I'd make sure you're
> aware of which one you're using.  :)

Thanks

Any chance you could show me the way?

This is how I installed the PECL extension:

> pecl download memcached
> tar zxf memcached-1.0.0.tgz
> cd memcached-1.0.0
> phpize
> ./configure
> make
> make install

Does that look like the right one? Did I miss something?

--- End Message ---
--- Begin Message ---
On Mon, Oct 26, 2009 at 12:22 PM, Tom Barrett <[email protected]> wrote:
> 2009/10/26 Eddie Drapkin <[email protected]>:
>> On Mon, Oct 26, 2009 at 11:59 AM, Tom Barrett <[email protected]> wrote:
>>> 2009/10/26 Eddie Drapkin <[email protected]>:
>>>> On Mon, Oct 26, 2009 at 11:45 AM, Tom Barrett <[email protected]> wrote:
>>>>> Hello
>>>>>
>>>>> I have installed:
>>>>>  - libevent
>>>>>  - libmemcached (http://tangent.org/552/libmemcached.html)
>>>>>  - Done a PECL installation (pecl download memcached, phpize &&
>>>>> ./configure && make)
>>>>>  - memcached
>>>>>
>>>>>> cat /etc/php.d/memcached.ini
>>>>> ; Memcached default settings
>>>>> extension=memcache.so
>>>>>
>>>>>> ls -1  /usr/lib64/php/modules/memcache*
>>>>> /usr/lib64/php/modules/memcached.so
>>>>> /usr/lib64/php/modules/memcache.so
>>>>>
>>>>>> memcached -h
>>>>> memcached 1.2.6
>>>>> ...
>>>>>
>>>>>> php -v
>>>>> PHP 5.1.6 (cli) (built: Feb 26 2009 07:01:12)
>>>>> Copyright (c) 1997-2006 The PHP Group
>>>>> Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
>>>>>
>>>>>
>>>>> /var/www/php_fcgi_memcache> cat memcache.php
>>>>> <?php
>>>>> $memcache = new Memcache;
>>>>> print_r($memcache);
>>>>> ?>
>>>>>
>>>>> /var/www/php_fcgi_memcache> php memcache.php
>>>>> PHP Fatal error:  Class 'Memcache' not found in
>>>>> /var/www/php_fcgi_memcache/memcache.php on line 2
>>>>>
>>>>> Memcached is working fine (being use by Perl quite happily).
>>>>>
>>>>> PHP/FCGI is working OK and phpinfo() shows:
>>>>> memcached support enabled
>>>>> Version 1.0.0
>>>>> libmemcached version 0.34
>>>>> Session support yes
>>>>>
>>>>> Any pointers in the right direction would so very much appreciated.
>>>>>
>>>>> --
>>>>> PHP General Mailing List (http://www.php.net/)
>>>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>>>
>>>>>
>>>>
>>>> Try instantiating a Memcached instance, not a Memcache instance.
>>>> They're two different PECL extensions!
>>>
>>> Hi
>>>
>>> That just auto-instantiates an empty object?
>>>
>>>> cat memcached.php
>>> <?php
>>> $memcache = new Memcached;
>>> print_r($memcache);
>>> ?>
>>>
>>>> php memcached.php
>>> Memcached Object
>>> (
>>> )
>>>
>>> I have used the $m=new Memcache; syntax on another server, which works fine.
>>>
>>> Or have I mixed up my libraries somehow?
>>>
>>
>> They're actually two different classes from two different PECL
>> extensions.  Memcached is the newer (imo better) extension written by
>> Andrei (at digg) to use libmemcached.  Memcache is the older, entirely
>> custom (no external deps) PECL extension that's been around forever.
>> So, I'm guessing you have Memcache on one machine and Memcached on
>> another.  They have slightly different APIs, so I'd make sure you're
>> aware of which one you're using.  :)
>
> Thanks
>
> Any chance you could show me the way?
>
> This is how I installed the PECL extension:
>
>> pecl download memcached
>> tar zxf memcached-1.0.0.tgz
>> cd memcached-1.0.0
>> phpize
>> ./configure
>> make
>> make install
>
> Does that look like the right one? Did I miss something?
>

That'll install the Memcached extension, which is the one I'd usually
recommend and the one that I use.  I don't see anythign wrong with
using that one or that way of installing it, but I was just saying
that the method names and parameters are different from the older
extension and to just be aware of that.

Old extension: http://us2.php.net/manual/en/book.memcache.php
New extension: http://us2.php.net/manual/en/book.memcached.php

The naming confusion is unnecessary but it exists so there's not
really too much you can do about it :P

--- End Message ---
--- Begin Message --- I have the following xml with standard tags changed to [ and ] to prevent mail clients from encoding it as html.
[?xml version="1.0"?]
[resultset errors="0" results="86"]
[result id="20080922133104871678" lastinspected="9/29/2009 0:00"]0.4[/result] [result id="20080922133104871678" lastinspected="8/28/2009 0:00"]1.1[/result]
. . .

I am using the simplexml_load_string to read it in to an object and execute the following code

 $xml = simplexml_load_string($content);


 foreach($xml as $Result){
   print_r($Result);
   foreach($Result->attributes() as $i => $v){
     $$i = $v;
     print "Attr: $i = '$v'\n";
   }
 }

that all works fine. Problem is I can't figure out how to get the acutual value (0.4 and 1.1). I also don't know why I can't simply do something like....

$id = $Result->attributes()->id;

the output of this looks like ....

SimpleXMLElement Object
(
   [...@attributes] => Array
       (
           [id] => 20080922133104871678
           [lastinspected] => 9/29/2009 0:00
       )

   [0] => 0.4
)
Attr: id = '20080922133104871678'
Attr: lastinspected = '9/29/2009 0:00'

SimpleXMLElement Object
(
   [...@attributes] => Array
       (
           [id] => 20080922133104871678
           [lastinspected] => 8/28/2009 0:00
       )

   [0] => 1.1
)
Attr: id = '20080922133104871678'
Attr: lastinspected = '8/28/2009 0:00'



How do I read the [0] value?  $Result[0] gives me nothing.

--
Chris W
KE5GIX

"Protect your digital freedom and privacy, eliminate DRM, learn more at http://www.defectivebydesign.org/what_is_drm";

Ham Radio Repeater Database.
http://hrrdb.com


--- End Message ---
--- Begin Message ---
Hi all!
This is my first mail, I hope I will use this mailing list in the correct
mode.
One of main advantages of SQL in the concorrent access of many script to the
same database.
I would like improve similar functions to the SimpleXML module.
In particular, I want modify the simplexml_load_file() function adding the
interaction with the flock() function.
What do you think about?

--- End Message ---
--- Begin Message ---
nope. it's a quad core with 4 gig ram

[r...@sql02 ~]# free -m
             total       used       free     shared    buffers     cached
Mem:          3905       3774        130          0        170        941
-/+ buffers/cache:       2662       1243
Swap:         3906         20       3886
[r...@sql02 ~]#

i do have collectd installed and am waiting for it to happen some more
to see if i can correlate it with any specific event

On Mon, Oct 26, 2009 at 5:53 AM, John Black
<[email protected]> wrote:
> Michael Shadle wrote:
>>
>> Oct 25 22:00:01 sql02 php: PHP Warning:  mysqli_connect():
>> (HY000/2013): Lost connection to MySQL server at 'sending
>> authentication information', system error: 32 in
>> /home/foo/web/foo.com/core.php on line 2394
>>
>> mysql 5.0.75 on ubuntu jaunty 64-bit
>> php 5.2.11 (but has been showing this issue since 5.2.9 if not
>> earlier, I didn't start tracking it then)
>
>
> Is this a VPS (virtual private server)?
> Reason I am asking is because some VPS implementations only give you RAM but
> no SWAP space. So once all RAM is consumed processes will get aborted.
>
> --
> John
> Klarmachen zum Ändern!
>   Piratenpartei Deutschland
> http://www.youtube.com/v/-u3IUno5A-M
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
This works if you know the name of the class. What I'm looking for is a way to 
get one of the sub classes and initialize it dynamically. 




________________________________
From: David Otton <[email protected]>
To: Raymond Irving <[email protected]>
Cc: PHP-General List <[email protected]>
Sent: Sun, October 25, 2009 10:25:27 AM
Subject: Re: [PHP] How to Get the Sub Classes of a Parent Class

2009/10/25 Raymond Irving <[email protected]>:

> I want to automatically initialize a specific sub class when the php page is 
> loaded.
>
> I'm looking for a solution for php 5.1+ or anything that's optimized for 5.3

You may be able solve this with a simple class_exists() (pseudo-code ahead):

if(class_exists($var)) {
    $class = new $var;
} else {
    $class = new FourOhFour;
}

--- End Message ---
--- Begin Message ---
2009/10/27 Raymond Irving <[email protected]>:

>>> I want to automatically initialize a specific sub class when the php page
>>> is loaded.

>> You may be able solve this with a simple class_exists() (pseudo-code ahead):
>>
>> if(class_exists($var)) {
>>     $class = new $var;
>> } else {
>>     $class = new FourOhFour;
>> }

>> This works if you know the name of the class. What I'm looking for is a way
>> to get one of the sub classes and initialize it dynamically.

I'm confused. If you don't know the name of the child class, how are
you going to know which one to instantiate? Are you going to pick one
at random?

What you're trying to do can probably be accomplished, but I can't
shake the feeling we're trying to solve the wrong problem here.

--- End Message ---
--- Begin Message ---
On Mon, Oct 26, 2009 at 10:22 PM, Raymond Irving <[email protected]> wrote:

>
> This works if you know the name of the class. What I'm looking for is a way
> to get one of the sub classes and initialize it dynamically.
>
>
>
>
> ________________________________
> From: David Otton <[email protected]>
> To: Raymond Irving <[email protected]>
> Cc: PHP-General List <[email protected]>
> Sent: Sun, October 25, 2009 10:25:27 AM
> Subject: Re: [PHP] How to Get the Sub Classes of a Parent Class
>
> 2009/10/25 Raymond Irving <[email protected]>:
>
> > I want to automatically initialize a specific sub class when the php page
> is loaded.
> >
> > I'm looking for a solution for php 5.1+ or anything that's optimized for
> 5.3
>
> You may be able solve this with a simple class_exists() (pseudo-code
> ahead):
>
> if(class_exists($var)) {
>    $class = new $var;
> } else {
>    $class = new FourOhFour;
> }
>

This script only works for loaded classes .
If your script has autoloader then there is no way to know the declared
classes before you declare them.

error_reporting( E_ALL | E_STRICT );

Class Foo {}

Class Bar extends Foo {}
Class Baz extends Foo {}

Class Beer extends Bar {}
Class Pier extends Bar {}

function get_subclasses($class)
{

    $sub = array();

    foreach(get_declared_classes() as $name )
    {
        $rClass = new ReflectionClass($name);

        if( $rClass->isSubclassOf( $class ))
        {
            $sub[] = $name;
        }
    }

    return $sub;
}

print_r( get_subclasses( 'Foo' ));
print_r( get_subclasses( 'Bar' ));

-- 
Martin Scotta

--- End Message ---
--- Begin Message ---
On Mon, Oct 26, 2009 at 10:33 PM, David Otton <
[email protected]> wrote:

> 2009/10/27 Raymond Irving <[email protected]>:
>
> >>> I want to automatically initialize a specific sub class when the php
> page
> >>> is loaded.
>
> >> You may be able solve this with a simple class_exists() (pseudo-code
> ahead):
> >>
> >> if(class_exists($var)) {
> >>     $class = new $var;
> >> } else {
> >>     $class = new FourOhFour;
> >> }
>
> >> This works if you know the name of the class. What I'm looking for is a
> way
> >> to get one of the sub classes and initialize it dynamically.
>
> I'm confused. If you don't know the name of the child class, how are
> you going to know which one to instantiate? Are you going to pick one
> at random?
>
> What you're trying to do can probably be accomplished, but I can't
> shake the feeling we're trying to solve the wrong problem here.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Just having FUN, do not take me serious : )

function getInstanceRandom()
{
    $classes = get_declared_classes();
    $index = array_rand( $classes );
    return new $classes[ $index ]();
}

$obj = getInstanceRandom();
echo get_class( $obj );

This is way you NEVER know which class you will instantiate!

-- 
Martin Scotta

--- End Message ---
--- Begin Message --- Hi all. I'm not sure if this is really a PHP question or specific to XAMPP, or windows in general...

I have XAMPP including PHP 4.29 running on a Vista machine.

When I use a form to upload a file, using $_FILES['uploadedfile']['name'] and move_uploaded-file($_FILES['uploadedfile']['name'], $targetpath) strange effects happen.

The file is uploaded to the target directory just as it should.

But when I access this directory as a network share on a different machine, the file is not visible.

When I go to delete the file, or the entire uploads folder, the file is not deleted, nor the folder. If the folder contains anything I put there manually (ie. not uploaded as above) that is deleted, but the uploaded content remains.

This reminds me a bit of "symbolic links" behaviour but I'm really stumped if that's the case.

Any ideas?



--- End Message ---
--- Begin Message ---
On Mon, Oct 26, 2009 at 6:31 PM, Angus Mann <[email protected]> wrote:
> When I use a form to upload a file, using $_FILES['uploadedfile']['name']
> and move_uploaded-file($_FILES['uploadedfile']['name'], $targetpath) strange
> effects happen.
>
> The file is uploaded to the target directory just as it should.
>
> But when I access this directory as a network share on a different machine,
> the file is not visible.

This sounds more like a windows permissions problem than PHP or XAMPP
related. Make sure the user that is connecting to the network share
has rights to view files on the windows box. It sounds like the user
that is running XAMPP has full control (or at least read/write/delete)
to that directory, but the user connecting to the network share
doesn't.

> When I go to delete the file, or the entire uploads folder, the file is not
> deleted, nor the folder. If the folder contains anything I put there
> manually (ie. not uploaded as above) that is deleted, but the uploaded
> content remains.

Yeah, definitely sounds like a permissions issue.

I'm not much of a windows admin, but this looks like it might help:
http://www.mydigitallife.info/2007/05/25/how-to-take-ownership-and-grant-permissions-in-windows-vista/

HTH,

Brady

--- End Message ---

Reply via email to