iPhone SDK makes building PHP tricky

Posted on March 25th, 2008 | No Comments »

This morning, I needed to rebuild PHP.  I haven’t done it in months, but was sure it would be painless.  I hadn’t counted on, however, that I’d installed the iPhone SDK at the beginning of this month.  The iPhone SDK is Xcode 3.1, which I believe is beta (might not be, no real research.)  I think that it also installs gcc 4.2.  I forgot both of these facts before I tried to configure my php build.  Upon my inital pass, I was greeted with the following error:

configure: warning: –with-zlib: invalid host type
configure: warning: –with-mysql=/usr/local/mysql: invalid host type
configure: error: can only configure for one host and one target at a time

I, of course, didn’t bother to properly troubleshoot the error, as I didn’t really have time to track down a solution.  I did, however, manage to get a build in place.  I removed the current install of my developer tools, ala:

sudo /Developer/Library/uninstall-devtools --mode=all

And then I proceeded to reinstall the tools on my Leopard DVD.  I restarted for good measure, and was off to the races.  Have any of you encountered this issue?

Building PHP in Leopard

Posted on December 11th, 2007 | 2 Comments »

Like many of you, i’m sure, I was impressed with Apple’s inclusion of PHP 5 in Leopard.  For nearly 2 months,  i’ve been using the default PHP install without a single complaint.  It worked just fine,  had mysql support,  and worked with mostly everything i’d been working on.  Eventually, however, I needed more out of php than the base install allowed for. I needed the SOAP extension, I needed OpenSSL support, I needed mcrypt,  I wanted JSON,  I wanted GD.  (Actually, I needed those things for work, minus GD.)

Initally,  I simply downloaded PHP 5.2.5 from php.net and started to build.  I found out that some of the libraries I wanted to include weren’t included in OS X,  so I had to install them first.

Leopard includes XML libraries, so the SOAP extension works out of the box.  OpenSSL also works out of the box.  Mcrypt was the first extension that needed to be built.  It worked like this:

Download libmcrypt

cd <libmcrypt dir>
./configure --disable-posix-threads
make
sudo make install

Now you’ve got libmcrypt installed,  the next extension that needs anything installed is GD.  I won’t bother telling you how to install GD. I just used libpng, because PNG’s are what I work with.

That wraps up what I needed before I could build PHP.  It was time to download the PHP 5.2.5 source, and get rolling.  Here was how I configured PHP:

./configure --with-zlib --with-mysql=/usr/local/mysql --with-apxs2=/usr/sbin/apxs --enable-soap --with-openssl --with-mcrypt --with-gd
make
sudo make install

At this point,  your install will complain about apxs.  I attempted to restart apache,  but I had no success.  Calling :  apachectl -t  gave me a warning about libphp5.so no loading properly, due to the wrong architecture.  file libphp5.so reported that I had the right arch, so I was stumped.  I was left with apache 2 not being able to load my php module.

I tried a bunch of different things to fix the problem, but eventually solved it simply by rebuilding apache.  Just download httpd 2.2.3 (current as of this writing),  configure as you’d like (a simple ./configure will work without any options), make, sudo make install,  and then restart apache.

Voila,  you’re running the latest & greatest PHP and Apache on the latest & greatest Mac OS.

Patchstick makes Apple TV come alive

Posted on April 29th, 2007 | 5 Comments »

Like so many fanboys before me, I love new Apple products. I get excited over every new toy that comes out, thinking it will revolutionize something, usually to be slightly let down by launch day. The Apple TV was no different.

I ordered my Apple TV in January, a day or two after they were announced. I was excited about what I thought it could be. I was excited about what I thought it should be. I expected to be able to play all of my music and movies on my Apple TV without any problems. That is, until, I found out that it will only play MP4 video, and is pre-dispositioned to streaming content. I still gave it a chance. I ripped several seasons of South Park with Handbrake, just so I could re-watch them on my Apple TV. It got old. Fast. I hated the idea of needing to re-encode all of my existing video files, to be able to watch them on my television.

There were, of course, the folks who managed to crack open the Apple TV boxes, and coax them into playing Xvid files in pure warranty-voiding bliss. That wasn’t for me, however. I happen to like the idea of keeping the warranty on my Rev A hardware in tact. So, for a few weeks, my Apple TV sat next to my cable box, unplugged, waiting for an opportunity to be properly utilized.

Enter Patchstick.

Patchstick is a simple little disk image that you can expand onto a thumb drive, attach to your Apple TV, and within minutes, have SSH access, as well as a host of codecs installed and willing to be used. I had to give this a shot.

I got the image in place on a 1 GB thumb drive, and then plugged my Apple TV back into an outlet for the first time in a while. After the Apple TV boot sequence was done, I stuck the thumb drive in the back of the box, and held down Menu & ‘-’ on my remote, which apparently tells the Apple TV to boot into some form of recovery mode. The box restarted without any trouble, ran through some scripts, and then told me to unplug/reconnect my Apple TV. I did so, and everything looked/felt identical. A simple portscan later, however, and I discovered that I did indeed have an open port 22, meaning SSH was good to go.

Now that SSH was enabled, and I was connected to the box, a simple command :
sudo /usr/sbin/AppleFileServer turned on file sharing. I could now download multiple plugins for the Apple TV, and simply install them via Finder on my imac. Within minutes, I was happily playing my Xvid collection on my Apple TV. I think now I will finally use the Apple TV for what I had hoped it could do in the first place.

