Archive for the ‘php’ Category

VMWare, Losing Time, and Sessions

Thursday, May 8th, 2008

I'll keep it short. In the last few days, login on our dev server broke. We hadn't changed anything related to it, and everything looked good code wise. What we finally figured out was that our session cookie was set to expire 2 days into the future, ...

PHP Warning: Memcache::set(): Failed to extract ‘connection’ variable

Wednesday, April 16th, 2008

I got this today. Solved by restarting the Memcached server. Move along. Edit: this is actually a reoccurring bug we're seeing with the memcache 2.2.3 stable build on 2 different boxes 2nd Edit: Actually it was a bug in my code. I wasn't setting the server and ip correctly, ...

How curl_exec and urlencode killed my single sign on

Wednesday, April 16th, 2008

If you do any work with single sign on, you'll be familiar with the concept of exchanging tokens and validating against the authentication server using that token. One of the issues I've just run into which resulted in a huge headache is with urlencoding the result of a curl_exec ...

Executing multiple curl requests in parallel with PHP and curl_multi_exec

Wednesday, February 20th, 2008

Let's get one thing out in the open. Curl is sweet. It does it's job very well, and I'm absoutely thrilled it exists. If you're using curl in your PHP app to make web requests, you've probably realized that by doing them one after the other, the total time of ...

Getting phpsh to work on a mac

Tuesday, December 18th, 2007

I had an issue getting phpsh to work on my mac - I kept getting the following error: Traceback (most recent call last): File "./phpsh", line 20, in import readline OK, seems easy enough. So I compiled python with readline support. ./configure --prefix=/usr/local/python --enable-readline I change the ...

ob_start() causes phpsh to hang, sort of

Saturday, December 15th, 2007

If you manually call ob_start() at the beginning of your script, you might notice that you are unable to use phpsh. By commenting it out, I was able to fix the issue. I don't think it technically hangs, it just sits there with the data in a buffer waiting to ...

PHP: An Array of Months

Friday, November 16th, 2007

I'll be honest, this isn't very useful. The goal was to have an array of months in the least amount of code. for($i = 1; $i

Reading Raw Post Data in PHP

Wednesday, November 14th, 2007

Perhaps you'd like to just sent XML over post, and not have xml=your_nodes_and_stuff_here. No sweat. $xml = urldecode(file_get_contents('php://input')); Enjoy. This can now be called with: curl -d "some_xml_here" http://yoursite.com/pagename

Motorola RAZR and 406 Not acceptable

Friday, November 9th, 2007

In trying to get a site working on cell phones, I got a "406 Not acceptable" only on the Motorola RAZR. The site loaded fine on my Treo 755 and every Blackberry I've tried. It seems that the RAZR doesn't handle Multiviews very well, or at all for that matter. ...

PHP 4: session_start(): Failed to initialize storage module

Friday, October 12th, 2007

I'm migrating a PHP 4 site right now. It makes me realize how far PHP has come in the last few years. I ran across a weird bug where code was working on our dev server, but not production. I was getting the error: session_start(): Failed to initialize storage ...