mcrypt is a file encryption method using secure techniques to exchange data. It is required for some web apps for example Magento, the shopping cart software or a php framework like Laravel. This tutorial has been tested in OSX 10.10 Yosemite.
This guide is really for users with the version of PHP that shipped with OSX Yosemite which is version 5.5.14. Other downloadable AMP stacks already have mcrypt baked in.
- How to upgrade to PHP 7.3 on a Mac with Homebrew. Scout APM helps PHP developers pinpoint N+1 queries, memory leaks & more so you can troubleshoot fast & get back to coding faster.
- I was setting up a new Mac and ran into this problem again, where a default PHP installation with brew is missing a few important extensions. In this case, I wanted to get the imagick extension loaded. This guide assumes you have Homebrew installed and you’ve installed PHP with brew install php. Install Image Magick dependency.
- Many website owners use PHP with their websites to expand the capabilities of the sites. Before you can enable PHP on a Mac, you first have to enable Apache. Both PHP and Apache are free open source software programs and both come installed on all Macs. PHP is server-side software, and Apache is the most widely used web server software.
$ sudo apt-get install php7.0 php7.0-dev php-pear phpunit. This is the must have extension for PHP development and goes a long way to making Visual Studio Code feel more like a traditional IDE. PHP Intelephense will massively improve your efficiency by offering intelligent code completion, workspace wide definition support, parameter help for function calls and a whole lot more.
Command Line Tools
First up you will need the OSX 10.10 version of Command Line Tools which you can download via the Apple available updates in the App store.
Run in the Terminal
Getting it on in OS X Yosemite 10.10
This tutorial works mostly in the Terminal, launch it from /Applications/Utilities, change directory (cd) to the home account and make a directory that you will work in, call it mcrypt
Get libmcrypt 2.5.8 from Sourceforge, this is direct download link.
Get the php code in a tar.gz or .bz2 format- (version 5.5.14 is the one that currently ships with OSX 10.10)
How to make seagate 500gb portable compatible for mac pro. How do i make my external portable hard disc 500gb Seagate FreeAgent Go (For windows only) compatible for both mac and pc. Any other option thn formatting on FAT32 (Becs it got file size limitation of 4 GB) By default will it b compatible for both mac and pc machines? I m using intel core 2 duo Macbook pro 2.53. Seagate has evaluated current product lines to determine which ones will be supported in macOS 10.15. Older drives that are not listed here may work, but have not been tested. Notes: This is a general compatibility article and not a troubleshooting article. If the drive is not being detected by the computer, click here to see this article.
Move both of these files that you downloaded into your working directory – mcrypt in this instance, and go back to Terminal
Expand both files via the command line or just double click them in the Finder:
Remove the compressed archives
Any errors on the command line including C++ and g++ mostly are due to the command line tools missing.
Configuring libmcrypt
With the libmcrypt configured and libraries now installed, time for to make the mcrypt extension.
Install Autoconf
Install autoconf – some more Terminal heavy lifting:
Compile mcrypt php Extension
Output should be similar to:
Configuring for:
PHP Api Version: 20121113
Zend Module Api No: 20121212
Zend Extension Api No: 220121212
Configuring for:
PHP Api Version: 20121113
Zend Module Api No: 20121212
Zend Extension Api No: 220121212
The result of this should be similar to:
Installing shared extensions: /usr/lib/php/extensions/no-debug-non-zts-20121212/
Enabling mcrypt.so php Extension
Open /etc/php.ini and add the line below at the end
If there is no php.ini file, then you need to make one from php.ini.default in the same location like so:
And allow write capability
Then add the line as above in your favourite text editor:
or
and add in the line:
Restart Apache
That’s it, create a php page with the function phpinfo(); to see if it loaded correctly.
If it didn’t load you may need to declare the extensions directory in /etc/php.ini
Hopefully it wasn’t too much of a nightmare…
tales-from-the-mcrypt-yosemite-osx-php
Recommend switching to Docker
I finally switched to using Docker for local development on macOS. While the following tutorial works for macOS Catalina, it has limitations. I recommend following my latest tutorial on installing Apache, MySQL, and PHP on macOS using Docker.
Note: This post assumes you followed installing Apache, PHP, and MySQL on Mac OS X Mojave and have since upgraded to macOS Catalina. If you did not follow the original post, you should follow installing Apache, PHP, and MySQL on macOS Catalina.
When Mac OS X upgrades it overwrites previous configuration files. However, before doing so it will make backups. For Catalina the original versions may have a suffix of
mojave
or be copied to a backup folder on the Desktop. Most of the time, configuring your system after updating Mac OS X is simply a matter of comparing the new and old configurations.This post will look at the differences in Apache, PHP, and MySQL between Mac OS X Mojave and macOS Catalina.
Updating Apache
Mac OS X Mojave and macOS Catalina both come with Apache pre-installed. As noted above, your Apache configuration file is overwritten me when you upgrade to macOS Catalina.
There were a few differences in the configuration files. However, since both Mojave and Catalina run Apache 2.4, you could simply backup the configuration file from Catalina and overwrite it with your Mojave version.
However, I encourage you to stay up-to-date. As such, you should take the time to update Catalina's Apache configuration. First, create a backup and compare the two configuration files for differences.
Now edit the Apache configuration. Feel free to use a different editor if you are not familiar with vi.
Uncomment the following line (remove
#
):In addition, uncomment or add any lines you noticed from the
diff
above that may be needed. For example, I uncommented the following lines:Finally, I cleaned up some of the backups that were created during the macOS Catalina upgrade. This will help avoid confusion in the future.
Note: These files were not changed between versions. However, if you changed them, you should compare the files before running the commands.
Php Extension Tutorial
Restart Apache:
Updating PHP
Firefox Extensions For Mac
Mac OS X Mojave came with PHP version 7.1 pre-installed. This PHP version has reached its end of life. macOS Catalina comes with PHP 7.3 pre-installed. If you added any extensions to PHP you will need to recompile them.
Also, if you changed the core PHP INI file it will have been overwritten when upgrading to macOS Catalina. You can compare the two files by running the following command:
Note: Your original file may note be named something else. You can see which PHP core files exist by running
ls /etc/php.ini*
. Pmd file opener.I would encourage you not to change the PHP INI file directly. Instead, you should overwrite PHP configurations in a custom PHP INI file. This will prevent Mac OS X upgrades from overwriting your PHP configuration in the future. To determine the right path to add your custom PHP INI, run the following command:
Note: It appears Catalina does not include the PHP Zip extension. This is a popular extension used by many packages. This was one of the reasons I switched to using Docker.
Updating MySQL
MySQL is not pre-installed with Mac OS X. It is something you downloaded when following the original post. As such, the macOS Catalina upgrade should not have changed your MySQL configuration.
Find this interesting? Let's continue the conversation on Twitter.