Re: [PHP] Re: Epiphany - a salute to APC
On Sun, Jul 5, 2009 at 2:43 AM, Paul Scott wrote: > Eddie Drapkin wrote: >> if you want a pure opcode cache, APC is a great choice. >> >>> you think this is similar to http://www.danga.com/memcached/ or you think >>> this method would be faster ? Which do you say would be the greatest >>> benfit ? >>> > A simple rule of thumb that I use is: > > If you have one machine and medium to large traffic loads, go APC > If you have more machines for caching servers (dedicated) and large to > holy mofo loads, then go MemcacheD > > This ALL assumes that you have followed a logical scalability plan and > have separate DB servers, app servers and possibly even using a CDN or > something beforehand. > > -- Paul > > http://www.paulscott.za.net/ > http://twitter.com/paulscott56 > http://avoir.uwc.ac.za > There are several problems with using APC instead of memcached, even on a single machine: 1) APC is tied to the wbserver. This brings up a lot of (not so) obvious problems. The processing is handled by the webserver, instead of a dedicated process. This can mean that a CPU intensive APC operation ties up the webserver, which results in less concurrency for your site, while just waiting to hear back from memcached means idle webserver process, which allows for greater concurrency. 2) APC is designed to be an opcode, first and foremost. And while it may perform as well, or better, on infrequently modified data, memcached is designed and optimized internally to map memory chunks and utilize best memory management practices, which mean data that changes frequently is better stored in memcached. There's a slideshow somewhere about facebook's internal caching, and they store things like school names / info in APC, because fetching it is a tad faster (especially localhost v. network), but the constant rewiring of webserver memory is a bad idea, so they store data that changes often (like status updates) in memcached. 3) memcached has a much richer, better API. Things like CAS can solve race conditions, while APC cannot. There's also increment/decrement, replace, etc. etc. 4) APC shares its memory between storage and opcodes, afaik. So, you fill up APC too much and you start to lose your cached opcodes? I'd rather not. 5) APC, once again, is tied to the webserver, so a webserver restart means you either have to a) prime your cache or b) let your database be hammered while you "live prime" the cache. Neither of these are particularly pleasant, as cache priming is a very difficult task, while allowing direct read access to the database on all pageloads is usually a problem when you have to have a key-val cache system in place. Long story short, if you're using some sort of RAM based cache to store heavy data, use memcached, while light data (configuration values read from a text file, maybe) are fine in APC. --Eddie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Epiphany - a salute to APC
ok thanks for information was just something I was reading about the other night. Then I came across this message. Brandon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Epiphany - a salute to APC
Eddie Drapkin wrote: > if you want a pure opcode cache, APC is a great choice. > >> you think this is similar to http://www.danga.com/memcached/ or you think >> this method would be faster ? Which do you say would be the greatest >> benfit ? >> A simple rule of thumb that I use is: If you have one machine and medium to large traffic loads, go APC If you have more machines for caching servers (dedicated) and large to holy mofo loads, then go MemcacheD This ALL assumes that you have followed a logical scalability plan and have separate DB servers, app servers and possibly even using a CDN or something beforehand. -- Paul http://www.paulscott.za.net/ http://twitter.com/paulscott56 http://avoir.uwc.ac.za -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Epiphany - a salute to APC
if you want a pure opcode cache, APC is a great choice. APC should //not// be used for persistent RAM storage. Memcached is much faster and designed for that aim, while not being tied to the webserver. On Sun, Jul 5, 2009 at 2:10 AM, Brandon Johnson wrote: > you think this is similar to http://www.danga.com/memcached/ or you think > this method would be faster ? Which do you say would be the greatest > benfit ? > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Epiphany - a salute to APC
you think this is similar to http://www.danga.com/memcached/ or you think this method would be faster ? Which do you say would be the greatest benfit ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] exasperated again
2009/7/4 PJ : > Stuart wrote: >> 2009/7/4 PJ : >> >>> Ashley Sheridan wrote: >>> On Sat, 2009-07-04 at 10:47 -0400, PJ wrote: > Jim Lucas wrote: > > >> PJ wrote: >> >> >>> Could somebody please explain to me what is wrong with this code? >>> In my script it works, returns the correct id, but when I try it in a >>> test pages, nothing in the world gets it to work. This is rather >>> frustrating, again: >>> THIS WORKS IN ANOTHER PAGE; IN THE TEST PAGE ID DOES NOT. >>> $sql = "SELECT id FROM publishers >>> WHERE publisher = 'whoever'"; >>> $result = mysql_query($sql,$db); >>> $row = mysql_fetch_assoc($result); if >>> (mysql_num_rows($result) !== 0) { >>> $pub = $row['id']; >>> Syntax is ok, echo "hello"; works. >>> >>> >>> This works in the test page: >>> $aid = array(); >>> $ord = array(); >>> $sql = "SELECT authID, ordinal >>> FROM book_author WHERE bookid = 624 ORDER BY ordinal ASC"; >>> $result = mysql_query($sql, $db); //$row = >>> mysql_fetch_assoc($result); >>> while ( $row = mysql_fetch_assoc($result) ) { >>> $aid[]=$row['authID']; >>> $ord[]=$row['ordinal']; >>> } >>> var_dump($aid); >>> echo ""; >>> var_dump($ord); >>> echo $aid[0], " - "; >>> echo $ord[0]; >>> >>> This does not: >>> $fi="joe"; $la="joe"; >>> $sql = "SELECT id FROM author >>> WHERE first_name = '$fi' && last_name = '$la'"; >>> $result = msql_query($sql, $db); >>> $row = mysql_fetch_assoc($result); >>> $count=mysql_num_rows($result); >>> echo $count; >>> if (mysql_num_rows($result) > 0) { >>> $a_id=$row['id']; >>> } >>> echo $a_id, ""; >>> The test page prints out echo "some text"; but no results when the >>> results are there >>> Tell me I have missed something simple here, or is this normal for php ? >>> I have checked the queries on Mysql command line and they are fine. >>> I have verified the syntax and Netbeans tells me it is fine. >>> Same results Firefox3 (2 machines) & IE 8. >>> What is not fine? >>> >>> >>> >> I was preaching this to you months ago. You should have error >> reporting turned on in a development area. >> >> by that I mean php should be set to display_errors = on and >> error_reporting = E_ALL >> >> Give this a try in a development area and "you will see the errors of >> your ways..." >> >> >> > The error reporting is always on as you suggested and I use it all the > time. > But error reporting cannot report a non-existing error - a human stupid > error that I finally caught - msql instead of mysql... oh. well... :-( > > -- > Hervé Kempf: "Pour sauver la planète, sortez du capitalisme." > - > Phil Jourdan --- p...@ptahhotep.com > http://www.ptahhotep.com > http://www.chiccantine.com/andypantry.php > > > > Actually, if you had error reporting on, it should have at least picked that up as a function that was not defined. You do mention you get a lot of white pages instead of errors, which suggests that either you do not have errors turned on, or you are turning them on from within PHP, >>> What do you mean "from within PHP" ? >>> Isn't this enough in the script? >>> error_reporting(E_ALL); >>> ini_set('display_errors', 1); >>> >> >> As Ash points out that will not display errors in the code syntax >> since they prevent any of your script from being executed. You're >> better off setting these values in php.ini. >> >> -Stuart >> >> > But not on a productions server, right? (Since this should have been > corrected before "going live") Indeed. If you're using the same server for both then use ini_set to turn display_errors off on the production site. -Stuart -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] exasperated again
Stuart wrote: > 2009/7/4 PJ : > >> Ashley Sheridan wrote: >> >>> On Sat, 2009-07-04 at 10:47 -0400, PJ wrote: >>> >>> Jim Lucas wrote: > PJ wrote: > > >> Could somebody please explain to me what is wrong with this code? >> In my script it works, returns the correct id, but when I try it in a >> test pages, nothing in the world gets it to work. This is rather >> frustrating, again: >> THIS WORKS IN ANOTHER PAGE; IN THE TEST PAGE ID DOES NOT. >> $sql = "SELECT id FROM publishers >> WHERE publisher = 'whoever'"; >> $result = mysql_query($sql,$db); >> $row = mysql_fetch_assoc($result); if >> (mysql_num_rows($result) !== 0) { >> $pub = $row['id']; >> Syntax is ok, echo "hello"; works. >> >> >> This works in the test page: >> $aid = array(); >> $ord = array(); >> $sql = "SELECT authID, ordinal >> FROM book_author WHERE bookid = 624 ORDER BY ordinal ASC"; >> $result = mysql_query($sql, $db); //$row = >> mysql_fetch_assoc($result); >> while ( $row = mysql_fetch_assoc($result) ) { >> $aid[]=$row['authID']; >> $ord[]=$row['ordinal']; >> } >> var_dump($aid); >> echo ""; >> var_dump($ord); >> echo $aid[0], " - "; >> echo $ord[0]; >> >> This does not: >> $fi="joe"; $la="joe"; >> $sql = "SELECT id FROM author >> WHERE first_name = '$fi' && last_name = '$la'"; >> $result = msql_query($sql, $db); >> $row = mysql_fetch_assoc($result); >> $count=mysql_num_rows($result); >> echo $count; >> if (mysql_num_rows($result) > 0) { >> $a_id=$row['id']; >> } >> echo $a_id, ""; >> The test page prints out echo "some text"; but no results when the >> results are there >> Tell me I have missed something simple here, or is this normal for php ? >> I have checked the queries on Mysql command line and they are fine. >> I have verified the syntax and Netbeans tells me it is fine. >> Same results Firefox3 (2 machines) & IE 8. >> What is not fine? >> >> >> > I was preaching this to you months ago. You should have error > reporting turned on in a development area. > > by that I mean php should be set to display_errors = on and > error_reporting = E_ALL > > Give this a try in a development area and "you will see the errors of > your ways..." > > > The error reporting is always on as you suggested and I use it all the time. But error reporting cannot report a non-existing error - a human stupid error that I finally caught - msql instead of mysql... oh. well... :-( -- Hervé Kempf: "Pour sauver la planète, sortez du capitalisme." - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php >>> Actually, if you had error reporting on, it should have at least picked >>> that up as a function that was not defined. You do mention you get a lot >>> of white pages instead of errors, which suggests that either you do not >>> have errors turned on, or you are turning them on from within PHP, >>> >> What do you mean "from within PHP" ? >> Isn't this enough in the script? >> error_reporting(E_ALL); >> ini_set('display_errors', 1); >> > > As Ash points out that will not display errors in the code syntax > since they prevent any of your script from being executed. You're > better off setting these values in php.ini. > > -Stuart > > But not on a productions server, right? (Since this should have been corrected before "going live") -- Hervé Kempf: "Pour sauver la planète, sortez du capitalisme." - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] exasperated again
Stuart wrote: > 2009/7/4 PJ : > >> Ashley Sheridan wrote: >> >>> On Sat, 2009-07-04 at 10:47 -0400, PJ wrote: >>> >>> Jim Lucas wrote: > PJ wrote: > > >> Could somebody please explain to me what is wrong with this code? >> In my script it works, returns the correct id, but when I try it in a >> test pages, nothing in the world gets it to work. This is rather >> frustrating, again: >> THIS WORKS IN ANOTHER PAGE; IN THE TEST PAGE ID DOES NOT. >> $sql = "SELECT id FROM publishers >> WHERE publisher = 'whoever'"; >> $result = mysql_query($sql,$db); >> $row = mysql_fetch_assoc($result); if >> (mysql_num_rows($result) !== 0) { >> $pub = $row['id']; >> Syntax is ok, echo "hello"; works. >> >> >> This works in the test page: >> $aid = array(); >> $ord = array(); >> $sql = "SELECT authID, ordinal >> FROM book_author WHERE bookid = 624 ORDER BY ordinal ASC"; >> $result = mysql_query($sql, $db); //$row = >> mysql_fetch_assoc($result); >> while ( $row = mysql_fetch_assoc($result) ) { >> $aid[]=$row['authID']; >> $ord[]=$row['ordinal']; >> } >> var_dump($aid); >> echo ""; >> var_dump($ord); >> echo $aid[0], " - "; >> echo $ord[0]; >> >> This does not: >> $fi="joe"; $la="joe"; >> $sql = "SELECT id FROM author >> WHERE first_name = '$fi' && last_name = '$la'"; >> $result = msql_query($sql, $db); >> $row = mysql_fetch_assoc($result); >> $count=mysql_num_rows($result); >> echo $count; >> if (mysql_num_rows($result) > 0) { >> $a_id=$row['id']; >> } >> echo $a_id, ""; >> The test page prints out echo "some text"; but no results when the >> results are there >> Tell me I have missed something simple here, or is this normal for php ? >> I have checked the queries on Mysql command line and they are fine. >> I have verified the syntax and Netbeans tells me it is fine. >> Same results Firefox3 (2 machines) & IE 8. >> What is not fine? >> >> >> > I was preaching this to you months ago. You should have error > reporting turned on in a development area. > > by that I mean php should be set to display_errors = on and > error_reporting = E_ALL > > Give this a try in a development area and "you will see the errors of > your ways..." > > > The error reporting is always on as you suggested and I use it all the time. But error reporting cannot report a non-existing error - a human stupid error that I finally caught - msql instead of mysql... oh. well... :-( -- Hervé Kempf: "Pour sauver la planète, sortez du capitalisme." - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php >>> Actually, if you had error reporting on, it should have at least picked >>> that up as a function that was not defined. You do mention you get a lot >>> of white pages instead of errors, which suggests that either you do not >>> have errors turned on, or you are turning them on from within PHP, >>> >> What do you mean "from within PHP" ? >> Isn't this enough in the script? >> error_reporting(E_ALL); >> ini_set('display_errors', 1); >> > > As Ash points out that will not display errors in the code syntax > since they prevent any of your script from being executed. You're > better off setting these values in php.ini. > > -Stuart > > Talk about exasperation: I just tried to find www.mangequebec.com on Guggle (!) Somebody tell me why on another computer going through the same connection to the internet finds and goes to that site. I have no reason to block that site as I never knew it existed. Yet, no matter how I input the name "mange quebec", "mangeQuebec", with or without the wwwcom or even .ca on FF3 and same results on IE8 this really sucks... -- Hervé Kempf: "Pour sauver la planète, sortez du capitalisme." - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] exasperated again
2009/7/4 PJ : > Ashley Sheridan wrote: >> On Sat, 2009-07-04 at 10:47 -0400, PJ wrote: >> >>> Jim Lucas wrote: >>> PJ wrote: > Could somebody please explain to me what is wrong with this code? > In my script it works, returns the correct id, but when I try it in a > test pages, nothing in the world gets it to work. This is rather > frustrating, again: > THIS WORKS IN ANOTHER PAGE; IN THE TEST PAGE ID DOES NOT. > $sql = "SELECT id FROM publishers > WHERE publisher = 'whoever'"; > $result = mysql_query($sql,$db); > $row = mysql_fetch_assoc($result); if > (mysql_num_rows($result) !== 0) { > $pub = $row['id']; > Syntax is ok, echo "hello"; works. > > > This works in the test page: > $aid = array(); > $ord = array(); > $sql = "SELECT authID, ordinal > FROM book_author WHERE bookid = 624 ORDER BY ordinal ASC"; > $result = mysql_query($sql, $db); //$row = > mysql_fetch_assoc($result); > while ( $row = mysql_fetch_assoc($result) ) { > $aid[]=$row['authID']; > $ord[]=$row['ordinal']; > } > var_dump($aid); > echo ""; > var_dump($ord); > echo $aid[0], " - "; > echo $ord[0]; > > This does not: > $fi="joe"; $la="joe"; > $sql = "SELECT id FROM author > WHERE first_name = '$fi' && last_name = '$la'"; > $result = msql_query($sql, $db); > $row = mysql_fetch_assoc($result); > $count=mysql_num_rows($result); > echo $count; > if (mysql_num_rows($result) > 0) { > $a_id=$row['id']; > } > echo $a_id, ""; > The test page prints out echo "some text"; but no results when the > results are there > Tell me I have missed something simple here, or is this normal for php ? > I have checked the queries on Mysql command line and they are fine. > I have verified the syntax and Netbeans tells me it is fine. > Same results Firefox3 (2 machines) & IE 8. > What is not fine? > > I was preaching this to you months ago. You should have error reporting turned on in a development area. by that I mean php should be set to display_errors = on and error_reporting = E_ALL Give this a try in a development area and "you will see the errors of your ways..." >>> The error reporting is always on as you suggested and I use it all the time. >>> But error reporting cannot report a non-existing error - a human stupid >>> error that I finally caught - msql instead of mysql... oh. well... :-( >>> >>> -- >>> Hervé Kempf: "Pour sauver la planète, sortez du capitalisme." >>> - >>> Phil Jourdan --- p...@ptahhotep.com >>> http://www.ptahhotep.com >>> http://www.chiccantine.com/andypantry.php >>> >>> >>> >> Actually, if you had error reporting on, it should have at least picked >> that up as a function that was not defined. You do mention you get a lot >> of white pages instead of errors, which suggests that either you do not >> have errors turned on, or you are turning them on from within PHP, > What do you mean "from within PHP" ? > Isn't this enough in the script? > error_reporting(E_ALL); > ini_set('display_errors', 1); As Ash points out that will not display errors in the code syntax since they prevent any of your script from being executed. You're better off setting these values in php.ini. -Stuart -- http://stut.net/ >> which >> can sometimes fail if there are fatal errors in the code. >> >> Thanks >> Ash >> www.ashleysheridan.co.uk >> >> >> > > > -- > Hervé Kempf: "Pour sauver la planète, sortez du capitalisme." > - > Phil Jourdan --- p...@ptahhotep.com > http://www.ptahhotep.com > http://www.chiccantine.com/andypantry.php > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] exasperated again
Ashley Sheridan wrote: > On Sat, 2009-07-04 at 10:47 -0400, PJ wrote: > >> Jim Lucas wrote: >> >>> PJ wrote: >>> Could somebody please explain to me what is wrong with this code? In my script it works, returns the correct id, but when I try it in a test pages, nothing in the world gets it to work. This is rather frustrating, again: THIS WORKS IN ANOTHER PAGE; IN THE TEST PAGE ID DOES NOT. $sql = "SELECT id FROM publishers WHERE publisher = 'whoever'"; $result = mysql_query($sql,$db); $row = mysql_fetch_assoc($result); if (mysql_num_rows($result) !== 0) { $pub = $row['id']; Syntax is ok, echo "hello"; works. This works in the test page: $aid = array(); $ord = array(); $sql = "SELECT authID, ordinal FROM book_author WHERE bookid = 624 ORDER BY ordinal ASC"; $result = mysql_query($sql, $db); //$row = mysql_fetch_assoc($result); while ( $row = mysql_fetch_assoc($result) ) { $aid[]=$row['authID']; $ord[]=$row['ordinal']; } var_dump($aid); echo ""; var_dump($ord); echo $aid[0], " - "; echo $ord[0]; This does not: $fi="joe"; $la="joe"; $sql = "SELECT id FROM author WHERE first_name = '$fi' && last_name = '$la'"; $result = msql_query($sql, $db); $row = mysql_fetch_assoc($result); $count=mysql_num_rows($result); echo $count; if (mysql_num_rows($result) > 0) { $a_id=$row['id']; } echo $a_id, ""; The test page prints out echo "some text"; but no results when the results are there Tell me I have missed something simple here, or is this normal for php ? I have checked the queries on Mysql command line and they are fine. I have verified the syntax and Netbeans tells me it is fine. Same results Firefox3 (2 machines) & IE 8. What is not fine? >>> I was preaching this to you months ago. You should have error >>> reporting turned on in a development area. >>> >>> by that I mean php should be set to display_errors = on and >>> error_reporting = E_ALL >>> >>> Give this a try in a development area and "you will see the errors of >>> your ways..." >>> >>> >> The error reporting is always on as you suggested and I use it all the time. >> But error reporting cannot report a non-existing error - a human stupid >> error that I finally caught - msql instead of mysql... oh. well... :-( >> >> -- >> Hervé Kempf: "Pour sauver la planète, sortez du capitalisme." >> - >> Phil Jourdan --- p...@ptahhotep.com >>http://www.ptahhotep.com >>http://www.chiccantine.com/andypantry.php >> >> >> > Actually, if you had error reporting on, it should have at least picked > that up as a function that was not defined. You do mention you get a lot > of white pages instead of errors, which suggests that either you do not > have errors turned on, or you are turning them on from within PHP, What do you mean "from within PHP" ? Isn't this enough in the script? error_reporting(E_ALL); ini_set('display_errors', 1); > which > can sometimes fail if there are fatal errors in the code. > > Thanks > Ash > www.ashleysheridan.co.uk > > > -- Hervé Kempf: "Pour sauver la planète, sortez du capitalisme." - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] exasperated again
On Sat, 2009-07-04 at 10:47 -0400, PJ wrote: > Jim Lucas wrote: > > PJ wrote: > >> Could somebody please explain to me what is wrong with this code? > >> In my script it works, returns the correct id, but when I try it in a > >> test pages, nothing in the world gets it to work. This is rather > >> frustrating, again: > >> THIS WORKS IN ANOTHER PAGE; IN THE TEST PAGE ID DOES NOT. > >> $sql = "SELECT id FROM publishers > >> WHERE publisher = 'whoever'"; > >> $result = mysql_query($sql,$db); > >> $row = mysql_fetch_assoc($result); if > >> (mysql_num_rows($result) !== 0) { > >> $pub = $row['id']; > >> Syntax is ok, echo "hello"; works. > >> > >> > >> This works in the test page: > >> $aid = array(); > >> $ord = array(); > >> $sql = "SELECT authID, ordinal > >> FROM book_author WHERE bookid = 624 ORDER BY ordinal ASC"; > >> $result = mysql_query($sql, $db); //$row = > >> mysql_fetch_assoc($result); > >> while ( $row = mysql_fetch_assoc($result) ) { > >> $aid[]=$row['authID']; > >> $ord[]=$row['ordinal']; > >> } > >> var_dump($aid); > >> echo ""; > >> var_dump($ord); > >> echo $aid[0], " - "; > >> echo $ord[0]; > >> > >> This does not: > >> $fi="joe"; $la="joe"; > >> $sql = "SELECT id FROM author > >> WHERE first_name = '$fi' && last_name = '$la'"; > >> $result = msql_query($sql, $db); > >> $row = mysql_fetch_assoc($result); > >> $count=mysql_num_rows($result); > >> echo $count; > >> if (mysql_num_rows($result) > 0) { > >> $a_id=$row['id']; > >> } > >> echo $a_id, ""; > >> The test page prints out echo "some text"; but no results when the > >> results are there > >> Tell me I have missed something simple here, or is this normal for php ? > >> I have checked the queries on Mysql command line and they are fine. > >> I have verified the syntax and Netbeans tells me it is fine. > >> Same results Firefox3 (2 machines) & IE 8. > >> What is not fine? > >> > > > > I was preaching this to you months ago. You should have error > > reporting turned on in a development area. > > > > by that I mean php should be set to display_errors = on and > > error_reporting = E_ALL > > > > Give this a try in a development area and "you will see the errors of > > your ways..." > > > The error reporting is always on as you suggested and I use it all the time. > But error reporting cannot report a non-existing error - a human stupid > error that I finally caught - msql instead of mysql... oh. well... :-( > > -- > Hervé Kempf: "Pour sauver la planète, sortez du capitalisme." > - > Phil Jourdan --- p...@ptahhotep.com >http://www.ptahhotep.com >http://www.chiccantine.com/andypantry.php > > Actually, if you had error reporting on, it should have at least picked that up as a function that was not defined. You do mention you get a lot of white pages instead of errors, which suggests that either you do not have errors turned on, or you are turning them on from within PHP, which can sometimes fail if there are fatal errors in the code. Thanks Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Epiphany - a salute to APC
I'd never bothered to use an opcode cache before. Sure, I had used accelerators that cached includes and stuff in ram, but damn - APC has made my site (at least on dev machine) snappy. It wasn't too bad before, but I make heavy use of the database. This is necessary for me to make maintenance easier. IE - my site deals with biology and latin names, and now that various mtDNA tests are cheaper, there's a lot of taxonomy change going on. First my beloved Hyla regilla changed to Pseudacris regilla, now (though I disagree) it may be split with my species becoming Pseudacris sierra. American Bullfrogs, Western Toads, several species are likely to have changes to their taxonomy soon that I do agree with. So I have a unique ID and every page where a species is mentioned, common/latin names are grabbed from the DB so I can do a single SQL update and the entire site is modern (and easily reverted too). Anyway - I have a crap load of tables and a lot of queries per page, but the results most queries almost never change. Caching the results with APC has made things a lot faster. But I even went beyond that. My site is all created via DOMDocument. Most of the pages have a content div that rarely changes. Even though caching the database sped it up, I found that on complex pages that used a lot of calls to DOMDocument functions but rarely actually change, creating the main content div as a separate dom object, exporting it to an XML string and caching the XML string, and then importing the XML on subsequent page loads sped them up as well. I'm not done with the mods yet - there's a few places where poor code design on my part makes it more difficult to do the separation of content that can be cached, and I need to go to all of the sql insert/update statements so the appropriate cached key/value pairs get deleted upon successful insert, but damn - it makes a HUGE difference - and I'm only doing opcode caching (APC breaks pear::MDB2). Once I figure out how to tell it to cache includes EXCEPT for /usr/share/pear - I may even squeak out more performance. It's the 4th of July so lists are slow, so I just wanted to take my hat off to the APC team. It absolutely rocks. For others like me who just never bothered to look into it, look into it. Only caveat - don't use it on shared hosting (maybe safe with php-cgi in shared hosting), and don't call apc directly - call functions that wrap apc so you can gracefully disable it (or even change to a different opcode cache) - IE function wrap_delete($key) { $key = 'sherp_' . $key; if (function_exists('apc_delete')) { $value = apc_delete($key); return $value; } else { return false; } } function wrap_store($key,$value,$life=3600) { $key = 'sherp_' . $key; if (function_exists('apc_store')) { $rs = apc_store($key,$value,$life); return $rs; } else { return false; } } (the sherp_ in above wrappers is just so that I don't have to worry about collisions with other web apps I run that I port to apc. Kind of like namespacing) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Love luxury? Buy a fashionable watch.
On Sat, Jul 4, 2009 at 15:47, Eddie Drapkin wrote: > I bought one, these are AWESOME. General policy on the list is not to respond to these, even as a joke. It just confirms to the jackasses who send this crap that the message was read by someone. -- daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Check out our great hosting and dedicated server deals at http://twitter.com/pilotpig -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] exasperated again
Jim Lucas wrote: > PJ wrote: >> Could somebody please explain to me what is wrong with this code? >> In my script it works, returns the correct id, but when I try it in a >> test pages, nothing in the world gets it to work. This is rather >> frustrating, again: >> THIS WORKS IN ANOTHER PAGE; IN THE TEST PAGE ID DOES NOT. >> $sql = "SELECT id FROM publishers >> WHERE publisher = 'whoever'"; >> $result = mysql_query($sql,$db); >> $row = mysql_fetch_assoc($result); if >> (mysql_num_rows($result) !== 0) { >> $pub = $row['id']; >> Syntax is ok, echo "hello"; works. >> >> >> This works in the test page: >> $aid = array(); >> $ord = array(); >> $sql = "SELECT authID, ordinal >> FROM book_author WHERE bookid = 624 ORDER BY ordinal ASC"; >> $result = mysql_query($sql, $db); //$row = >> mysql_fetch_assoc($result); >> while ( $row = mysql_fetch_assoc($result) ) { >> $aid[]=$row['authID']; >> $ord[]=$row['ordinal']; >> } >> var_dump($aid); >> echo ""; >> var_dump($ord); >> echo $aid[0], " - "; >> echo $ord[0]; >> >> This does not: >> $fi="joe"; $la="joe"; >> $sql = "SELECT id FROM author >> WHERE first_name = '$fi' && last_name = '$la'"; >> $result = msql_query($sql, $db); >> $row = mysql_fetch_assoc($result); >> $count=mysql_num_rows($result); >> echo $count; >> if (mysql_num_rows($result) > 0) { >> $a_id=$row['id']; >> } >> echo $a_id, ""; >> The test page prints out echo "some text"; but no results when the >> results are there >> Tell me I have missed something simple here, or is this normal for php ? >> I have checked the queries on Mysql command line and they are fine. >> I have verified the syntax and Netbeans tells me it is fine. >> Same results Firefox3 (2 machines) & IE 8. >> What is not fine? >> > > I was preaching this to you months ago. You should have error > reporting turned on in a development area. > > by that I mean php should be set to display_errors = on and > error_reporting = E_ALL > > Give this a try in a development area and "you will see the errors of > your ways..." > The error reporting is always on as you suggested and I use it all the time. But error reporting cannot report a non-existing error - a human stupid error that I finally caught - msql instead of mysql... oh. well... :-( -- Hervé Kempf: "Pour sauver la planète, sortez du capitalisme." - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Writing to a file
Jason Carson wrote: Yes, I am trying to write stuff to a file with PHP but in between the tags and without deleting what is already in the file. The only way is to read the file into memory, manipulate it there, and then rewrite it. Use a regex to get rid of the last closing tag, append your new lines to it, and then write it. You probably want to do it atomic or you can end up with occasional issues (broken pages that requested the file you are writing before it is finished being written) and I don't know if php can do that. Again that's where using a non php config file that is parsed by php. You can make your edits, save the file to cache (IE APC) and then write it. Files that need its contents can get it out of cache and only need to read it from file if it isn't cached. Since you cache it before writing, it will be in cache while it is being written. Another advantage to not using php for the file, you can validate the values before setting/using them and handle problems appropriately in your code rather than have a completely broken site because the script that wrote the file had a bug causing a ; not to be written under certain conditions. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php