I was using XAMPP and decided to uninstall it and use MacOS' in-built apache and php modules. But while uninstalling XAMPP I deleted /usr/bin/php files and other PHP-CLI files accidentally. And I decided to install newest version of PHP (5.5.12) instead of rebuilding current version (5.4.24). Downloaded it and unzip. After this executed this command as mentioned at this guide.

./configure '--with-apxs2=/usr/sbin/apxs' '--enable-cli' '--with-config-file-path=/etc' '--with-zlib=/usr' '--enable-bcmath' '--with-bz2=/usr' '--enable-calendar' '--disable-cgi' '--with-curl=/usr' '--enable-dba' '--enable-ndbm=/usr' '--enable-exif' '--enable-fpm' '--enable-ftp' '--with-gd' '--enable-gd-native-ttf' '--enable-mbregex' '--with-mysql=mysqlnd' '--with-mysqli=mysqlnd' '--with-pear' '--with-pdo-mysql=mysqlnd' '--with-mysql-sock=/var/mysql/mysql.sock' '--with-tidy' '--enable-wddx' '--with-xmlrpc' '--enable-zip'
make install

When i check phpinfo() , it's still version 5.4.24 . This line from my httpd.conf

LoadModule php5_module libexec/apache2/libphp5.so

/usr/libexec/apache2/libphp5.so coming from old version and i couldn't ind libphp5.so for new version. There is no libphp5.so file inside modules dir.

How can i use new PHP build with Apache ?


Results of php -v command .

PHP 5.5.12 (cli) (built: May 27 2014 05:17:21) Copyright (c) 1997-2014 The PHP GroupZend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies

As an alternative to using Mac's native PHP install I reccommend homebrew. Unlike XAMPP you don't have to work within a restrictive shell, so you can keep PHP and other modules (PHPMyAdmin, Apache, etc.) updated to the latest versions.

Since you aren't messing around with Mac's flawed delicate system folders, you won't have to worry about dependency hell, either, or accidentally erasing files and folders. Homebrew won't let you upgrade anything without upgrading its dependents, and everything is contained within its own repositories, called cellars.


Just deleted libphp5.so and tried reinstall, now it seems working. I'm not sure why install command is not overwriting.


I would avoid the hassle of trying to build a new version of Apache that matches Apple's supplied version. The version you build will likely not be exactly the same as Apple's supplied version. Apple typically makes minor adjustments to open-source software shipped with MacOS, which they publish, eventually, on http://opensource.apple.com/. So building it yourself to match Apple's version is not impossible, just annoying.

Also, generally speaking, you should leave the POSIX stuff that Apple supplies alone. They tend to overwrite/change things with system updates. (This is why I'm a proponent of a separate development stack/environment via MacPorts, a VM, etc.)

I would instead recommend try to restore the version you deleted.There are a few routes to get there:

  • Restore the missing/different files from your recent system backup (Time Machine, etc.).
  • Extract the original files from the latest OS install packages using a tool like Pacifist. Get the latest OS from the App Store. Or ask a friend with the same OS version (that hasn't modified their files, obviously).
  • Reinstall the OS to return the modified files to their original state. This is the more nuclear of the options, obviously, and has its own risks (messing other stuff up), though Apple is usually pretty good about making it safe-ish.

With the first two options, you would extract the original files/dirs that you deleted to a new dir and then diff it against your current system. Then cp the files/dirs back into place as root via sudo. (Hint: Use your history to figure out what you rm'd.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.