Search code examples
phposx-lionxhp

XHP fails with random Segmentation Fault 11 on OSX


I'm trying to install XHP on my OSX Lion and I'm getting random segmentation faults. The same program sometimes fails and sometimes runs. Even a program that imports init.php only.

<?php
include 'xhp/php-lib/init.php';
$href = 'http://www.facebook.com';
echo <a href={$href}>Facebook</a>;

Sometimes runs, sometimes fails with

Segmentation fault: 11

Solution

  • There's two gotchas here, XHP doesn't work with the pre-installed PHP and cannot be compiled with the latest XCode 5 because it's missing gcc.

    Homebrew to the rescue!

    brew tap brew tap josegonzalez/php
    brew install php55
    brew tap homebrew/dupes
    brew install apple-gcc42 
    brew install -cc=gcc-4.2 php55-xhp