First Impression of Coda

Posted on April 25th, 2007 | 3 Comments »

Coda is the latest offering from Panic Inc.. It claims to be “one-window web development.” and that it allows you to “grow beautiful code”. Naturally, this software interested me. I’ve been on the quest for a good web development centric IDE for years, trying many solutions and never being fully satisfied. DreamWeaver was slow, had ugly dialogs, and didn’t play nice with SVN. Zend studio was bulky, and didn’t mirror remote files locally, which made it a pain in the neck when working with any form of version control, and a remote testing server. Admittedly, Coda has no support for version control either, but it’s a native cocoa app, so I was anxious to give it a try.

I’ll clarify what I was expecting. I’m a PHP programmer by trade. I sit down for hours each day, and write lines upon lines of PHP code. I want to have an application that will let me develop, test, and preview an web applications output all from one window. If I can upload my changes to a remote site or commit them to an SVN repository, that’s icing on the cake.

So, I fire up Safari, and head on over to download coda. First off, the site they’ve put together for it looks very nice. Clean, simple, easy to navigate. Find the “download” button, and click. A few minutes later, i’ve dropped it into my applications folder, and i’m ready to roll.

Upon launching Coda for the first time, i’m greeted with the option to sign up for Panic’s “eList”, which I gracefully decline. Ok, now we’re into the meat and potatoes. I apparently have to set up a “Site”, which i’ll assume is a project. Click the “Add Site” button, and i’m presented with 3 sets of fields. One for “Site” which appears to be generic path information for the site, “Connecting” which would be the ftp information for the remote site, and “Terminal” which is just some SSH information. My first experiment is to set the software up for a project i’m working on, that’s located remotely in a subdomain. I configure the FTP client without worry, and appear to configure the local/remote paths properly. All that’s left to do is connect to the remote server, and start having fun.

I hit connect. Error. Apparently Coda cannot chdir to my remote directory. I SSH into the server, and verify that I have my remote path set up correctly. Everything appears to be in order, so I try again. Error. Again. Coda throws the same error, but this time, i’m connected to my remote site. Open a file for editing, and let’s go. “index.php” is my file of choice, for this momentous occasion. Everything seems to open just fine, and within a second i’m editing my remote code. It looks like we’ve got some nice syntax highlighting. I make a quick change, hit Command + S, and click the “Preview” tab. Error. File not found. Ok, no problem, maybe related to the previous config. Control+click index, and download it locally. Switch over to the “Local” view, and edit the file. My changes don’t appear to be here, but they weren’t big changes anyway. I make the same changes, command+s again, and hit preview. Error. File not found. Sheesh. I determine that my odd remote configuration for this site might be the problem. I set up the domain root, and try again.

Now I have a second site, this time, a very vanilla config. Connecting works just fine, downloading, saving, Coda is starting to make me happy. I hit the “Preview” button one more time. Error. This time, Coda is previewing my PHP file as if it were plain text, via the “file://” url in the preview window. I’ve already wasted 20 minutes with this software, and it’s still playing nice. I give up for the night.

Tune in tomorrow for “Second Impression of Coda”

iSync and the Treo 650

Posted on April 18th, 2007 | No Comments »

I broke down this weekend and finally bought another cell phone. I’ve gone almost 2 years without one, but as time goes on, I find myself in more situations where having a phone would save me a lot of hassle with work.

I went to a Rogers kiosk with cheap phone in mind. I didn’t want a bottom of the line phone, mind you. I was looking for a few things:

  1. Can I use a wireless headset with it? (for long days on the road)
  2. Is it possible to send/recieve email on this phone?
  3. Bonus: Does it play nice with my iMac?

After some light research online, I figured some variant of the Razr would more than likely do the job. This particular kiosk, however, was having some form of promotion involving the Treo 650. If I were to sign up for a 3 year plan (as was my intent), I could walk away with a Treo 650 in hand, with no money down. Needless to say, I now own a Treo 650.

Upon my inital review, the phone did everything I wanted, and a good deal more. It handled headsets and email wonderfully. It had a funtional web browser. It had a (crappy) camera. It was even supposed to sync with my Mac, without any trouble. All of this was true, minus the “without any trouble” portion.
I was expecting to turn on bluetooth on the phone, open up isync and be rolling in a matter of minutes. This lead me to the discovery that I would have to use the phone’s “Hot Sync” software. No problem, right? I visit http://www.palm.com/ and grab the latest version of the software for Mac OS, install it, and i’m syncing in no time.

Problem: This sync software is syncing to “Palm Desktop”, which is in no way linked to Address Book, iCal, or any other of the various i-apps that help make my life a little more organized. Needless to say, this lead to much google fun, until I found out how to properly sync my phone. Here is a vague reference to using isync with a treo650.

  • Install Hot Sync Manager
  • Connect your sync cable to your phone, and your mac
  • Open iSync
  • Devices -> Enable Palm OS Syncing
  • Hit continue a few times, until a new conduit is installed.
  • Open Hot Sync Manager
  • HotSync -> Conduit Settings
  • Select “iSync Conduit” from the list, and press the “Conduit Settings” button
  • Select “Enable iSync for this device
  • Sync in iSync
  • Hit the HotSync button on the Treo

For bonus points, you can enable bluetooth-pda-sync in bluetooth preferences on your mac, configure it to work as RS-232 instead of a modem, enable that method in the conduit manager, and sync via bluetooth, instead of with your docking cable. Hope that helps!