php-general Digest 14 Aug 2009 05:57:42 -0000 Issue 6284

2009-08-14 Thread php-general-digest-help

php-general Digest 14 Aug 2009 05:57:42 - Issue 6284

Topics (messages 296758 through 296777):

Re: Design Patterns
296758 by: Greg Beaver
296759 by: Ralph Deffke
296760 by: Ralph Deffke
296761 by: Ralph Deffke
296762 by: Jay Blanchard
296763 by: Robert Cummings
296764 by: tedd
296765 by: Ralph Deffke
296766 by: Nathan Nobbe
296769 by: Shawn McKenzie
296773 by: Bastien Koert

design pattern
296767 by: Ralph Deffke
296768 by: Robert Cummings
296770 by: Martin Scotta
296771 by: Ralph Deffke
296772 by: Ralph Deffke

session variables - help
296774 by: Allen McCabe
296775 by: Ben Dunlap
296777 by: Allen McCabe

mbstring.func_overload cannot been changed in htaccess
296776 by: Tony Marston

Administrivia:

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

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

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


--
---BeginMessage---
Robert Cummings wrote:
 
 
 Martin Zvarík wrote:
 Ralph Deffke napsal(a):
 NO NO NO

 OOP is the best ever inventet !

 see my comments on this list, I will also come up with an pure oop
 opensource OMS very soon.

 I just think a dam big pattern catalog like this one is like an elephant
 chacing mice. I mean I can think of customers asking for a
 documentation of
 course of the page u created for them calling the next day asking
 wher the
 hell are the code for the page are documented in the 1000 pages of
 documentation u had to give them.

 I can think of two of my largest customers with their intranet
 application
 with 23000 members and more then 5 hits during working hours where I
 startet sweating while figting for every 1ms.

 I'm thinking of people with even more hits a day, they even dont
 start using
 PHP
 so I dont know if thats the right way to blow up with includes  and
 thousands of classes.

 I deeply and completely agree.
 
 Yes, certainly optimize on an as-needed basis. But well written PHP code
 should certainly scale quite well horizontally. Extremely traffic laden
 websites are quite likely to see a bottleneck at the database before a
 bottleneck in the code.

Hi,

You all should understand that on high traffic sites, C or C++ is far
more frequently used and called PHP because they use a whole lot of
custom extensions to speed things up.  In addition, memcached speeds up
database access so much that the speed of PHP starts to matter.  This is
why PHP 5.3.0 is somewhere around 30% faster than any previous PHP
version when running common applications, because the core developers
realized that the base efficiency begins to matter and spent
considerable effort improving basic language performance.

There are a lot of ways to improve PHP's efficiency, and arguing over
whether to use design patterns is not a particularly effective one.
Profiling early and often to understand the slowest portions of your
code is an effective method.  There are many, many talks/videos/etc.
that can be found via google.com which discuss these principles, but
suffice to say that xdebug, APC, and most importantly siege and apache
benchmark are your friends in this endeavor.

For Ralph: it might help you to know that facebook.com improved their
performance by splitting up things into lots and lots of classes, and
using autoload.  I don't have specific details because I don't work
there, but the programmer who coded this solution was telling me the
generalities at php|tek 2 years ago.  The pages that saw improvement
were ones with a large number of possible execution branches in
different requests.  autoload simply reduced the number of needed files
to the bare minimum from a wide variety of choices.

This surprised me, because the prevailing opinion at the time was that
autoload always reduces performance.  The point to take from this story
is that what you think to be true doesn't matter, the only thing is
really understanding where your bottlenecks are by profiling
aggressively, and even more important, why its slow, so you can fix it.

Greg
---End Message---
---BeginMessage---
but what Im asking is that the reality?

go and talk to accountant and tell them after spending soansomuch for the
new site hes has to buy a new server ! what will acountant say, what u
think.

another more important point is in reality u take a project on on a specific
hardware base. lets say it a pretty new server fast a mercedes 500 but not a
ferrari V1.
because of ur great reusable code u do an extra ordinary competitive price
bacause u are ready made that fast, u put it on the server and ? womm
because of thausand of includes and stuff the customer is not happy with the
speed.
what u think who is going to pay the new hardware? or better 

Re: [PHP] session variables - help

2009-08-14 Thread Ralph Deffke
I'm realy sorry for u, but the reason for no answers is ur concept.

may be some rules will help u and I recommend u to think to spend the time
to rewrite the whole code. Im shure u will solve the problem then:
first  dont use the global arrays directly. pick the values u need and put
them in reasonable types of variables.
build the business logic on these variables and if u feel like put the
results in well readable new ones
then populate the presentation in the required htmls
this will give u an more structured code, easier to debug and more fun for
the group to help u

I still dont understand why u use the $_SESSION variable. user often leave
forms open for hours and then submit them. u can not expect a user to end a
job in the livecycle of the session. thats what hidden form fields are made
for.

the $_session is for member like things and applications with security
issues where u can expect the user to finish things in a certain time or u
restart the whole.

Allen McCabe allenmcc...@gmail.com wrote in message
news:657acef20908132257x630719e1g4ecddcdff9492...@mail.gmail.com...
 Ben,

 First of all, I thank you for your time and help.

 My ai with using unset($var) in update_order.php is to set the SESSION
 variable for an item to ' ' (empty) so that it would not show up on the
 order summary (because my writeResultRow() function will only write a row
if
 that variable is greater than 0).

 I just can't figure out what I'm missing here. Before I received your
 response, I made a few changes to my code, which helped streamline the
 calculating parts (grabbing values from SESSION instead of POST, and now
 when I update order_summary, the values will remain because it pulls them
 from the SESSION).

 I want to edit the values in the SESSION, so that when update_order.php
 redirects to order_process.php, the values are changed, and if applicable,
 an item is removed from the html table (if the quantity is less than 1).

 Here is some more complete code:

 [code = order_process.php]

 ?php
 session_start();
 // POST ALL $_POST VALUES, CREATE AS VARIABLES IN SESSION
 foreach($_POST as $k=$v) {
  $_SESSION[$k]=$v;
 }

 $thisPage=AFY;  //NAVIGATION PURPOSES
 include(afyshows.php); //CONTAINS ARRAYS FOR SHOW ENTITIES; POPULATES
 ORDER FORM
 ?

 . . .

 /pform name=update action=update_order.php method=post 
  !-- HIDDEN FORM VALUES FOR SESSION PURPOSES --
  input type=hidden name=School  id=School value=?php
 $_SESSION['School']; ? /
  input type=hidden name=Grade id=Grade value=?php
 $_SESSION['Grade']; ? /
  input type=hidden name=Address id=Address value=?php
 $_SESSION['Address']; ? /
  input type=hidden name=City id=City value=?php
$_SESSION['City'];
 ? /
  input type=hidden name=State id=State value=?php
 $_SESSION['State']; ? /
  input type=hidden name=Zip id=Zip size=9 value=?php
 $_SESSION['Zip']; ? /
  input type=hidden name=Contact id=Contact value=?php
 $_SESSION['Contact']; ? /
  input type=hidden name=Phone id=Phone value=?php
 $_SESSION['Phone']; ? /
  input type=hidden name=Fax id=Fax value=?php $_SESSION['Fax'];
