I installed php on my Mac using Macports. I guess, at this early stage in my Mac experience, that it’s the equivalent of APT on Debian-based systems. It installed without a hitch, and php was up and running.
But when I began installing a web app that required mcrypt, I noticed some problems. I used the ‘port’ command again to install the mcrypt package. Once again, no errors reported. But the web app (Magento) continued to complain that the “PHP extension ‘mcrypt’ must be loaded.”
Running ‘php -m’ from the shell told me that the package had indeed been installed. So why was the web app seeing mycrypt not loaded?
How to make dumb mistakes
Here’s the long-story-short of it…set up a phpinfo() test page and make sure you have a value for the Loaded Configuration File other than ‘none.’
Apparently, when you install php via the ‘ports’ command, the php.ini file is not copied over automatically. I assume that’s by design, so you can go through the provided php.ini.default and edit before using it. The crazy thing is that I had already opened the default file to add the extension. Hey…new OS, some things are different. Gimme a break…
cd /private/etc/ sudo cp php.ini.default php.ini sudo vi php.ini
In the Dynamic Extension section, add:
And finally, restart apache…
sudo apachectl -k graceful
This is one of those moments where you feel like you’ve torn the whole ceiling fan apart, trying to figure out why it’s not working…when all you needed to do was reset the breaker switch. I hope there aren’t many more of those.