[PHP] Possible bug in PHP 5.3.5 with OAuth extension?
Hello, I'm using the PHP OAuth extension and running into a strange issue. I'm not sure if it's a bug in PHP 5.3.5, or if it's a bug in the OAuth extension when installed on a system with PHP 5.3.5. On a machine with PHP 5.3.5, when I call OAuth::fetch() with http method of POST, the debug info is showing that it is sending as a GET request. As a result, the resource that I'm fetching returns with failure since it will only respond to a POST request. I tested this out on two different machines, and getting the same result on both. One machine is Ubuntu 10.04 with nginx 0.8.54 and PHP 5.3.5. The other is CentOS 5.5 with apache 2.2 and PHP 5.3.5. I have another Ubuntu 10.04 machine with PHP 5.3.3, and I am not having this issue on that machine. The OAuth debug info is correctly showing http method of POST. I guess I'll need to use PHP 5.3.3 in the mean time, but it would be great to know what the problem is. Thanks, daniel
[PHP] Re: Possible bug in PHP 5.3.5 with OAuth extension?
Correction: I stated the incorrect version of PHP that does not seem to have this issue. The version of PHP that works correctly is 5.3.2, not 5.3.3. Thanks, daniel On Fri, Mar 4, 2011 at 11:40 AM, Daniel Hong wrote: > Hello, > > I'm using the PHP OAuth extension and running into a strange issue. I'm not > sure if it's a bug in PHP 5.3.5, or if it's a bug in the OAuth extension > when installed on a system with PHP 5.3.5. > > On a machine with PHP 5.3.5, when I call OAuth::fetch() with http method of > POST, the debug info is showing that it is sending as a GET request. As a > result, the resource that I'm fetching returns with failure since it will > only respond to a POST request. I tested this out on two different machines, > and getting the same result on both. One machine is Ubuntu 10.04 with nginx > 0.8.54 and PHP 5.3.5. The other is CentOS 5.5 with apache 2.2 and PHP 5.3.5. > > I have another Ubuntu 10.04 machine with PHP 5.3.3, and I am not having > this issue on that machine. The OAuth debug info is correctly showing http > method of POST. > > I guess I'll need to use PHP 5.3.3 in the mean time, but it would be great > to know what the problem is. > > Thanks, > daniel >
Re: [PHP] Re: Possible bug in PHP 5.3.5 with OAuth extension?
Hi Jim, I'm using oauth to connect to Dropbox. The OAuth::getRequestToken() and OAuth::getAccessToken() works without a problem since (assuming) those are sent over the wire as a GET request. When I try to issue a fetch command, for example: $oauth->enableDebug() $oauth->fetch('https://api.dropbox.com/0/account', array(), OAUTH_HTTP_METHOD_POST); print_r($oauth->debugInfo); In the debug info, the SBS string is showing that the http request method was GET, not POST. When I execute the same code on a machine running PHP 5.3.2, the SBS string shows POST. I took a look at the source for the oauth extension, it looks like requests could be made with PHP streams or with curl, but I couldn't tell what was the default. There is an OAuth::setRequestEngine() which you can pass in a constant for using either PHP streams or curl. The constant for using curl (OAUTH_REQENGINE_CURL) doesn't exist. When I try to print the constant, it just shows the "undefined" error message. I have the latest version of the oauth extension installed, so not sure what's wrong. When I view phpinfo, under oauth, it shows "Request engine support" is php_streams. But I'm not sure this entirely matters since on the server that does work, phpinfo shows that "Request engine support" is also php_streams. On a side question, why is it only showing that php_streams is supported? Why not curl as well? The php curl package is installed... Thanks, daniel On Fri, Mar 4, 2011 at 5:30 PM, Jim Lucas wrote: > On 3/4/2011 5:18 PM, Daniel Hong wrote: > > Correction: > > > > I stated the incorrect version of PHP that does not seem to have this > issue. > > The version of PHP that works correctly is 5.3.2, not 5.3.3. > > Can you give us an example of what you are doing? > > Jim Lucas > > > > > Thanks, > > daniel > > > > On Fri, Mar 4, 2011 at 11:40 AM, Daniel Hong > wrote: > > > >> Hello, > >> > >> I'm using the PHP OAuth extension and running into a strange issue. I'm > not > >> sure if it's a bug in PHP 5.3.5, or if it's a bug in the OAuth extension > >> when installed on a system with PHP 5.3.5. > >> > >> On a machine with PHP 5.3.5, when I call OAuth::fetch() with http method > of > >> POST, the debug info is showing that it is sending as a GET request. As > a > >> result, the resource that I'm fetching returns with failure since it > will > >> only respond to a POST request. I tested this out on two different > machines, > >> and getting the same result on both. One machine is Ubuntu 10.04 with > nginx > >> 0.8.54 and PHP 5.3.5. The other is CentOS 5.5 with apache 2.2 and PHP > 5.3.5. > >> > >> I have another Ubuntu 10.04 machine with PHP 5.3.3, and I am not having > >> this issue on that machine. The OAuth debug info is correctly showing > http > >> method of POST. > >> > >> I guess I'll need to use PHP 5.3.3 in the mean time, but it would be > great > >> to know what the problem is. > >> > >> Thanks, > >> daniel > >> > > > >
Re: [PHP] Re: Possible bug in PHP 5.3.5 with OAuth extension?
Ok, I'm such a dud. Looks like someone had already reported this exact bug http://pecl.php.net/bugs/bug.php?id=22485 I actually was looking at the problematic method in the source, but didn't catch the problem. But now that someone has pointed it out, it's so obvious. I deserve a slap on the back of my head! I've gone and install version 1.0.0 for the time being, seems to be working fine. -daniel On Fri, Mar 4, 2011 at 6:19 PM, Daniel Hong wrote: > Hi Jim, > > I'm using oauth to connect to Dropbox. The OAuth::getRequestToken() and > OAuth::getAccessToken() > works without a problem since (assuming) those are sent over the wire as a > GET request. When I try to issue a fetch command, for example: > > $oauth->enableDebug() > $oauth->fetch('https://api.dropbox.com/0/account', array(), > OAUTH_HTTP_METHOD_POST); > print_r($oauth->debugInfo); > > In the debug info, the SBS string is showing that the http request method > was GET, not POST. > > When I execute the same code on a machine running PHP 5.3.2, the SBS string > shows POST. > > I took a look at the source for the oauth extension, it looks like requests > could be made with PHP streams or with curl, but I couldn't tell what was > the default. There is an OAuth::setRequestEngine() which you can pass in a > constant for using either PHP streams or curl. The constant for using curl > (OAUTH_REQENGINE_CURL) doesn't exist. When I try to print the constant, it > just shows the "undefined" error message. I have the latest version of the > oauth extension installed, so not sure what's wrong. > > When I view phpinfo, under oauth, it shows "Request engine support" is > php_streams. But I'm not sure this entirely matters since on the server that > does work, phpinfo shows that "Request engine support" is also php_streams. > > On a side question, why is it only showing that php_streams is supported? > Why not curl as well? The php curl package is installed... > > Thanks, > daniel > > > On Fri, Mar 4, 2011 at 5:30 PM, Jim Lucas wrote: > >> On 3/4/2011 5:18 PM, Daniel Hong wrote: >> > Correction: >> > >> > I stated the incorrect version of PHP that does not seem to have this >> issue. >> > The version of PHP that works correctly is 5.3.2, not 5.3.3. >> >> Can you give us an example of what you are doing? >> >> Jim Lucas >> >> > >> > Thanks, >> > daniel >> > >> > On Fri, Mar 4, 2011 at 11:40 AM, Daniel Hong >> wrote: >> > >> >> Hello, >> >> >> >> I'm using the PHP OAuth extension and running into a strange issue. I'm >> not >> >> sure if it's a bug in PHP 5.3.5, or if it's a bug in the OAuth >> extension >> >> when installed on a system with PHP 5.3.5. >> >> >> >> On a machine with PHP 5.3.5, when I call OAuth::fetch() with http >> method of >> >> POST, the debug info is showing that it is sending as a GET request. As >> a >> >> result, the resource that I'm fetching returns with failure since it >> will >> >> only respond to a POST request. I tested this out on two different >> machines, >> >> and getting the same result on both. One machine is Ubuntu 10.04 with >> nginx >> >> 0.8.54 and PHP 5.3.5. The other is CentOS 5.5 with apache 2.2 and PHP >> 5.3.5. >> >> >> >> I have another Ubuntu 10.04 machine with PHP 5.3.3, and I am not having >> >> this issue on that machine. The OAuth debug info is correctly showing >> http >> >> method of POST. >> >> >> >> I guess I'll need to use PHP 5.3.3 in the mean time, but it would be >> great >> >> to know what the problem is. >> >> >> >> Thanks, >> >> daniel >> >> >> > >> >> >
[PHP] Possible to pinpoint peak memory usage?
Hello, Is it possible to pinpoint the location where the most memory was used? I log memory_get_peak_usage() in sections of my code where I believe the most memory would be consumed, but I haven't had luck with getting an accurate picture. I also log the peak usage at the very end of the code. I can see memory usage go up in places that I expected it to, but then things are pretty much flat lined. However, the peak usage at the very end shows a much higher number, sometimes it could be twice as large. I'm also tracing with xdebug. At the beginning of the trace memory starts off low, then it goes up as things are allocated. It also goes back down as things are deallocated. But never do I see the numbers as high as what PHP is reporting as the peak. It looks like xdebug traces at every step of execution, shouldn't the memory usage shown in the trace be the actual usage for every single step in the code? Why is PHP reporting that peak was much higher? Maybe I'm not understanding this stuff correctly? Thanks, daniel
Re: [PHP] Possible to pinpoint peak memory usage?
Nice. I will give XHProf a try. Thanks! -daniel On Fri, Mar 11, 2011 at 12:04 PM, David Harkness wrote: > On Fri, Mar 11, 2011 at 11:35 AM, Daniel Hong wrote: > >> Is it possible to pinpoint the location where the most memory was used? > > > Take a look at XHProf. [1] It will track memory and time of all function > calls. Paul Reinheimer created a GUI [2] to make dealing with the data > easier. > > Peace, > David > > [1] http://mirror.facebook.net/facebook/xhprof/doc.html > [2] > http://blog.preinheimer.com/index.php?/archives/355-A-GUI-for-XHProf.html > >