?
 /
  input type=hidden name=Email id=Email value=?php
 $_SESSION['Email']; ? /
 . . .

 ?php

 function findTotalCost($b, $c) {
  $total = $b * $c;
  return $total;
 }

 function writeResultRow($a, $b, $c, $d, $e, $f) {
  if($a != '') {
   echo \ntr\n\t;
   echo td'.$b./tdtd.$c./tdtd.$d./td;
   echo td.$e./tdtdnbsp;/tdtdinput type='text'
value='.$a.'
 name='.$a.' id='.$a.' size='2' //tdtd=/tdtd\$.$f./td;
   echo /tr;
  }
 }

 //SETS $Total_show_01 to PRICE * QUANTITY
 //FORMATS TOTAL
 //IF A QUANTITY IS ENTERED, WRITES THE ROW WITH CURRENT VARIABLES
 $Total_show_01 = findTotalCost($shows['show_01']['price'],
 $_SESSION['show_01_qty']);
 $Total_show_01_fmtd = number_format($Total_show_01, 2, '.', '');
 writeResultRow($_SESSION['show_01_qty'], $shows['show_01']['title'],
 $shows['show_01']['date'], $shows['show_01']['time'],
 $shows['show_01']['price'],$Total_show_01_fmtd);

 //ABOVE LINES REPEATED FOR ALL 38 ENTITIES (show_01 to show_38)

 ?
 . . .

 input  name=updates id=updates  type=submit value=Update/

 [/code]

 Now, here is the update_order.php code in entirety:

 [code]

 ?php
 session_start();
 foreach ($_SESSION as $var = $val) {
  if ($val == 0) {
   unset($_SESSION[$var]);
  } elseif ($val == '') {
   unset($_SESSION[$var]);
  } else {
   $val = $_SESSION[$var];

  }
 }
 header(Location: order_process.php);

 //NOTICE I FIXED THE LOCATION OF THE header() FUNCTION
 //BUT IT STILL DOES NOT UPDATE

 ?

 [/code]

 If you're still with me, I thank you. I removed all the styling elements
 from the html to make it easier for you (and me) to see what it says. I
have
 invested many hours into this, and have generated many many lines of code,
 but I hope what I gave you is sufficient, while not being overwhelming at
 this hour.

 Thank you very much for your help thus far, anything else would be greatly
 appreciated.


 On Thu, Aug 13, 2009 at 5:56 PM, Ben Dunlap

Re: [PHP] session variables - help

2009-08-14 Thread Ashley Sheridan
On Fri, 2009-08-14 at 09:55 +0200, Ralph Deffke wrote:
 user often leave
 forms open for hours and then submit them

These users should be taken out and beaten over the head with their
keyboards!

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


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



Re: [PHP] session variables - help

2009-08-14 Thread Ralph Deffke
well thanks good they are far away then, but the problem is ur client, i
didnt find anybody giving me the permission to beat his customers

Ashley Sheridan a...@ashleysheridan.co.uk wrote in message
news:1250236989.2344.10.ca...@localhost...
 On Fri, 2009-08-14 at 09:55 +0200, Ralph Deffke wrote:
  user often leave
  forms open for hours and then submit them

 These users should be taken out and beaten over the head with their
 keyboards!

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




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



[PHP] Using fopen on a site with popups

2009-08-14 Thread James Colannino
Hey everyone!  I have a question.  I know that you can use fopen to open
not just local files, but also files via HTTP.  My question is, assuming
you're attempting to open a page that has popups, is there anyway to get
at the actual content underneath the popup?

Thanks!

James

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



Re: [PHP] session variables - help

2009-08-14 Thread Ashley Sheridan
On Fri, 2009-08-14 at 10:05 +0200, Ralph Deffke wrote:
 well thanks good they are far away then, but the problem is ur client, i
 didnt find anybody giving me the permission to beat his customers
 
 Ashley Sheridan a...@ashleysheridan.co.uk wrote in message
 news:1250236989.2344.10.ca...@localhost...
  On Fri, 2009-08-14 at 09:55 +0200, Ralph Deffke wrote:
   user often leave
   forms open for hours and then submit them
 
  These users should be taken out and beaten over the head with their
  keyboards!
 
  Thanks,
  Ash
  http://www.ashleysheridan.co.uk
 
 
 
 

Beat them hard enough and they tend to forget who did it...

My life would be so much easier without end users!

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


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



Re: [PHP] Using fopen on a site with popups

2009-08-14 Thread Ashley Sheridan
On Fri, 2009-08-14 at 01:15 -0700, James Colannino wrote:
 Hey everyone!  I have a question.  I know that you can use fopen to open
 not just local files, but also files via HTTP.  My question is, assuming
 you're attempting to open a page that has popups, is there anyway to get
 at the actual content underneath the popup?
 
 Thanks!
 
 James
 
As far as I'm aware, you won't get any popups using fopen. Popups are a
thing of Javascript (or links clicked on that have a target other than
_self, _parent or _top) so just calling the page won't trigger them to
be opened.

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


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



[PHP] Re: Using fopen on a site with popups

2009-08-14 Thread Ralph Deffke
have u tried?

I did not, but as far as I understand u getting the stream including the
html causing the browser to open an popup.

so what is ur real problem then?

James Colannino ja...@colannino.org wrote in message
news:4a851d14.2010...@colannino.org...
 Hey everyone!  I have a question.  I know that you can use fopen to open
 not just local files, but also files via HTTP.  My question is, assuming
 you're attempting to open a page that has popups, is there anyway to get
 at the actual content underneath the popup?

 Thanks!

 James



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



Re: [PHP] Re: Using fopen on a site with popups

2009-08-14 Thread James Colannino
Ralph Deffke wrote:
 have u tried?
 
 I did not, but as far as I understand u getting the stream including the
 html causing the browser to open an popup.
 
 so what is ur real problem then?

Yeah, ummm...

Sorry for the traffic.  That was a really stupid question...  It looks
like the format of a page I was reading data from changed, which messed
something else up.  It just recently started implementing popup ads as
well, so I blamed that, but as another poster pointed out, popups are
caused by javascript execution in the browser, so that shouldn't have
any effect on the content I read.

Me needs to get some sleep :)

James

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



Re: [PHP] Re: Using fopen on a site with popups

2009-08-14 Thread Ralph Deffke
well included in a html script tag isn't it!

James Colannino ja...@colannino.org wrote in message
news:4a8522f6.60...@colannino.org...
 Ralph Deffke wrote:
  have u tried?
 
  I did not, but as far as I understand u getting the stream including the
  html causing the browser to open an popup.
 
  so what is ur real problem then?

 Yeah, ummm...

 Sorry for the traffic.  That was a really stupid question...  It looks
 like the format of a page I was reading data from changed, which messed
 something else up.  It just recently started implementing popup ads as
 well, so I blamed that, but as another poster pointed out, popups are
 caused by javascript execution in the browser, so that shouldn't have
 any effect on the content I read.

 Me needs to get some sleep :)

 James



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



RE: [PHP] session variables - help

2009-08-14 Thread Ford, Mike
 -Original Message-
 From: Allen McCabe [mailto:allenmcc...@gmail.com]
 Sent: 14 August 2009 06:58

 
 My ai with using unset($var) in update_order.php is to set the
 SESSION
 variable for an item to ' ' (empty) so that it would not show up on
 the
 order summary (because my writeResultRow() function will only write
 a row if
 that variable is greater than 0).
 
 I just can't figure out what I'm missing here. Before I received
 your
 response, I made a few changes to my code, which helped streamline
 the
 calculating parts (grabbing values from SESSION instead of POST, and
 now
 when I update order_summary, the values will remain because it pulls
 them
 from the SESSION).
 
 I want to edit the values in the SESSION, so that when
 update_order.php
 redirects to order_process.php, the values are changed, and if
 applicable,
 an item is removed from the html table (if the quantity is less than
 1).
 
 Here is some more complete code:
 
 [code = order_process.php]
 
 ?php
 session_start();
 // POST ALL $_POST VALUES, CREATE AS VARIABLES IN SESSION
 foreach($_POST as $k=$v) {
  $_SESSION[$k]=$v;
 }

This has just destroyed anything that was previously in the session, so if 
you're recycling from the update_order.php script, you've just thrown away 
whatever that script did!  You need to make this conditional on having arrived 
here from the initial form -- various ways you could do that, but I leave you 
to figure that one out.

