php-general Digest 26 Oct 2013 08:44:06 -0000 Issue 8410
php-general Digest 26 Oct 2013 08:44:06 - Issue 8410 Topics (messages 322376 through 322384): Re: framework or not 322376 by: Stuart Dallas 322378 by: Robert Cummings 322380 by: Stuart Dallas 322381 by: David Harkness News Regard Attack; Announcing Official php.net Twitter Account 322377 by: Daniel Brown 322379 by: Tedd Sperling I am puzzled. Error on one site, no error on the other 322382 by: Stephen 322383 by: Aziz Saleh Does a call to trigger_error ever return? 322384 by: Peter West 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--- On 25 Oct 2013, at 15:01, Robert Cummings rob...@interjinn.com wrote: On 13-10-24 09:41 PM, Larry Garfield wrote: On 10/23/2013 08:51 AM, Jay Blanchard wrote: [snip] a bitter rant[/snip] Dang Larry - bad night? That wasn't a bitter rant. You haven't seen me bitter. :-) That was tough love to the OP. I don't see a reason to pussyfoot around the original question, which is one that comes up about once a month. The answer is always the same: How much is your time worth? Basic math... Life: finite Time: infinite finite / infinite = 0 *sniffle* Who's valuation of your time actually matters? Yours, and yours alone. Therefore: Life: n years Time I can benefit from my life: n years n years / n years = 1 *hoorah* Your time is the most precious commodity you have. Whether you use a framework or not you will (hopefully) reuse code between projects. If you choose to make part of that reused code one of the many frameworks that exist, you need only do one thing to ensure it continues to be worth using: how much of your time do you spend battling against the restrictions of the framework? If that's sufficiently low then using that framework is probably a good thing. If a significant portion of your time is spent battling the framework it's time to make a change. Also remember that the only person who can truthfully judge whether you're wasting time is you, unless you earn money by selling your time to someone else in which case they have some right to decide what constitutes a waste of the time for which they're paying. I found the experience of writing my own framework to be hugely beneficial to my future productivity, but I might have struggled to justify spending the extra time it took to my employer at the time. -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ ---End Message--- ---BeginMessage--- On 13-10-25 10:17 AM, Stuart Dallas wrote: On 25 Oct 2013, at 15:01, Robert Cummings rob...@interjinn.com wrote: On 13-10-24 09:41 PM, Larry Garfield wrote: On 10/23/2013 08:51 AM, Jay Blanchard wrote: [snip] a bitter rant[/snip] Dang Larry - bad night? That wasn't a bitter rant. You haven't seen me bitter. :-) That was tough love to the OP. I don't see a reason to pussyfoot around the original question, which is one that comes up about once a month. The answer is always the same: How much is your time worth? Basic math... Life: finite Time: infinite finite / infinite = 0 *sniffle* Who's valuation of your time actually matters? Yours, and yours alone. Therefore: Life: n years Time I can benefit from my life: n years n years / n years = 1 *hoorah* Your time is the most precious commodity you have. Whether you use a framework or not you will (hopefully) reuse code between projects. If you choose to make part of that reused code one of the many frameworks that exist, you need only do one thing to ensure it continues to be worth using: how much of your time do you spend battling against the restrictions of the framework? If that's sufficiently low then using that framework is probably a good thing. If a significant portion of your time is spent battling the framework it's time to make a change. Also remember that the only person who can truthfully judge whether you're wasting time is you, unless you earn money by selling your time to someone else in which case they have some right to decide what constitutes a waste of the time for which they're paying. I found the experience of writing my own framework to be hugely beneficial to my future productivity, but I might have struggled to justify spending the extra time it took to my employer at the time. You stripped away the context of my response. By removing the evil grin you made it look like I was serious. You should be a reporter ;) Cheers, Rob. -- E-Mail Disclaimer: Information contained in this message and any attached documents is considered confidential and legally protected. This message is intended solely for the addressee(s).
php-general Digest 25 Oct 2013 14:01:46 -0000 Issue 8409
php-general Digest 25 Oct 2013 14:01:46 - Issue 8409 Topics (messages 322370 through 322375): Persistent connections 322370 by: Nibin V M 322371 by: Stuart Dallas 322372 by: Nibin V M 322373 by: Stuart Dallas 322374 by: Nibin V M Re: framework or not 322375 by: Robert Cummings 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--- Hello, I have been reading docs and many are telling that persistent connections are kept open indefinitely. But I found in PHP docs that it will not close after script execution like requesting a page; so should it close after the request is over? So when exactly a persistent connection should close? Please advice. -- Regards Nibin. ---End Message--- ---BeginMessage--- On 25 Oct 2013, at 11:10, Nibin V M nibi...@gmail.com wrote: I have been reading docs and many are telling that persistent connections are kept open indefinitely. But I found in PHP docs that it will not close after script execution like requesting a page; so should it close after the request is over? So when exactly a persistent connection should close? Please advice. A persistent connection is closed when the PHP process ends, or it gets disconnected by the server-side or due to a network error. Attempting to explicitly close a persistent connection will do nothing without complaining. -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ ---End Message--- ---BeginMessage--- Thank you for the quick response Stuart...one more doubt..at http://php.net/manual/en/features.persistent-connections.php they states = This means that when the same client makes a second request to the server, it may be served by a different child process than the first time. When opening a persistent connection, every following page requesting SQL services can reuse the same established connection to the SQL server = Is the persistent connection pool is re-used between apache child processes ? On Fri, Oct 25, 2013 at 3:54 PM, Stuart Dallas stu...@3ft9.com wrote: On 25 Oct 2013, at 11:10, Nibin V M nibi...@gmail.com wrote: I have been reading docs and many are telling that persistent connections are kept open indefinitely. But I found in PHP docs that it will not close after script execution like requesting a page; so should it close after the request is over? So when exactly a persistent connection should close? Please advice. A persistent connection is closed when the PHP process ends, or it gets disconnected by the server-side or due to a network error. Attempting to explicitly close a persistent connection will do nothing without complaining. -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ -- Regards Nibin. http://TechsWare.in ---End Message--- ---BeginMessage--- On 25 Oct 2013, at 12:51, Nibin V M nibi...@gmail.com wrote: Thank you for the quick response Stuart...one more doubt..at http://php.net/manual/en/features.persistent-connections.php they states = This means that when the same client makes a second request to the server, it may be served by a different child process than the first time. When opening a persistent connection, every following page requesting SQL services can reuse the same established connection to the SQL server = Is the persistent connection pool is re-used between apache child processes ? No, connections are not shared between PHP processes. Nothing is shared between PHP processes. -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ On Fri, Oct 25, 2013 at 3:54 PM, Stuart Dallas stu...@3ft9.com wrote: On 25 Oct 2013, at 11:10, Nibin V M nibi...@gmail.com wrote: I have been reading docs and many are telling that persistent connections are kept open indefinitely. But I found in PHP docs that it will not close after script execution like requesting a page; so should it close after the request is over? So when exactly a persistent connection should close? Please advice. A persistent connection is closed when the PHP process ends, or it gets disconnected by the server-side or due to a network error. Attempting to explicitly close a persistent connection will do nothing without complaining. -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ -- Regards Nibin. http://TechsWare.in ---End Message--- ---BeginMessage--- ok..thank you very much Stuart :) On Fri, Oct 25, 2013 at 6:02 PM, Stuart Dallas stu...@3ft9.com wrote: On 25 Oct 2013, at 12:51, Nibin V M nibi...@gmail.com wrote: Thank you for the quick response Stuart...one more doubt..at
Re: [PHP] Persistent connections
On 25 Oct 2013, at 12:51, Nibin V M nibi...@gmail.com wrote: Thank you for the quick response Stuart...one more doubt..at http://php.net/manual/en/features.persistent-connections.php they states = This means that when the same client makes a second request to the server, it may be served by a different child process than the first time. When opening a persistent connection, every following page requesting SQL services can reuse the same established connection to the SQL server = Is the persistent connection pool is re-used between apache child processes ? No, connections are not shared between PHP processes. Nothing is shared between PHP processes. -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ On Fri, Oct 25, 2013 at 3:54 PM, Stuart Dallas stu...@3ft9.com wrote: On 25 Oct 2013, at 11:10, Nibin V M nibi...@gmail.com wrote: I have been reading docs and many are telling that persistent connections are kept open indefinitely. But I found in PHP docs that it will not close after script execution like requesting a page; so should it close after the request is over? So when exactly a persistent connection should close? Please advice. A persistent connection is closed when the PHP process ends, or it gets disconnected by the server-side or due to a network error. Attempting to explicitly close a persistent connection will do nothing without complaining. -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ -- Regards Nibin. http://TechsWare.in -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Persistent connections
Hello, I have been reading docs and many are telling that persistent connections are kept open indefinitely. But I found in PHP docs that it will not close after script execution like requesting a page; so should it close after the request is over? So when exactly a persistent connection should close? Please advice. -- Regards Nibin.
Re: [PHP] I am puzzled. Error on one site, no error on the other
On Fri, Oct 25, 2013 at 8:27 PM, Stephen stephe...@rogers.com wrote: Problem Situation I have two web sites on the same shared host. They share code for the control panel. When executed for one site I get a warning (reproducible always), but on the other there is no warning. One my home server, set up in the same way, I do not get a warning for either site. The warning is from this code: if ( in_array( $keys, $photo_ids ) ) *Warning*: in_array() expects parameter 2 to be array, null given in */home/rois3324/include/**cpprocessforms.php* on line *203* Steps 1) Photos are transferred to incoming directory using ftp. 2) Photo data is imported into database and files moved to web site's file system 3) Photos are linked to a category by i) Specifying photos to consider by entering filespec using wildcards ii) User presented with photos iii) User selects photos to be added to category and clicks process button iv) Form returns array of photo_ids (key in database table) v) Form processor creates entry in link table that links category_id to photo_id vi) A check is made to detect and reject when the link already exists This is where the error occurs I have looked at the code, but I am at a total loss to figure out why I have trouble on one site and not the other, even though they are using the code. And my home development system has no problems. I can't play trial and error on the development system. Anyone have any ideas? This is the code where the warning is triggered: function linkphotos( $dbh, $x ) { global $thumbsdirectory; $ret_str = ; $cat_id = $x['category']; $photos = $x['list']; $sql0 = SELECT photo_filename FROM photographs WHERE photo_id = :id; $sql1 = SELECT photo_id FROM gallery_photos WHERE photo_category = :id; $sql2= INSERT INTO gallery_photos VALUES ( :id, :photo_id, :order ); $stmt = $dbh-prepare($sql0); try { foreach( $photos as $keys= $on) { $stmt-bindValue(':id', $keys); $stmt-execute(); $row = $stmt-fetch(PDO::FETCH_ASSOC)**; $filenames[$keys] = $thumbsdirectory . / . $row['photo_filename']; } } catch (PDOException $e) { return 'Error selecting existing file names: ' . $e-getMessage(); } $stmt = $dbh-prepare($sql1); try { $stmt-bindValue(':id', $cat_id); $stmt-execute(); while ( list( $id ) = $stmt-fetch(PDO::FETCH_NUM)) { $photo_ids[] = $id; } } catch (PDOException $e) { return 'Error selecting existing photos: ' . $e-getMessage(); } $stmt = $dbh-prepare($sql2); try { $stmt-bindValue(':id', $cat_id); foreach( $photos as $keys= $on) { $ret_str .= htmlimage($filenames[$keys], $filenames[$keys] ) . br /; if ( in_array( $keys, $photo_ids ) ) { warning raised here $ret_str .= Duplicate. Already in Category.br /; } else { $stmt-bindValue(':photo_id', $keys); $stmt-bindValue(':order', $keys); $stmt-execute(); $ret_str .= Added to Category.br /; } } } catch (PDOException $e) { return 'Error inserting new photos: ' . $e-getMessage(); } return $ret_str; } -- Stephen Your $photo_ids array is not declared. After $photos = $x['list']; add $photo_ids = array();
Re: [PHP] framework or not
On 25 Oct 2013, at 15:40, Robert Cummings rob...@interjinn.com wrote: On 13-10-25 10:17 AM, Stuart Dallas wrote: On 25 Oct 2013, at 15:01, Robert Cummings rob...@interjinn.com wrote: On 13-10-24 09:41 PM, Larry Garfield wrote: On 10/23/2013 08:51 AM, Jay Blanchard wrote: [snip] a bitter rant[/snip] Dang Larry - bad night? That wasn't a bitter rant. You haven't seen me bitter. :-) That was tough love to the OP. I don't see a reason to pussyfoot around the original question, which is one that comes up about once a month. The answer is always the same: How much is your time worth? Basic math... Life: finite Time: infinite finite / infinite = 0 *sniffle* Who's valuation of your time actually matters? Yours, and yours alone. Therefore: Life: n years Time I can benefit from my life: n years n years / n years = 1 *hoorah* Your time is the most precious commodity you have. Whether you use a framework or not you will (hopefully) reuse code between projects. If you choose to make part of that reused code one of the many frameworks that exist, you need only do one thing to ensure it continues to be worth using: how much of your time do you spend battling against the restrictions of the framework? If that's sufficiently low then using that framework is probably a good thing. If a significant portion of your time is spent battling the framework it's time to make a change. Also remember that the only person who can truthfully judge whether you're wasting time is you, unless you earn money by selling your time to someone else in which case they have some right to decide what constitutes a waste of the time for which they're paying. I found the experience of writing my own framework to be hugely beneficial to my future productivity, but I might have struggled to justify spending the extra time it took to my employer at the time. You stripped away the context of my response. By removing the evil grin you made it look like I was serious. You should be a reporter ;) Who says I'm not! :) -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] framework or not
On 13-10-24 09:41 PM, Larry Garfield wrote: On 10/23/2013 08:51 AM, Jay Blanchard wrote: [snip] a bitter rant[/snip] Dang Larry - bad night? That wasn't a bitter rant. You haven't seen me bitter. :-) That was tough love to the OP. I don't see a reason to pussyfoot around the original question, which is one that comes up about once a month. The answer is always the same: How much is your time worth? Basic math... Life: finite Time: infinite finite / infinite = 0 *sniffle* Oh wait... you meant in the smaller scheme of things :) Cheers, Rob. -- E-Mail Disclaimer: Information contained in this message and any attached documents is considered confidential and legally protected. This message is intended solely for the addressee(s). Disclosure, copying, and distribution are prohibited unless authorized. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php