Ok, I'm running MAMP 1.9.5, which includes PHP 5.3.5, on my MacBook Pro.
The "intl" extension isn't included/activated and I've tried a lot of different ways to install it ["./pecl install intl" doesn't seem to do it], but can't make it work.
I've also "googled my ass of" but can't find any hints.
Anyone of you that know how to do it? Or, alternatively, have and advice on how to install my own MySQL+Apache+PHP [and include "intl"]?
I'm trying to do this to be able to run Symfony2. So if you have any advice on how to install MySQL+Apache+PHP+Symfony2 on Mac, thats also welcome :]
As a Symfony developer you run into translations sooner or later. This is a very powerful component of the framework. But requires some additional configuration of your MAMP environment before you can start using it. I’ll explain to you in short how. First, grab the
ICU libraries and build them:$ curl -O //download.icu-project.org/files/icu4c/4.8.1.1/icu4c-4_8_1_1-src.tgz
$ tar xzvf icu4c-4_8_1_1-src.tgz
$ cd icu/source
$ ./runConfigureICU MacOSX
$ make && sudo make install
Now you have to install the PHP INTL extension with PECL. Make sure you’ve added the MAMP PHP binary directory to your $PATH environment variable. Then run the following command to install the INTL extension:
The last thing to do is add the extension=intl.so line to the php.ini file, so do that. Restart your shell and MAMP environment so they reflect the changes to the ini file.
FAQ > PHP
Install a PHP Extension using PECL
MAMP PRO provides you with all the requirements to install PHP Extensions using PECL. This guide shows you how to install a PHP Extension via PECL using the mongodb extension and PHP 8.0.2 as an example.
- Open MAMP PRO and click on the “PHP” entry in the sidebar in the “Languages” area.
- Activate the “Activate command line shortcuts for the selected PHP version, pear & pecl” checkbox.
- Restart your servers. A PECL alias now exists in your “~/.profile”, “.profile” and “.zprofile” file.
- Open the Terminal app [/Applications/Utilities]. Tip: If you have already opened the terminal app, then you must close and reopen it for the changes to the configuration files “~/.profile”, “.profile” and “.zprofile” to take effect.
- Change to the
“/Applications/MAMP/bin/php/php8.0.2/bin” directory.
cd /Applications/MAMP/bin/php/php8.0.2/bin
- Enter the following command and confirm your entry with Enter.
If you are shown the message “Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF
environment variable. Then, rerun this script.”, then you need to perform the following steps:Enter the following commands in the terminal and confirm each command with Enter. The asterisk at the command
autoconf-*
stands for the corresponding version number [for example “2.71”].curl -OL //ftpmirror.gnu.org/autoconf/autoconf-latest.tar.gz tar xzf autoconf-latest.tar.gz cd autoconf-* ./configure --prefix=/usr/local make sudo make install
Use the following commands in the Terminal to switch back up one directory level and restart the PHP extension installation process:
cd .. pecl install mongodb
Your PHP Extension should now build and you should see the following result:
Build process completed successfully Installing '/Applications/MAMP/bin/php/php8.0.2/lib/php/extensions/no-debug-non-zts-20200930/mongodb.so' install ok: channel://pecl.php.net/mongodb-1.9.1 configuration option "php_ini" is not set to php.ini location You should add "extension=mongodb.so" to php.ini
- A “mongodb.so” extension should now be in your “/Applications/MAMP/bin/php/php8.0.2/lib/php/extension/no-debug-non-zts-x” folder.
- Switch back to MAMP PRO and select “8.0.2” from the “File > Open Template > PHP [php.ini]” menu.
- The template for the php.ini file of PHP version 8.0.2 is opened. Insert the following line into it:
- Save and close the template.
- Restart your servers and verify the extension has been loaded by checking phpInfo. Please make sure that the host you use to call the phpInfo output is also set to the corresponding PHP version for which you have installed the PHP extension - in our case in this example this is PHP 8.0.2.