(Also, personally, if I were doing this at all, I would just copy the array as 
a single entity:

$_SESSION['_POST'] = $_POST;

and then reference individual elements through that as, e.g., 
$_SESSION['_POST']['School']. That's probably a matter of personal style as 
much as anything, but gives you another way to think about.)


[ . . . . ]


 
 ?php
 
 function findTotalCost($b, $c) {
  $total = $b * $c;
  return $total;
 }
 
 function writeResultRow($a, $b, $c, $d, $e, $f) {
  if($a != '') {
   echo \ntr\n\t;
   echo td'.$b./tdtd.$c./tdtd.$d./td;
   echo td.$e./tdtdnbsp;/tdtdinput type='text'
 value='.$a.'
 name='.$a.' id='.$a.' size='2'
 //tdtd=/tdtd\$.$f./td;
   echo /tr;
  }
 }
 
 //SETS $Total_show_01 to PRICE * QUANTITY
 //FORMATS TOTAL
 //IF A QUANTITY IS ENTERED, WRITES THE ROW WITH CURRENT VARIABLES
 $Total_show_01 = findTotalCost($shows['show_01']['price'],
 $_SESSION['show_01_qty']);
 $Total_show_01_fmtd = number_format($Total_show_01, 2, '.', '');
 writeResultRow($_SESSION['show_01_qty'], $shows['show_01']['title'],
 $shows['show_01']['date'], $shows['show_01']['time'],
 $shows['show_01']['price'],$Total_show_01_fmtd);
 
 //ABOVE LINES REPEATED FOR ALL 38 ENTITIES (show_01 to show_38)

AARRRGHHH!!

This cries out for an array-based solution -- repeating near-identical code 
that many times is totally ludicrous, and should be a major clue that you need 
to refactor.  You'll have to forgo using indexes like ['show_01'] and use 
straight integers, but the massive reduction in repetitive code (and hence far 
fewer opportunities for mistakes!) will be well worth it.

Something like:

   for ($i=1; $i=38; ++$i):
  $Total[$i] = findTotalCost($shows[$i]['price'], $_SESSION['qty'][$i]);
  $Total_fmtd[$i] = number_format($Total[$i], 2, '.', '');
  writeResultRow($_SESSION['qty'][$i], $shows[$i]['title'], 
$shows[$i]['date'], $shows[$i]['time'], $shows[$i]['price'],$Total_fmtd[$i]);
   endfor;

