Building PHP in Mac OS 10.5.3

June 8th, 2008 No Comments »

Just like every other Mac user out there, I installed 10.5.3 when it dropped last week. And, like so many times before this, the os x update broke my local build of PHP. This time, after rebuilding PHP & Apache, I was still unable to start apache, being told that libphp5.so was the wrong architecture.

This time apparently php was building as i386, but httpd was running as x86_64 (I’ve got a SR MacBook pro as my build environment, your mileage may vary.) So, instead of figuring out how to cajole php into building as x86_64, I fell back on my friend lipo to make sure httpd was running i386. Here’s what I did:

sudo apachectl stop
cd /usr/sbin
sudo mv httpd httpd_old
sudo lipo -thin i386 httpd_old -output httpd
sudo rm -f httpd_old
sudo apachectl start

This looks like it solved all of my problems. I might keep this in mind for when 10.5.4 drops, to make my life a good bit easier.

In the mean time, if you can tell me how to convince php to build x86_64, I won’t mind. ./configure detects the following about my system:

checking host system type... i686-apple-darwin9.3.0
checking target system type... i686-apple-darwin9.3.0

Maybe i’m destined to run as i386, which I don’t mind, so long as it runs.

Cheers!

Using a Sony Eye-Toy HD with Leopard

March 28th, 2008 No Comments »

Today, I decided I wanted to get my PS3’s EyeToy working with my macbook.  I like the idea of timelapse video, but hate the idea of pointing my laptop at something long enough to get a good video.  I plugged the camera in but had no luck first off.  System Profiler saw the camera, but I couldn’t get it to show up anywhere useful (namely, iStopMotion.)  A few google searches led me to Macam . The build I downloaded was from March of 07, so I wasn’t sure it would work.  It didn’t.

Another google search took me to Cristiano Betta’s blog, where he apparently had no trouble getting a PS2 Eyetoy to work with leopard.  I knew I was missing something, so I went back to the macam download page,  and looked for source.  The latest CVS build worked just fine, however.

That did it. It works.  I wish I could be more descriptive, but that’s all the info I have!

iPhone SDK makes building PHP tricky

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

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

April 29th, 2007 6 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.