• Download PHP tidy extension for Mac OS X

    by  • January 24, 2012 • code, download, hack, php, programming • 10 Comments

    Update: You can download the file I’ve hosted and it may work for you, but I’ve come to realize that it’s better to compile the package hosted here http://php-osx.liip.ch/

    You will need to download and install Command Line Tools for OS X, and then setup proper symlinks after compiling PHP. Be assured that you will have almost all the php extensions, you will possibly need.

    Yeah, I bought a Macbook Air 🙂

    I cannot deny that it’s an awesome device and all that, but I’m still getting used to a new OS. The major work’s rediscovering the right tools and, of course, learning OS X’s keyboard shortcuts. Thankfully, it seems like a nice OS and all the work seems worth it.


    Friggin' spinning wheel

    by http://www.flickr.com/photos/mind-hacker/2726423319/lightbox/

    That said, I now have a technology startup and cannot afford to just keep on ‘learning’. And that’s why small problems become big issues. All I needed was PHP-tidy to get on with life. Little did I know that it’d take up half of my day. So I’m putting it up here for people to download.

    As most people, I got MAMP to avoid unnecessary complications and get on with “the code that matters to me”. MAMP is pre-packaged Apache-MySQL-PHP stack for Mac. My beef with the project is that they seem to be focusing on things that don’t really matter a lot to the target audience, like shiny-gui interface to configure document root, specify ports etc.. However, they seem to ignore few major bugs which seem to date around 2009.

    1. They do not package tidy extension, even though there have been requests in the forum.
    2. Their “pear.conf” configuration file’s broken, due to which neither pear nor pecl binary works, so tidy installation using pecl didn’t work either. The fix is a simple edit to the php_dir param though.
    3. Sadly, pecl still fails due to some issue with phpize.
    4. One solution is to compile PHP with tidy. However, there apparently is (or was) some bug with tidy, so I decided to avoid it and look around a little more.
    5. Then, I found this post that recommends using pre-compiled php-tidy binary that comes bundled along with Zend Studio IDE. I decided to check it out, and thankfully, it worked.

    Sigh! Such a crazy way to solve a simple problem.

    Anyways, since tidy is an open source project, I figured it may not be illegal to put the binary up for download. (Zend Studio is NOT free.)

    You may download php tidy for OS X (tested on Lion)  from my public Dropbox folder.

    10 Responses to Download PHP tidy extension for Mac OS X

    1. February 21, 2012 at 9:59 PM

      Is Mac OS difficult to use especially for web development ???? 

      • February 22, 2012 at 12:02 AM

        Not really! It’s pretty awesome actually. You have the goodness of *nix tools, and usability of Apple.
        A few hiccups here and there are pretty common to every platform.

    2. June 11, 2012 at 9:19 PM

      Thank you so very much for posting a direct download link to Tidy! I was looking FOREVER. 

      I’m curious though as to why I can’t seem to get it to work?
      I’ve copied the file over to the /Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626 folder
      I’ve added “extension=tidy.so” to php.ini

      This resulted in “PHP Warning:  PHP Startup: Unable to load dynamic library ‘/Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/tidy.so’ – dlopen(/Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/tidy.so, 9): no suitable image found.  Did find: /Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/tidy.so: mach-o, but wrong architecture in Unknown on line 0”

      I’ve search a little to find it might be an issue with a non-universal binary, which I then went on to find means that I need a version made exactly for my PHP version OR that it’s a matter of me using a ‘Mach-O bundle i386’ instead of ‘Mach-O 64-bit bundle x86_64.’ I can’t seem to discern which it is though, or how to correct it either, seeing as you’re pretty much the only person that has a Tidy.so file on hand that isn’t RPM’d…
      Might you be so kind as to lend your thoughts? 

      • June 17, 2012 at 10:35 AM

        Hi Chris,
        Sincere apologies for the delay in response. I’ve been on the road for over a week now, and may continue so for coming week. Hence the delay.

        From what I can see, I get this error in my logs as well. I needed to get tidy working for PHP-CLI, which works for me. Now that you mention, I tried in my web scripts, and apparently tidy doesn’t work for them.

        My understanding is that MAMP separates php-module directories for CLI and Apache mod.

        I may not be able to look at this for another month or so (am shifting cities). Let me know if you come across a solution or pointer. I’ll try to have a look at it as well if I can.

    3. October 11, 2012 at 4:16 AM

      Thank you for this writeup. I’m a novice coder, and I have a question — where do I put the tidy.so file before I edit php.ini to reflect the presence of the library?

    4. vgs
      November 16, 2013 at 12:24 AM

      saved my day

    5. Pingback: PHP tidy extension for Mac | code-line

    6. July 30, 2014 at 7:52 PM

      You are a true lifesaver. I must have spent half a morning on trying to resolve this issue.

      • August 6, 2014 at 4:31 AM

        Glad to be of help!
        I hope you preferred the compilation route though.

    Leave a Reply

    Your email address will not be published. Required fields are marked *