[ . . . . ]
 
 Now, here is the update_order.php code in entirety:
 
 [code]
 
 ?php
 session_start();
 foreach ($_SESSION as $var = $val) {
  if ($val == 0) {
   unset($_SESSION[$var]);
  } elseif ($val == '') {
   unset($_SESSION[$var]);
  } else {
   $val = $_SESSION[$var];

That line is back-to-front -- you're assigning the current value in the session 
to $val, which is then immediately thrown away as the foreach loop starts a new 
iteration. What you mean is $_SESSION[$var] = $val.


Cheers!

Mike
 -- 
Mike Ford,
Electronic Information Developer, Libraries and Learning Innovation,  
Leeds Metropolitan University, C507, Civic Quarter Campus, 
Woodhouse Lane, LEEDS,  LS1 3HE,  United Kingdom 
Email: m.f...@leedsmet.ac.uk 
Tel: +44 113 812 4730






To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



[PHP] Problem with memcache - help needed

2009-08-14 Thread Jean Michel Malatray
Hello folk!

Currently, we use memcached as caching solution.

We provide a link to 3 servers, a server-2x the Memcache daemon is started 
(2 different ports (depending 4GB)

192.168.0.1:11211 (4 GB)

192.168.0.1:11212 (4 GB)

192.168.0.2:11211 (700 MB)

192.168.0.3:11211 (700 MB)

- Php.ini: memcache.hash_strategy consistent = --

$o_memcache = new Memcache ();

$o_memcache-addServer ([SERVER], [PORT]);

whenever a request comes the connect is no longer needed because Memcache 
established the connection automatically.

We also tried $o_memcache=connect([SERVER], [PORT]); - same problem.

About $o_memcache-get([KEY]), we check to see if the KEY is already set 
(KEY = UNIQUE!).

In case of error returns GET false.

When TRUE, the content of the KEY will be shown - otherwise with 
$o_memcache-set([KEY], [CONTENT], MEMCACHE_COMPRESSED, mktime (date ( H) 
+6)); will be saved for 6 hours.

You should guess the KEY will be saved for the next 6 hours, but in this 
case, it will not.

After about 2-3 minutes the KEY returns with GET FALSE again.

?

We also tried this:

- Memcache connection with addServer, connect and pconnect

- 1 server as connection, multiple server (like listed above - as pool)

?

Server stats:

evictions = 0

cur_connections: ~50-100

?

Server settings:

Apache 2.11

PHP 5.2.8

Memcache-Info by phpinfo();

Active persistent connections 4

Version 2.2.5

Revision $Revision: 1.111 $

memcache.allow_failover 1 1

memcache.chunk_size 8192 8192

memcache.default_port 11211 11211

memcache.default_timeout_ms 1000 1000

memcache.hash_function crc32 crc32

memcache.hash_strategy consistent consistent memcache.max_failover_attempts 
20 20

?

Does anybody know this issue or solution(s) to fix this problem?

Thanks for help.

Jean Michel



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



RE: [PHP] session variables - help

2009-08-14 Thread Ford, Mike
 -Original Message-
 From: Ford, Mike [mailto:m.f...@leedsmet.ac.uk]
 Sent: 14 August 2009 11:45


  Now, here is the update_order.php code in entirety:
 
  [code]
 
  ?php
  session_start();
  foreach ($_SESSION as $var = $val) {
   if ($val == 0) {
unset($_SESSION[$var]);
   } elseif ($val == '') {
unset($_SESSION[$var]);
   } else {
$val = $_SESSION[$var];
 
 That line is back-to-front -- you're assigning the current value in
 the session to $val, which is then immediately thrown away as the
 foreach loop starts a new iteration. What you mean is
 $_SESSION[$var] = $val.

No, wait a minute, hold your foot up!  I was so focussed on the strange 
assignment that I didn't read the whole thing properly.  What you're *actually* 
doing here is -- er, well, totally not what you want to, I suspect! Having 
re-read the message I responded to, I'm going to go back to it and post another 
response


Cheers!

Mike
 -- 
Mike Ford,
Electronic Information Developer, Libraries and Learning Innovation,  
Leeds Metropolitan University, C507, Civic Quarter Campus, 
Woodhouse Lane, LEEDS,  LS1 3HE,  United Kingdom 
Email: m.f...@leedsmet.ac.uk 
Tel: +44 113 812 4730





To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



Re: [PHP] Problem with memcache - help needed

2009-08-14 Thread Eddie Drapkin
On Fri, Aug 14, 2009 at 7:14 AM, Jean Michel
Malatrayjm.malat...@schaefer-shop.de wrote:
 Hello folk!

 Currently, we use memcached as caching solution.

 We provide a link to 3 servers, a server-2x the Memcache daemon is started
 (2 different ports (depending 4GB)

 192.168.0.1:11211 (4 GB)

 192.168.0.1:11212 (4 GB)

 192.168.0.2:11211 (700 MB)

 192.168.0.3:11211 (700 MB)

 - Php.ini: memcache.hash_strategy consistent = --

 $o_memcache = new Memcache ();

 $o_memcache-addServer ([SERVER], [PORT]);

 whenever a request comes the connect is no longer needed because Memcache
 established the connection automatically.

 We also tried $o_memcache=connect([SERVER], [PORT]); - same problem.

 About $o_memcache-get([KEY]), we check to see if the KEY is already set
 (KEY = UNIQUE!).

 In case of error returns GET false.

 When TRUE, the content of the KEY will be shown - otherwise with
 $o_memcache-set([KEY], [CONTENT], MEMCACHE_COMPRESSED, mktime (date ( H)
 +6)); will be saved for 6 hours.

 You should guess the KEY will be saved for the next 6 hours, but in this
 case, it will not.

 After about 2-3 minutes the KEY returns with GET FALSE again.

 ?

 We also tried this:

 - Memcache connection with addServer, connect and pconnect

 - 1 server as connection, multiple server (like listed above - as pool)

 ?

 Server stats:

 evictions = 0

 cur_connections: ~50-100

 ?

 Server settings:

 Apache 2.11

 PHP 5.2.8

 Memcache-Info by phpinfo();

 Active persistent connections 4

 Version 2.2.5

 Revision $Revision: 1.111 $

 memcache.allow_failover 1 1

 memcache.chunk_size 8192 8192

 memcache.default_port 11211 11211

 memcache.default_timeout_ms 1000 1000

 memcache.hash_function crc32 crc32

 memcache.hash_strategy consistent consistent memcache.max_failover_attempts
 20 20

 ?

 Does anybody know this issue or solution(s) to fix this problem?

 Thanks for help.

 Jean Michel



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



A couple of things,
1) Use PECL/Memcached and not PECL/Memcache.  It's faster, better
maintained, has more features, blah blah blah.
2) Set expects an integer number of seconds to keep it, mktime(date()
+ 6) is going to return an enormous number, which it looks like
memcache doesn't know how to handle.  If you want to save something
for six hours, you need to set() with an integer value of 60*60*6
(seconds in a minute * minutes in an hour * 6 hours).

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



[PHP] PHP Byte Code Compiler

2009-08-14 Thread Ralph Deffke
quite a while I'm thinking for what could that be used. also in the
documentation there are no posts, has anybody ever played arround with if?



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



RE: [PHP] session variables - help

2009-08-14 Thread Ford, Mike
 -Original Message-
 From: Allen McCabe [mailto:allenmcc...@gmail.com]
 Sent: 14 August 2009 06:58
 
 Here is some more complete code:
 
 [code = order_process.php]
 
 ?php
 session_start();
 // POST ALL $_POST VALUES, CREATE AS VARIABLES IN SESSION
 foreach($_POST as $k=$v) {
  $_SESSION[$k]=$v;
 }
 
 $thisPage=AFY;  //NAVIGATION PURPOSES
 include(afyshows.php); //CONTAINS ARRAYS FOR SHOW ENTITIES;
 POPULATES
 ORDER FORM
 ?
 
 . . .
 
 /pform name=update action=update_order.php method=post 
  !-- HIDDEN FORM VALUES FOR SESSION PURPOSES --

Er wait, no! Sessions and hidden form fields are generally alternative 
solutions to the same problem -- you shouldn't be putting the same values both 
in the session and in hidden form fields.  In this case, I'm beginning to 
suspect that the hidden fields are the better solution, but there is a certain 
amount of personal preference in this.

  input type=hidden name=School  id=School value=?php
 $_SESSION['School']; ? /
  input type=hidden name=Grade id=Grade value=?php
 $_SESSION['Grade']; ? /
  input type=hidden name=Address id=Address value=?php
 $_SESSION['Address']; ? /
  input type=hidden name=City id=City value=?php
 $_SESSION['City'];
 ? /
  input type=hidden name=State id=State value=?php
 $_SESSION['State']; ? /
  input type=hidden name=Zip id=Zip size=9 value=?php
 $_SESSION['Zip']; ? /
  input type=hidden name=Contact id=Contact value=?php
 $_SESSION['Contact']; ? /
  input type=hidden name=Phone id=Phone value=?php
 $_SESSION['Phone']; ? /
  input type=hidden name=Fax id=Fax value=?php
 $_SESSION['Fax']; ?
 /
  input type=hidden name=Email id=Email value=?php
 $_SESSION['Email']; ? /
 . . .
 
 ?php
 
 function findTotalCost($b, $c) {
  $total = $b * $c;
  return $total;
 }
 
 function writeResultRow($a, $b, $c, $d, $e, $f) {
  if($a != '') {
   echo \ntr\n\t;
   echo td'.$b./tdtd.$c./tdtd.$d./td;
   echo td.$e./tdtdnbsp;/tdtdinput type='text'
 value='.$a.'
 name='.$a.' id='.$a.' size='2'
 //tdtd=/tdtd\$.$f./td;
   echo /tr;
  }
 }
 
 //SETS $Total_show_01 to PRICE * QUANTITY
 //FORMATS TOTAL
 //IF A QUANTITY IS ENTERED, WRITES THE ROW WITH CURRENT VARIABLES
 $Total_show_01 = findTotalCost($shows['show_01']['price'],
 $_SESSION['show_01_qty']);
 $Total_show_01_fmtd = number_format($Total_show_01, 2, '.', '');
 writeResultRow($_SESSION['show_01_qty'], $shows['show_01']['title'],
 $shows['show_01']['date'], $shows['show_01']['time'],
 $shows['show_01']['price'],$Total_show_01_fmtd);
 
 //ABOVE LINES REPEATED FOR ALL 38 ENTITIES (show_01 to show_38)
 
 ?
 . . .
 
 input  name=updates id=updates  type=submit value=Update/
 
 [/code]

If I'm reading what you want to do correctly, it seems to me there are two 
obvious approaches to this:

(i) Have a single form which posts back to itself, showing all the show 
information and requested quantities and calculated result fields (such as 
total cost); initially, this will have the calculated fields not displaying 
anything, and these will be (re)populated at each Update.  Using this method, 
all your values are contained solely within the $_POST array.

(ii) Have your initial form post to the process form, which then also posts to 
itself on Update. This process form will have visible fields only for values 
which can be changed, but *must* then contain hidden fields for all the other 
values which were originally passed in the $_POST array.  This arrangement 
means that the process form always receives a full complement of values in the 
$_POST array -- either from the original form, or from hidden fields posted 
back to itself.

This is all just coming off the top of my head, and I'm sure there are 
improvements/other solutions to be offered.  Hope this will give you some 
things to think about, and maybe a pointer or two towards a satisfactory 
solution.


Cheers!

Mike
 -- 
Mike Ford,
Electronic Information Developer, Libraries and Learning Innovation,  
Leeds Metropolitan University, C507, Civic Quarter Campus, 
Woodhouse Lane, LEEDS,  LS1 3HE,  United Kingdom 
Email: m.f...@leedsmet.ac.uk 
Tel: +44 113 812 4730





To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



Re: [PHP] session variables - help

2009-08-14 Thread Allen McCabe
Thank you all for your responses.

Mike.

I like the ii option better, mostly because I already have most of that in
place (ie. order posts to process, and process has editable fields and
hidden fields with the remaining complimentary values).
Martin suggested I use the following code for my update script (which is
posted to via the process page):

[code]

foreach($_POST as $key = $value)
if( '0' == $value || '' == $value )
{
/*if*/ session_is_registered( $key ) 
session_unregister( $key );
}

[/code]

I am not following the logic on the above code very well, but is this indeed
a better option? And is not session_*whatever deprecated? The reason I am
using $_SESSION is because it seems that php 6 will use solely this method,
and it currently works with php 5. The other reason I am using it is so that
I can keep the variables stored elsewhere for whenever I need them; I don't
want to have to juggle all the information with POST and hidden inputs
unless it will work seamlessly, and be ready for update at a later date (if
I move to using a database to store show information, or when php 6 is
mainstream).

Keep in mind that once I get the update feature working, I need the process
page to have a final submit button that will insert the order into a
database table AND send a notification email to myself (and an email to the
user). Am I setting myself up for failure with this udate order option? I
ask because the update feature relies on a form, and are not forms limited
to one submit button?

Thanks all for your patience! I will work on this today and write back with
any further questions I can't figure out on my own. And if anyone has any
advice I will be checking my email regularly.

Allen
On Fri, Aug 14, 2009 at 7:52 AM, Ford, Mike m.f...@leedsmet.ac.uk wrote:

  -Original Message-
  From: Allen McCabe [mailto:allenmcc...@gmail.com]
  Sent: 14 August 2009 06:58
 
  Here is some more complete code:
 
  [code = order_process.php]
 
  ?php
  session_start();
  // POST ALL $_POST VALUES, CREATE AS VARIABLES IN SESSION
  foreach($_POST as $k=$v) {
   $_SESSION[$k]=$v;
  }
 
  $thisPage=AFY;  //NAVIGATION PURPOSES
  include(afyshows.php); //CONTAINS ARRAYS FOR SHOW ENTITIES;
  POPULATES
  ORDER FORM
  ?
 
  . . .
 
  /pform name=update action=update_order.php method=post 
   !-- HIDDEN FORM VALUES FOR SESSION PURPOSES --

 Er wait, no! Sessions and hidden form fields are generally alternative
 solutions to the same problem -- you shouldn't be putting the same values
 both in the session and in hidden form fields.  In this case, I'm beginning
 to suspect that the hidden fields are the better solution, but there is a
 certain amount of personal preference in this.

   input type=hidden name=School  id=School value=?php
  $_SESSION['School']; ? /
   input type=hidden name=Grade id=Grade value=?php
  $_SESSION['Grade']; ? /
   input type=hidden name=Address id=Address value=?php
  $_SESSION['Address']; ? /
   input type=hidden name=City id=City value=?php
  $_SESSION['City'];
  ? /
   input type=hidden name=State id=State value=?php
  $_SESSION['State']; ? /
   input type=hidden name=Zip id=Zip size=9 value=?php
  $_SESSION['Zip']; ? /
   input type=hidden name=Contact id=Contact value=?php
  $_SESSION['Contact']; ? /
   input type=hidden name=Phone id=Phone value=?php
  $_SESSION['Phone']; ? /
   input type=hidden name=Fax id=Fax value=?php
  $_SESSION['Fax']; ?
  /
   input type=hidden name=Email id=Email value=?php
  $_SESSION['Email']; ? /
  . . .
 
  ?php
 
  function findTotalCost($b, $c) {
   $total = $b * $c;
   return $total;
  }
 
  function writeResultRow($a, $b, $c, $d, $e, $f) {
   if($a != '') {
echo \ntr\n\t;
echo td'.$b./tdtd.$c./tdtd.$d./td;
echo td.$e./tdtdnbsp;/tdtdinput type='text'
  value='.$a.'
  name='.$a.' id='.$a.' size='2'
  //tdtd=/tdtd\$.$f./td;
echo /tr;
   }
  }
 
  //SETS $Total_show_01 to PRICE * QUANTITY
  //FORMATS TOTAL
  //IF A QUANTITY IS ENTERED, WRITES THE ROW WITH CURRENT VARIABLES
  $Total_show_01 = findTotalCost($shows['show_01']['price'],
  $_SESSION['show_01_qty']);
  $Total_show_01_fmtd = number_format($Total_show_01, 2, '.', '');
  writeResultRow($_SESSION['show_01_qty'], $shows['show_01']['title'],
  $shows['show_01']['date'], $shows['show_01']['time'],
  $shows['show_01']['price'],$Total_show_01_fmtd);
 
  //ABOVE LINES REPEATED FOR ALL 38 ENTITIES (show_01 to show_38)
 
  ?
  . . .
 
  input  name=updates id=updates  type=submit value=Update/
 
  [/code]

 If I'm reading what you want to do correctly, it seems to me there are two
 obvious approaches to this:

 (i) Have a single form which posts back to itself, showing all the show
 information and requested quantities and calculated result fields (such as
 total cost); initially, this will have the calculated fields not displaying
 anything, and these will be (re)populated at each Update.  Using this
 method, all your values are contained solely within the $_POST 

Re: [PHP] design pattern

2009-08-14 Thread Eric Butera
On Thu, Aug 13, 2009 at 4:45 PM, Ralph Deffkeralph_def...@yahoo.de wrote:
 Hi Martin,

 thanks for ur efforts, this is a lot of good work.

 for my opinion the start is a bit too much theoretical and valid for all
 type of application. In simple words, u are too close to the book.

 I would love to have something closer to the purpose of PHP
 and its applications.

 if u have a look at the SMARTY documentation u have good explanation (and a
 bad example by the way concerned oop) what are the real world problem.

 When it comes to the final u find the most spagetti code in putting the page
 grafic designer toghether with the business logic.

 It would be great if this could be put in good oop patterns. As I can not
 see that with the little amount of time I have got, p l e a s e tell me what
 will come up on this edge?

 ralph_def...@yahoo.de


 Martin Scotta martinsco...@gmail.com wrote in message
 news:6445d94e0908131322w722a37bbi24983ae143c5d...@mail.gmail.com...
 On Thu, Aug 13, 2009 at 4:04 PM, Ralph Deffke ralph_def...@yahoo.de
 wrote:

  so guys
 
  why u don't discuss Martins outcome?
  is there no advice, idears?
  isn't there a need for it?
  nobody want to use it?
 
  I WANT TO LEARN
 
  ralph_def...@yahoo.de
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 

 I was following the entirely conversation, I must admit I wasn't expecting
 such thread.

 It is not common to see design patterns applied to PHP applications and,
 is
 more common to don't see PHP applications. They are just scripts. Many
 scripts in a simple folder puts together to do the dirty work.

 Of course there are many kicking-ass PHP Applications, but they are a
 minimum portion compared to old-fashioned scripts.

 So, how do we start writing good quality PHP Applications? That's a very
 good question, and I don't know the answer, but I think by talking about
 design patterns we are in a good way.

 It's true that using design patterns the code will run slower, but it'll
 be
 flexible, maintable, and the most important: simple.
 After all that's what we are looking for, something really simple that
 make
 our life as developers happier every day. How do you explain the crescent
 number of php frameworks for rapid development?

 PHP core team has taken OOP seriously.
 Do you note the new SPL objects? The core team creates those objects using
 many designs patterns.
 By example the RecursiveDirectoryIterator and it's family use the
 decorator
 pattern.
 Also features such as late static binding were added because a design
 pattern.

 I think there will be some separation in the community, those who will
 stay using scripts and those who will use heavily OOP. I do not know who
 the
 dark side will be, xD


 --
 Martin Scotta




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



L - O - L.  Little time you've got?  I just glanced at the list and
you seem to have a lot of time typing up incoherent messages.  I would
suggest reading some books on programming architecture instead of
typing out all sorts of silly emails that don't make any sense.  As it
turns out, if you know how to program in theory, the language itself
becomes moot.  Bai!

-- 
http://www.ericbutera.us/

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



Re: [PHP] session variables - help

2009-08-14 Thread Martin Scotta
On Fri, Aug 14, 2009 at 12:25 PM, Allen McCabe allenmcc...@gmail.comwrote:

 Thank you all for your responses.

 Mike.

 I like the ii option better, mostly because I already have most of that in
 place (ie. order posts to process, and process has editable fields and
 hidden fields with the remaining complimentary values).
 Martin suggested I use the following code for my update script (which is
 posted to via the process page):

 [code]

 foreach($_POST as $key = $value)
if( '0' == $value || '' == $value )
{
/*if*/ session_is_registered( $key ) 
session_unregister( $key );
}

 [/code]

 I am not following the logic on the above code very well, but is this
 indeed
 a better option? And is not session_*whatever deprecated? The reason I am
 using $_SESSION is because it seems that php 6 will use solely this method,
 and it currently works with php 5. The other reason I am using it is so
 that
 I can keep the variables stored elsewhere for whenever I need them; I don't
 want to have to juggle all the information with POST and hidden inputs
 unless it will work seamlessly, and be ready for update at a later date (if
 I move to using a database to store show information, or when php 6 is
 mainstream).

 Keep in mind that once I get the update feature working, I need the process
 page to have a final submit button that will insert the order into a
 database table AND send a notification email to myself (and an email to the
 user). Am I setting myself up for failure with this udate order option? I
 ask because the update feature relies on a form, and are not forms limited
 to one submit button?

 Thanks all for your patience! I will work on this today and write back with
 any further questions I can't figure out on my own. And if anyone has any
 advice I will be checking my email regularly.

 Allen
 On Fri, Aug 14, 2009 at 7:52 AM, Ford, Mike m.f...@leedsmet.ac.uk wrote:

   -Original Message-
   From: Allen McCabe [mailto:allenmcc...@gmail.com]
   Sent: 14 August 2009 06:58
  
   Here is some more complete code:
  
   [code = order_process.php]
  
   ?php
   session_start();
   // POST ALL $_POST VALUES, CREATE AS VARIABLES IN SESSION
   foreach($_POST as $k=$v) {
$_SESSION[$k]=$v;
   }
  
   $thisPage=AFY;  //NAVIGATION PURPOSES
   include(afyshows.php); //CONTAINS ARRAYS FOR SHOW ENTITIES;
   POPULATES
   ORDER FORM
   ?
  
   . . .
  
   /pform name=update action=update_order.php method=post 
!-- HIDDEN FORM VALUES FOR SESSION PURPOSES --
 
  Er wait, no! Sessions and hidden form fields are generally alternative
  solutions to the same problem -- you shouldn't be putting the same values
  both in the session and in hidden form fields.  In this case, I'm
 beginning
  to suspect that the hidden fields are the better solution, but there is a
  certain amount of personal preference in this.
 
input type=hidden name=School  id=School value=?php
   $_SESSION['School']; ? /
input type=hidden name=Grade id=Grade value=?php
   $_SESSION['Grade']; ? /
input type=hidden name=Address id=Address value=?php
   $_SESSION['Address']; ? /
input type=hidden name=City id=City value=?php
   $_SESSION['City'];
   ? /
input type=hidden name=State id=State value=?php
   $_SESSION['State']; ? /
input type=hidden name=Zip id=Zip size=9 value=?php
   $_SESSION['Zip']; ? /
input type=hidden name=Contact id=Contact value=?php
   $_SESSION['Contact']; ? /
input type=hidden name=Phone id=Phone value=?php
   $_SESSION['Phone']; ? /
input type=hidden name=Fax id=Fax value=?php
   $_SESSION['Fax']; ?
   /
input type=hidden name=Email id=Email value=?php
   $_SESSION['Email']; ? /
   . . .
  
   ?php
  
   function findTotalCost($b, $c) {
$total = $b * $c;
return $total;
   }
  
   function writeResultRow($a, $b, $c, $d, $e, $f) {
if($a != '') {
 echo \ntr\n\t;
 echo td'.$b./tdtd.$c./tdtd.$d./td;
 echo td.$e./tdtdnbsp;/tdtdinput type='text'
   value='.$a.'
   name='.$a.' id='.$a.' size='2'
   //tdtd=/tdtd\$.$f./td;
 echo /tr;
}
   }
  
   //SETS $Total_show_01 to PRICE * QUANTITY
   //FORMATS TOTAL
   //IF A QUANTITY IS ENTERED, WRITES THE ROW WITH CURRENT VARIABLES
   $Total_show_01 = findTotalCost($shows['show_01']['price'],
   $_SESSION['show_01_qty']);
   $Total_show_01_fmtd = number_format($Total_show_01, 2, '.', '');
   writeResultRow($_SESSION['show_01_qty'], $shows['show_01']['title'],
   $shows['show_01']['date'], $shows['show_01']['time'],
   $shows['show_01']['price'],$Total_show_01_fmtd);
  
   //ABOVE LINES REPEATED FOR ALL 38 ENTITIES (show_01 to show_38)
  
   ?
   . . .
  
   input  name=updates id=updates  type=submit value=Update/
  
   [/code]
 
  If I'm reading what you want to do correctly, it seems to me there are
 two
  obvious approaches to this:
 
  (i) Have a single form which posts back to itself, showing all the show
  information and requested quantities and calculated result fields (such
 as
  

Re: AW: [PHP] Re: Re: Re: Design Patterns

2009-08-14 Thread tedd

At 3:09 PM -0500 8/13/09, Shawn McKenzie wrote:

Ralph Deffke wrote:

 for those of u not being a physician

 semiconductors are of pretty big atoms, but this is not the main problem,
 the problem is that u have to cut out structures off these semiconductors

  in order to build faster computers this matters.



-snip-
 

My physician had best never mention cutting structures off my semiconductor.

-Shawn


Me too!

I haven't much to spare.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] PHP Byte Code Compiler

2009-08-14 Thread Robert Cummings

Ralph Deffke wrote:

quite a while I'm thinking for what could that be used. also in the
documentation there are no posts, has anybody ever played arround with if?


There are several: APC, eAccelerator, Zend, PHPAccelerator, and 
problably more. I think APC and eAccelerator are the most popular. I use 
eAccelerator.


Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

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



Re: AW: [PHP] Re: Re: Re: Design Patterns

2009-08-14 Thread Robert Cummings

tedd wrote:

At 3:09 PM -0500 8/13/09, Shawn McKenzie wrote:

Ralph Deffke wrote:

 for those of u not being a physician

 semiconductors are of pretty big atoms, but this is not the main problem,
 the problem is that u have to cut out structures off these semiconductors

  in order to build faster computers this matters.
-snip-
 

My physician had best never mention cutting structures off my semiconductor.

-Shawn


Me too!

I haven't much to spare.


I've got a baby toe that keeps smashing into various floor level 
obstacles. I don't think it does much other than cause me pain :)


Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

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



Re: [PHP] PHP Byte Code Compiler

2009-08-14 Thread Eddie Drapkin
On Fri, Aug 14, 2009 at 11:58 AM, Robert Cummingsrob...@interjinn.com wrote:
 Ralph Deffke wrote:

 quite a while I'm thinking for what could that be used. also in the
 documentation there are no posts, has anybody ever played arround with if?

 There are several: APC, eAccelerator, Zend, PHPAccelerator, and problably
 more. I think APC and eAccelerator are the most popular. I use eAccelerator.

 Cheers,
 Rob.
 --
 http://www.interjinn.com
 Application and Templating Framework for PHP

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



Does eac work with 5.3.0 now?

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



Re: [PHP] PHP Byte Code Compiler

2009-08-14 Thread Robert Cummings

Eddie Drapkin wrote:

On Fri, Aug 14, 2009 at 11:58 AM, Robert Cummingsrob...@interjinn.com wrote:

Ralph Deffke wrote:

quite a while I'm thinking for what could that be used. also in the
documentation there are no posts, has anybody ever played arround with if?

There are several: APC, eAccelerator, Zend, PHPAccelerator, and problably
more. I think APC and eAccelerator are the most popular. I use eAccelerator.

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

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




Does eac work with 5.3.0 now?


Release 0.9.6 rc1 does:

http://eaccelerator.net/wiki/Release-0.9.6-rc1

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

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



Re: [PHP] PHP Byte Code Compiler

2009-08-14 Thread Eddie Drapkin
On Fri, Aug 14, 2009 at 12:24 PM, Robert Cummingsrob...@interjinn.com wrote:
 Eddie Drapkin wrote:

 On Fri, Aug 14, 2009 at 11:58 AM, Robert Cummingsrob...@interjinn.com
 wrote:

 Ralph Deffke wrote:

 quite a while I'm thinking for what could that be used. also in the
 documentation there are no posts, has anybody ever played arround with
 if?

 There are several: APC, eAccelerator, Zend, PHPAccelerator, and problably
 more. I think APC and eAccelerator are the most popular. I use
 eAccelerator.

 Cheers,
 Rob.
 --
 http://www.interjinn.com
 Application and Templating Framework for PHP

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



 Does eac work with 5.3.0 now?

 Release 0.9.6 rc1 does:

    http://eaccelerator.net/wiki/Release-0.9.6-rc1

 Cheers,
 Rob.
 --
 http://www.interjinn.com
 Application and Templating Framework for PHP


Do you know how stable it is?  APC still occasionally gives me a bus
error with 5.3.0 so it's disabled for now.

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



Re: [PHP] PHP Byte Code Compiler

2009-08-14 Thread Robert Cummings

Eddie Drapkin wrote:

On Fri, Aug 14, 2009 at 12:24 PM, Robert Cummingsrob...@interjinn.com wrote:

Eddie Drapkin wrote:

On Fri, Aug 14, 2009 at 11:58 AM, Robert Cummingsrob...@interjinn.com
wrote:

Ralph Deffke wrote:

quite a while I'm thinking for what could that be used. also in the
documentation there are no posts, has anybody ever played arround with
if?

There are several: APC, eAccelerator, Zend, PHPAccelerator, and problably
more. I think APC and eAccelerator are the most popular. I use
eAccelerator.

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

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



Does eac work with 5.3.0 now?

Release 0.9.6 rc1 does:

   http://eaccelerator.net/wiki/Release-0.9.6-rc1

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP



Do you know how stable it is?  APC still occasionally gives me a bus
error with 5.3.0 so it's disabled for now.


No idea... I've used 5.3.0 for a few tests but I'm still using 5.2.9 for 
development uses. Probably won't completely switch over my development 
for a few more months. One of my requirements is a stable eAccelerator 
for 5.3 :)


Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

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



Re: [PHP] PHP Byte Code Compiler

2009-08-14 Thread Robert Cummings



Robert Cummings wrote:

Eddie Drapkin wrote:

On Fri, Aug 14, 2009 at 12:24 PM, Robert Cummingsrob...@interjinn.com wrote:

Eddie Drapkin wrote:

On Fri, Aug 14, 2009 at 11:58 AM, Robert Cummingsrob...@interjinn.com
wrote:

Ralph Deffke wrote:

quite a while I'm thinking for what could that be used. also in the
documentation there are no posts, has anybody ever played arround with
if?

There are several: APC, eAccelerator, Zend, PHPAccelerator, and problably
more. I think APC and eAccelerator are the most popular. I use
eAccelerator.

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

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



Does eac work with 5.3.0 now?

Release 0.9.6 rc1 does:

   http://eaccelerator.net/wiki/Release-0.9.6-rc1

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP


Do you know how stable it is?  APC still occasionally gives me a bus
error with 5.3.0 so it's disabled for now.


No idea... I've used 5.3.0 for a few tests but I'm still using 5.2.9 for 
development uses. Probably won't completely switch over my development 
for a few more months. One of my requirements is a stable eAccelerator 
for 5.3 :)


Actually, I just checked, I'm using the 5.2.10 release for dev.

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

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



[PHP] ini files as config - hidden

2009-08-14 Thread דניאל דנון
I'm building a little framework for my self,

The configuration of the framework is done in an ini file,

How do you suggest to hide its contents?

.htaccess wont be good (or atleast only htaccess) since if its turned
off

The file contains mysql password and important data.


How should I make sure the file stays hidden from someone who might tries to
access it?

-- 
Use ROT26 for best security


Re: [PHP] session variables - help

2009-08-14 Thread Ben Dunlap
 Thanks all for your patience! I will work on this today and write back with
 any further questions I can't figure out on my own. And if anyone has any
 advice I will be checking my email regularly.

If you've already tried this with no luck, please ignore -- but you
might speed up the whole process by stepping aside from the real
code briefly, starting fresh in an empty directory, and just putting
together a handful of extremely simple scripts with the single goal of
entering one value, updating it, and then doing some final
pseudo-processing on the updated value.

Then, you could step it up a bit by by adding a second value that gets
entered at the beginning, and cannot be updated in the middle but must
be preserved through to the end.

Doing all this might help clarify the basic flow of the system and
enable you to simplify its structure before going back and tackling
the real code.

Ben

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



[PHP] Re: ini files as config - hidden

2009-08-14 Thread Jo�o C�ndido de Souza Neto
I think a good solution is to put the ini file out of your html folder so 
only your scripts can read it.

?  danondan...@gmail.com escreveu na mensagem 
news:907722000908141031v5b020fe0m5a3cc8a9dc196...@mail.gmail.com...
 I'm building a little framework for my self,

 The configuration of the framework is done in an ini file,

 How do you suggest to hide its contents?

 .htaccess wont be good (or atleast only htaccess) since if its turned
 off

 The file contains mysql password and important data.


 How should I make sure the file stays hidden from someone who might tries 
 to
 access it?

 -- 
 Use ROT26 for best security
 



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



Re: [PHP] Re: ini files as config - hidden

2009-08-14 Thread Ben Dunlap
2009/8/14 João Cândido de Souza Neto j...@consultorweb.cnt.br:
 I think a good solution is to put the ini file out of your html folder so
 only your scripts can read it.

I agree, and I try to do the same, but I've noticed that most
open-source CMSes I've looked at (Drupal, Joomla, Textpattern, CMS
Made Simple) have always stored database credentials inside of
DocumentRoot, by default.

Not sure if this is a compromise to allow ease-of-use by
less-technical users, or if my insistence on putting this sort of file
outside of DocumentRoot is just paranoia (and not the good kind).

I'd definitely be interested to hear how others on the list approach
this problem.

And that's only one part of the equation, if you're on a
shared-hosting platform. Are you, or do you have your own server?

Ben

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



Re: [PHP] Re: ini files as config - hidden

2009-08-14 Thread Martin Scotta
2009/8/14 Ben Dunlap bdun...@agentintellect.com

 2009/8/14 João Cândido de Souza Neto j...@consultorweb.cnt.br:
  I think a good solution is to put the ini file out of your html folder so
  only your scripts can read it.

 I agree, and I try to do the same, but I've noticed that most
 open-source CMSes I've looked at (Drupal, Joomla, Textpattern, CMS
 Made Simple) have always stored database credentials inside of
 DocumentRoot, by default.

 Not sure if this is a compromise to allow ease-of-use by
 less-technical users, or if my insistence on putting this sort of file
 outside of DocumentRoot is just paranoia (and not the good kind).

 I'd definitely be interested to hear how others on the list approach
 this problem.

 And that's only one part of the equation, if you're on a
 shared-hosting platform. Are you, or do you have your own server?

 Ben

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


A workaround to this is to simple let the browser get the ini as a php file.
What? are you insane? no. it is really easy.

1) Name your ini files .php so, database.ini will be database.php
2) Put in the top of your script this line

