php-general Digest 5 Jul 2009 08:44:55 -0000 Issue 6212
Topics (messages 294879 through 294895):
Re: Love luxury? Buy a fashionable watch.
294879 by: Eddie Drapkin
294880 by: Daniel Brown
Epiphany - a salute to APC
294881 by: Michael A. Peters
294888 by: Brandon Johnson
294889 by: Eddie Drapkin
294890 by: Paul Scott
294891 by: Brandon Johnson
294892 by: Eddie Drapkin
294893 by: Michael A. Peters
294894 by: Eddie Drapkin
Re: exasperated again
294882 by: Ashley Sheridan
294883 by: PJ
294884 by: Stuart
294885 by: PJ
294886 by: PJ
294887 by: Stuart
Editing PEAR packages
294895 by: Waynn Lue
Administrivia:
To subscribe to the digest, e-mail:
[email protected]
To unsubscribe from the digest, e-mail:
[email protected]
To post to the list, e-mail:
[email protected]
----------------------------------------------------------------------
--- Begin Message ---
I bought one, these are AWESOME.
On Sat, Jul 4, 2009 at 4:16 PM, Leland Finch<[email protected]> wrote:
> You don’t have to save your money for affording a brand watch, as now you
> can get a designer watch at a very funny price. Just order it and we will
> deliver it to you no matter where you are.
>
> Visit everybody
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
On Sat, Jul 4, 2009 at 15:47, Eddie Drapkin<[email protected]> 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 P. Brown>
[email protected] || [email protected]
http://www.parasane.net/ || http://www.pilotpig.net/
Check out our great hosting and dedicated server deals at
http://twitter.com/pilotpig
--- End Message ---
--- Begin Message ---
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)
--- End Message ---
--- Begin Message ---
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 ?
--- End Message ---
--- Begin Message ---
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<[email protected]> 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
>
>
--- End Message ---
--- Begin Message ---
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
--- End Message ---
--- Begin Message ---
ok thanks for information was just something I was reading about the
other night. Then I came across this message.
Brandon
--- End Message ---
--- Begin Message ---
On Sun, Jul 5, 2009 at 2:43 AM, Paul Scott<[email protected]> 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
--- End Message ---
--- Begin Message ---
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 ?
In my case I think apc is better because I'm single server xen host and
(after reading the other posts in thread) most of my data rarely
changes. New data is added but existing data doesn't change often.
-=- (from other discussion)
Interesting that facebook uses both. The fedora maintainer for the apc
rpm listed it as conflicting with memcache. If you can use both, that's
a fedora packaging but that should be fixed.
--- End Message ---
--- Begin Message ---
> -=- (from other discussion)
> Interesting that facebook uses both. The fedora maintainer for the apc rpm
> listed it as conflicting with memcache. If you can use both, that's a fedora
> packaging but that should be fixed.
I've never seen, nor heard of, a full scale caching implementation
that doesn't use both. Digg uses both, too.
--- End Message ---
--- Begin Message ---
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 "<br />";
> >> 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, "<br /><br />";
> >> 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 --- [email protected]
> 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
--- End Message ---
--- Begin Message ---
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 "<br />";
>>>> 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, "<br /><br />";
>>>> 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 --- [email protected]
>> 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 --- [email protected]
http://www.ptahhotep.com
http://www.chiccantine.com/andypantry.php
--- End Message ---
--- Begin Message ---
2009/7/4 PJ <[email protected]>:
> 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 "<br />";
>>>>> 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, "<br /><br />";
>>>>> 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 --- [email protected]
>>> 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 --- [email protected]
> 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
>
>
--- End Message ---
--- Begin Message ---
Stuart wrote:
> 2009/7/4 PJ <[email protected]>:
>
>> 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 "<br />";
>>>>>> 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, "<br /><br />";
>>>>>> 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 --- [email protected]
>>>> 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
www....com 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 --- [email protected]
http://www.ptahhotep.com
http://www.chiccantine.com/andypantry.php
--- End Message ---
--- Begin Message ---
Stuart wrote:
> 2009/7/4 PJ <[email protected]>:
>
>> 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 "<br />";
>>>>>> 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, "<br /><br />";
>>>>>> 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 --- [email protected]
>>>> 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 --- [email protected]
http://www.ptahhotep.com
http://www.chiccantine.com/andypantry.php
--- End Message ---
--- Begin Message ---
2009/7/4 PJ <[email protected]>:
> Stuart wrote:
>> 2009/7/4 PJ <[email protected]>:
>>
>>> 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 "<br />";
>>>>>>> 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, "<br /><br />";
>>>>>>> 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 --- [email protected]
>>>>> 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/
--- End Message ---
--- Begin Message ---
I wanted to makes some local edits to a PEAR package that I downloaded in
order to build some custom functionality into it. What's the best way to
manage this process to ensure that I don't accidentally blow away any
changes if I update the package? Should I just copy the entire package to
my own source repository, then use that directly instead of the PEAR
package? And if I do it that way, is there an easy path to upgrade it?
Waynn
--- End Message ---