Home » Php » Install MongoDB driver for PHP to XAMPP on a PowerPC Mac

Install MongoDB driver for PHP to XAMPP on a PowerPC Mac

Posted by: admin July 12, 2020 Leave a comment

Questions:

I know you cannot install the MongoDB server on a PowerPC Mac, but I can’t find any instructions on installing JUST the PHP driver to XAMPP.

Does anyone know if this is possible. If so, how do you do it? I’ve done extensive searching and can’t find an answer to this.

How to&Answers:

I dusted off a G4 Powerbook with OS X 10.5.8 to test. Turns out that the current precompiled version of mongo.so for PHP 5.3 on github doesn’t support PowerPC (the PHP 5.2 build appears to).

I downloaded the PHP 5.3.1 source to match XAMPP 1.7.3 and compiled my own mongo.so (1.2.12).

I did some minimal testing with XAMPP 1.7.3 on PowerPC to confirm this appears to work. Essentially, I just pasted the example from the MongoDB PHP Driver Tutorial, and inserted some documents into MongoDB 2.0.6 running on another computer.

Note this is an unofficial & unsupported mongo.so build, the same as what you should get building successfully from source with pecl install mongo. As a bonus, this is a much newer driver version than the precompiled OS X ones currently on github.

As a warning: I’m not sure about limitations or quirks of using this on PowerPC. Most of the OS X world has moved on to Intel architecture now.

So, instructions to use:

  1. Download and install XAMPP Mac OS X 1.7.3 universal binary.

  2. Download mongo-ppc-1.2.12.so from my github: mongodb-php-driver/downloads

  3. Rename that to mongo.so and copy into /Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626/

  4. Edit XAMPP/etc/php.ini and add a last line with:

    extension=mongo.so
    
  5. Check via phpinfo() that the mongo extension is available. Make sure you stop/start Apache if it was already running when you added the extension.