;?php exit;?

So, when the file is opened as an ini file the semilcolon indicates that
it's a comment.
But, when the browser call for this file... php just exit's in the first
line.

Our data will be safe as long as the first line will remains there.

-- 
Martin Scotta


Re: [PHP] Re: ini files as config - hidden

2009-08-14 Thread Jo�o C�ndido de Souza Neto
A long time ago I worked in many shared servers, nowadays I´m not working 
with web sites, only systems, so my customers always has their own server.

The question is:

1) The ini file you mentioned has ini extension?
if yes, it must be out of the document root because if someone types its 
url, the browser will certainly show up its content.
2) Has it php extension?
if yes, it can be inside the documento root because if someone types its 
url, PHP will show up only the result of its code..


Ben Dunlap bdun...@agentintellect.com escreveu na mensagem 
news:7997e80e0908141056i483f4e2h7dffe0c83b90d...@mail.gmail.com...
2009/8/14 João Cândido de Souza Neto j...@consultorweb.cnt.br:
 I think a good solution is to put the ini file out of your html folder so
 only your scripts can read it.

I agree, and I try to do the same, but I've noticed that most
open-source CMSes I've looked at (Drupal, Joomla, Textpattern, CMS
Made Simple) have always stored database credentials inside of
DocumentRoot, by default.

