1

I deleted my system PHP on OS X Lion by installing a fresh copy of PHP 5.4. I can't seem to restore it with Time Machine. What do I do next? When I type which php I still get /usr/bin/php.

But when I type php -v I get:

error 2992 segmentation fault

Sometimes the #2992 changes. Now when I try to view any pages with PHP I see the source code instead of the page.

slhck
  • 235,242
pixel 67
  • 133

1 Answers1

1

If you really managed to not only delete /usr/bin/php (which could be easily restored from a backup or another Mac), then your only easy option is to reinstall OS X. Doing so, it will leave your user files in place (i.e. the one in /Users) but it will overwrite all system components, including the packaged versions of PHP. Upgrading OS X is also possible in this case – it will have the same effect.

You can reinstall OS X Lion or Mountain Lion by booting into Recovery. Just hold CmdR while startup and reinstall OS X. Make sure you take a backup of your entire system before though.

In the future, if you want to work with other PHP versions, consider using MAMP, a standalone package that comes bundled with various PHP versions to choose from (including 5.3 and 5.4), which does not interfere with your system binaries and frameworks.

slhck
  • 235,242