Not sure if this is a compromise to allow ease-of-use by
less-technical users, or if my insistence on putting this sort of file
outside of DocumentRoot is just paranoia (and not the good kind).

I'd definitely be interested to hear how others on the list approach
this problem.

And that's only one part of the equation, if you're on a
shared-hosting platform. Are you, or do you have your own server?

Ben 



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



Re: [PHP] Re: ini files as config - hidden

2009-08-14 Thread Jo�o C�ndido de Souza Neto
It´s a cool solution as well.

Martin Scotta martinsco...@gmail.com escreveu na mensagem 
news:6445d94e0908141103l6710c766wcc89f05111a65...@mail.gmail.com...
2009/8/14 Ben Dunlap bdun...@agentintellect.com

 2009/8/14 João Cândido de Souza Neto j...@consultorweb.cnt.br:
  I think a good solution is to put the ini file out of your html folder 
  so
  only your scripts can read it.

 I agree, and I try to do the same, but I've noticed that most
 open-source CMSes I've looked at (Drupal, Joomla, Textpattern, CMS
 Made Simple) have always stored database credentials inside of
 DocumentRoot, by default.

 Not sure if this is a compromise to allow ease-of-use by
 less-technical users, or if my insistence on putting this sort of file
 outside of DocumentRoot is just paranoia (and not the good kind).

 I'd definitely be interested to hear how others on the list approach
 this problem.

 And that's only one part of the equation, if you're on a
 shared-hosting platform. Are you, or do you have your own server?

 Ben

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


A workaround to this is to simple let the browser get the ini as a php file.
What? are you insane? no. it is really easy.

1) Name your ini files .php so, database.ini will be database.php
2) Put in the top of your script this line

;?php exit;?

So, when the file is opened as an ini file the semilcolon indicates that
it's a comment.
But, when the browser call for this file... php just exit's in the first
line.

Our data will be safe as long as the first line will remains there.

-- 
Martin Scotta



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



Re: [PHP] Re: ini files as config - hidden

2009-08-14 Thread Ben Dunlap
 1) Name your ini files .php so, database.ini will be database.php

Actually I was assuming the configuration file to be a PHP script --
as is typical in big open-source CMSes. I took ini file earlier in
the thread to be a generic description of any file, whatever the
extension, that contains sensitive configuration data.

 Our data will be safe as long as the first line will remains there.

And as long as the file is actually handed off to PHP for processing.
Seems like there are plenty of situations, none of them too
far-fetched, that could cause the web server to mistakenly serve a
file with .php in its name as a generic text file rather than
handling it correctly. I'd rather just have the file outside of
DocumentRoot and avoid that risk entirely. But again, maybe that's
just unproductive paranoia?

Ben

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



[PHP] PHP_SAPI

2009-08-14 Thread Martin Scotta
Hi all!

I'm making a class for handling different things depending on what web
server are you running PHP.

Can you tell me  the output of this script and your environment?

?php
echo PHP_OS, PHP_EOL, PHP_SAPI;
?

It'll be useful to me to have different values, especially from Windows or
IIS

( Please reply this in private, so we keep the list clean, then I'll send
the full list )

Is there any documentation about the possible value of PHP_SAPI?
I was surfing the web and found this list, but I don't know if it complete:

aolserver, apache, apache2filter, apache2handler, caudium, cgi, cgi-fcgi,
cli, Continuity, embed, isapi, milter, nsapi, phttpd, pi3web, roxen, thttpd,
tux,webjames

should I look at php source-code for these values?

-- 
Martin Scotta


[PHP] Making HTML Scripts over PHP Programming

2009-08-14 Thread network
Dear All,

I have developed php library for open source community, for making HTML
scripts over PHP Programming, HTML Object. It's PHP Object Library for
making autogenerated HTML scripts over PHP Programming. Providing the
variety of needs to make HTML code automatically, such as HTML Tags,
Attributes, Tag's Content, Frequently Used Tags, and Other HTML Object.
HTML Object is created in accordance with the needs of web developers, easy
to use, Object Oriented Programming, and flexible for any web applications.
visit: http://code.google.com/p/html-object/

HTML Object is PHP 5 Class Object Library, the purposes is web developers
can use this library for Presentation Layer or Web User Interface (UI) on
web applications, creating HTML code with PHP script, all controlled on
server.

Early features of them:

* Autogenerated HTML Tags, Attributes, and Contents
* Frequently Used Tags
* Generating HTML Document / Web Pages
* HTML Tables

All class libraries is documented in Application Programming Interface
(API) Documentation, you can visit
http://api.global.qummatic.com/html-object.

For developers can checkout the latest source code, please visit
http://code.google.com/p/html-object/source/checkout. The latest release
files can be downloaded in
http://code.google.com/p/html-object/downloads/list

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



Re: [PHP] session variables - help RESOLVED

2009-08-14 Thread Allen McCabe
Thanks everyone for your help, I finally got it working.

For those that were curious, my writeResultRow() function was not naming the
input fields properly, so the SESSION variables could not be updated
properly. I had to add an array item for each show, an id, then call the id
to name the inputs with.

On Fri, Aug 14, 2009 at 11:13 AM, Ben Dunlap bdun...@agentintellect.comwrote:

 Great, hope it helps! -Ben

 On Fri, Aug 14, 2009 at 10:52 AM, Allen McCabeallenmcc...@gmail.com
 wrote:
  This is an EXCELLENT idea.
 



Re: [PHP] Re: ini files as config - hidden

2009-08-14 Thread Ashley Sheridan
On Fri, 2009-08-14 at 15:03 -0300, Martin Scotta wrote:
 2009/8/14 Ben Dunlap bdun...@agentintellect.com
 
  2009/8/14 João Cândido de Souza Neto j...@consultorweb.cnt.br:
   I think a good solution is to put the ini file out of your html folder so
   only your scripts can read it.
 
  I agree, and I try to do the same, but I've noticed that most
  open-source CMSes I've looked at (Drupal, Joomla, Textpattern, CMS
  Made Simple) have always stored database credentials inside of
  DocumentRoot, by default.
 
  Not sure if this is a compromise to allow ease-of-use by
  less-technical users, or if my insistence on putting this sort of file
  outside of DocumentRoot is just paranoia (and not the good kind).
 
  I'd definitely be interested to hear how others on the list approach
  this problem.
 
  And that's only one part of the equation, if you're on a
  shared-hosting platform. Are you, or do you have your own server?
 
  Ben
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 A workaround to this is to simple let the browser get the ini as a php file.
 What? are you insane? no. it is really easy.
 
 1) Name your ini files .php so, database.ini will be database.php
 2) Put in the top of your script this line
 
 ;?php exit;?
 
 So, when the file is opened as an ini file the semilcolon indicates that
 it's a comment.
 But, when the browser call for this file... php just exit's in the first
 line.
 
 Our data will be safe as long as the first line will remains there.
 

Silly idea. If you want to read in the ini file via PHP to get the
values out, why don't you just have them as PHP vars? There's extra
overhead involved in processing the ini, which is a big bad idea if the
ini is used to hold database details, as not only does the database
connection take time, but you've increased the time needed to access the
connection details! Way to go!

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


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



[PHP] FTP: File or directory?

2009-08-14 Thread Clancy
I have just got access to a new server, and am playing with upload/download 
procedures. I
looked in the root directory, and see several objects which I assume to be 
directories.
However I was surprised to find there does not appear to be any command to 
determine if an
object is a file or directory, either in PHP FTP or plain FTP.  I could try to 
change to
them, or download them, but this seems overkill.  Am I overlooking something 
obvious?

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