How can I install Intl on my XAMPP server on OS X?
I tried modifying my XAMPP>etc>php.ini and uncommenting the line:
;extension=php_intl.dll
and restarting Apache, but it didn't work.
Installing "intl" extension on OSX.
Normally, the PHP is automatically installed on OSX.
So, if you would like to use the XAMPP, or whatever apache server, you must change the path point to XAMPP. You can check the path by using:
$ which php
You should get
/Applications/XAMPP/xamppfiles/bin/php
if not, you will get
/usr/bin/php.
This is OSX' php. So, you have to change it by using:
$ PATH="/Applications/XAMPP/xamppfiles/bin:${PATH}"
Now, it's time to install intl. Firstly, you need to install icu4c
$ brew install icu4c
It takes a couple of times and returns its path to you, should look something like this:
/usr/local/Cellar/icu4c/x.x.x
Next, let's install intl by using pecl
$ sudo pecl update-channels
$ sudo pecl install intl
It will prompt you to put the icu4c path.
After finish installing icu4c, put the following statement to php.ini
extension=intl.so
Restart apache. and check whether it's neatly installed.
$ php -m | grep intl
should return 'intl'
That's it!
On OSX if you have homebrew available and have PHP7:
$ brew install php70-intl // For PHP7.0
$ brew install php71-intl // For PHP7.1
For PHP5.5:
$ brew install php55-intl
Re-open your terminal window to ensure it works right in your session. To see if it loaded via your CLI interpreter:
$ php -m | grep intl
Or:
$ php -i "(command-line 'phpinfo()')" | grep intl
Source: https://daveismyname.blog/blog/install-php-intl-on-mac-using-homebrew
I failed on my XAMPP on Mac with:
$ brew install icu4c
, after which I've got message:
intl ICU version installed on your system is outdated (4.8.1.1) and does not match the ICU data bundled with Symfony (57.1)
I solved my problem by running command to download, unpack, compile and install ICU of required version (you can choose another version here http://site.icu-project.org/download if needed, file should ends with ...src.tgz):
$ curl -sS -o /tmp/icu.tar.gz -L http://download.icu-project.org/files/icu4c/57.1/icu4c-57_1-src.tgz && tar -zxf /tmp/icu.tar.gz -C /tmp && cd /tmp/icu/source && ./configure --prefix=/usr/local && make && sudo make install
than run:
$ sudo pecl install intl
and specified where ICU libraries and headers can be found [DEFAULT] :
/usr/local
then edited 'php.ini' with extension=intl.so and reboot apache.
Checked result with:
<?php
if (extension_loaded('intl')) {
echo "PHP: " . PHP_VERSION . "<br>\n";
echo "ICU: " . INTL_ICU_VERSION . "<br>\n";
} else {
die('OOPS! The intl extension is not enabled!');
}
Related
new to linux, I installed php on debian9 with the following commands...
sudo apt-get update
sudo apt-get upgrade
wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
echo "deb https://packages.sury.org/php/ stretch main" | sudo tee /etc/apt/sources.list.d/php.list
apt-get update
apt-get install ca-certificates apt-transport-https
apt-get install php7.2 php7.2-cli php7.2-common php7.2-opcache php7.2-curl php7.2-mbstring php7.2-mysql php7.2-zip php7.2-xml
Later I needed XDebug I installed via the following
sudo apt install php-xdebug
phpinfo was displaying xdebug present
and I went configuring /etc/php/7.0/mods-available/xdebug.ini with
I never got remote debugging to work neither from vscode or phpstorm. However, on Windows7 I managed to have more success and fixed my php deprecated code from 5.x to 7.x
Now I needed on curl and mbstring extensions on the linux side.
I enabled those extensions in /etc/php/7.0/apache2/php.ini
extension_dir = "./"
extension=curl
extension=mbstring
and I ALSO run the the following according to a post.
sudo apt-get install php-mbstring # Debian, Ubuntu
I think that's when XDebug disappeared from phpinfo
After a couple of sudo update/upgrade
[![enter image description here][5]][5]
now php -i | grep "php.ini" shows php switched from 7.2 to 7.4 ???
Configuration File (php.ini) Path => /etc/php/7.4/cli
Loaded Configuration File => /etc/php/7.4/cli/php.ini
yet the 1st line of phpinfo still says 7.0
PHP Version 7.0.33-25+0~20200225.32+debian9~1.gbpa11893
, I am totally confused. php -m lists curl, mbstring, and xdebug.
FileZilla shows me all these folders under php and I have, like 10, php.ini both under cli/ and apache2/ a real frustration as to what to edit???
Summary: simple php runs (eg. echo, phpinfo(), ... ), but my script calls curl and mb_convert_encoding() which I think must be failing.
I have created a project in laravel but when I try to run it with php artisan serve I get this error: Mcrypt PHP extension required. I need some help
enable mcrypt extension on php.ini file
Go to your php.ini file ebanle mycrypt extension. Check if mycrypt is present in your extension directory.
if not found then download mycrpyt from https://pecl.php.net/ (Windows)
on Linux
$ sudo apt install php-dev libmcrypt-dev php-pear
$ sudo pecl channel-update pecl.php.net
$ sudo pecl install mcrypt-1.0.1
I'm following this link to install this PHP extension but I'm stuck in the middle.
When I try to run this command pecl install intl I get this message:
Specify where ICU libraries and headers can be found [DEFAULT] :
And I don't know where the ICU libraries are located.
If I press Enter I get this error:
configure: error: Unable to detect ICU prefix or no failed. Please verify ICU install prefix and make sure icu-config works.
ERROR: `/private/tmp/pear/install/intl/configure --with-php-config=/usr/bin/php-config --with-icu-dir=DEFAULT' failed
How can I locate the correct path of ICU libraries ?
I'm using High Sierra and MAMP with PHP version 7.1
ICU stands for ICU - International Components for Unicode
Install it with brew
brew update
brew search icu # returns 'icu4c'
brew install icu4c
OR
Install it with pecl
sudo pecl update-channels
sudo pecl install intl
installing intl package on osx
EDIT: after a better look in php#5.6 it seems that it is already compiled with 'intl'
php -i | grep intl
... '--enable-intl' ...
So my answer is normally useless for php#5.6 (but can be useful in some cases I guess)
I'm facing the same issue today trying to switch from php56 to php#5.6.
After lot of digging, here is the workaround.
Make sure to have a clean install of php#5.6 and to have it at the current version
php -v
PHP 5.6.35 (cli) (built: Mar 31 2018 20:21:31)
Make also sure to have icu4c
brew update
brew install icu4c
Next, we will install and compile intl manually
cd /usr/local/src/
wget https://pecl.php.net/get/intl-3.0.0.tg
tar zxf intl-3.0.0.tgz
cd intl-3.0.0/
phpize --clean
phpize
./configure
And here is the trick, edit Makefile
vi Makefile
Modify the line CXXFLAGS as follow
CXXFLAGS = -g -O2 -std=c++11
AND the line CPPFLAGS as follow
CPPFLAGS = -DHAVE_CONFIG_H -DU_USING_ICU_NAMESPACE=1
Next, save, and compile
make
make install
And voila
Installing shared extensions: /usr/local/Cellar/php#5.6/5.6.35/pecl/20131226/
Don't forget to add extension="intl.so" to your php.ini
vi /usr/local/etc/php/5.6/php.ini
(and to restart apache)
Sources:
https://gist.github.com/redefinelab/4188331
https://github.com/Homebrew/homebrew-php/commit/d7a3e0b6487780e0d983b35b8f42aad0fd01bf78
download the version of PHP you use in XAMPP from php.net. I am using 7.3. This version worked for me: php-7.3,
I’m guessing if you follow the steps it might work for 7.0 or 7.2 as well.
Extract the tar.gz file using (I extracted it inside ~/Downloads/ folder )
tar -xzvf php-7.1.31.tar.gz
cd into the extracted folder
cd php-7.1.31
change to subfolder ext/intl
cd ext/intl/
Run these commands to build the extension
/Applications/XAMPP/bin/phpize
./configure --enable-intl --with-php-config=/Applications/XAMPP/bin/php-config --with-icu-dir=/Applications/XAMPP/xamppfiles/
make
sudo make install
you can now delete all files you downloaded and also the extracted folders.
Open /Applications/XAMPP/xamppfiles/etc/php.ini , and add extension=intl.so
That’s it! Restart your Apache using XAMPP GUI and it should work. You have to run these commands each time you install a new version of XAMPP.
How can I install or enable the PHP Pecl Intl extension in my PHP environment?
I've got a stock PHP configuration that came bundled with Mac OS X Snow Leopard.
Installing libicu from source and than $pecl install intl results in the following error:
/private/tmp/pear/temp/intl/collator/collator_class.c:92: error: duplicate 'static'
/private/tmp/pear/temp/intl/collator/collator_class.c:96: error: duplicate 'static'
/private/tmp/pear/temp/intl/collator/collator_class.c:101: error: duplicate 'static'
/private/tmp/pear/temp/intl/collator/collator_class.c:107: error: duplicate 'static'
make: *** [collator/collator_class.lo] Error 1
ERROR: `make' failed
Any help is really appreciated!
Here's what I did in OSX 10.9 Mavericks:
Install some dependencies with Homebrew:
$ brew install autoconf
$ brew install icu4s
$ brew link --force icu4s
Install and verify Pear/PECL (instructions from http://techtastico.com/post/como-instalar-pear-y-pecl-en-os-x-mavericks/):
$ curl -O http://pear.php.net/go-pear.phar
$ sudo php -d detect_unicode=0 go-pear.phar
[ Select 1 and enter /usr/local/pear ]
[ Select 4 and enter /usr/local/bin ]
[ Press return ]
$ pear version
Install PECL intl:
$ sudo pecl install intl
$ sudo cp /private/etc/php.ini{.default,}
$ sudo chmod 644 /private/etc/php.ini
$ echo extension=intl.so >> /private/etc/php.ini
For the time being I've recompiled my PHP installation. I've created a gist with my configure string which I'll keep updating.
update
liip have created a nice binary that circumvents all these troubles. It is based on the original entropy.ch binary, I recomend using it for PHP development on a Mac.
Better late than never, but if you are like me and installed PHP directly from php.net (instead of using something like Homebrew or Port, then you can simply follow the following link to install Pear and PECL:
http://akrabat.com/php/setting-up-php-mysql-on-os-x-10-7-lion/
It worked fine for me.
on my Mac I installed a php version with pear using brew. This solved all my issues as the default osX php didn't work for me after trying many different ways. You can try without installing php/pear if you have already done so.
You need Homebrew http://brew.sh/
Install PHP
brew install php56 --with-pear or brew install php56 pear
Install autoconf
brew install autoconf
Install icu4c
brew install icu4c
Creates the symlinks
brew link --force icu4c
Install intl with (pearl) pecl
sudo pecl install intl
Homebrew should enable intl and symlink all the right versions to their respective commands.
I am trying to install this
http://fr2.php.net/manual/en/book.ssh2.php
on a Centos 5 (a fork of RHEL 5).
I installed libssh2 (yum install libssh2) which is located in /usr/lib, and when I install SSH2 extension (via pecl install -f ssh2) I get this message
checking for ssh2 files in default path... not found
configure: error: The required libssh2 library was not found. You can obtain that package from http://sourceforge.net/projects/libssh2/
ERROR: `/tmp/pear/download/ssh2-0.11.0/configure --with-ssh2=/usr' failed
If I set /usr/lib, I get the same message
ERROR: `/tmp/pear/download/ssh2-0.11.0/configure --with-ssh2=/usr/lib' failed
Where is the problem?
Installing libssh2 via tar.gz from http://sourceforge.net/projects/libssh2/ help a lot (--with-ssh2=/usr/local/include/).
But :
yum install libssh2-devel
...is a better idea.
$ sudo pecl channel-update pecl.php.net
$ sudo apt-get install libssh2-1-dev
$ sudo pecl install -a ssh2-0.12
$ echo 'extension=ssh2.so' | sudo tee /etc/php5/mods-available/ssh2.ini > /dev/null
$ sudo php5enmod ssh2
yum install libssh2-devel didn't work for me:
No package libssh2-devel available.
So I downloaded rpm package from rpmfind and installed with rpm -ivh
After that just added extension=ssh2.so to /etc/php.d/ssh2.ini
This is updated answer from #klay + modification from #avn from comment under working solution for PHP 7.x.
$ sudo pecl channel-update pecl.php.net
$ sudo apt-get install libssh2-1-dev
$ sudo pecl install -a ssh2-1.0
$ echo 'extension=ssh2.so' | sudo tee /etc/php/7.2/mods-available/ssh2.ini > /dev/null
$ sudo phpenmod ssh2
Regarding line:
echo 'extension=ssh2.so' | sudo tee /etc/php/7.2/mods-available/ssh2.ini > /dev/null
Make sure that path /etc/php/7.2/mods-available is valid and there is a match with your php version.
I'm running on Centos, none of these answer were the entire solution for me. I followed these instructions:
$ sudo yum install -y gcc php-devel php-pear libssh2 libssh2-devel
But php-devel would not install, complaining about conflicts. I searched yum to find what php devel packages I had available
$> yum search php|grep devel
...
php55u-devel.x86_64 : Files needed for building PHP extensions
php56u-devel.x86_64 : Files needed for building PHP extensions
php70u-devel.x86_64 : Files needed for building PHP extensions
...
So I ran
$> sudo yum install -y php56u-devel
And it installed cleanly. Then, continuing with the instructions, I ran
$ pecl install -f ssh2
And it compiled. Then I added the extension to php
$ touch /etc/php.d/ssh2.ini
$ echo extension=ssh2.so > /etc/php.d/ssh2.ini
And on my system, instead of
$ /etc/init.d/httpd restart
I had to do
$ sudo /bin/systemctl restart php-fpm.service
So that was all the steps to install. And finally to confirm:
$> php -m|grep ssh2
ssh2
I had this problem:
I'm on a Pair.com "Advanced" hosted account, so I'm a little limited on what I'm allowed to do. I don't think I can yum nor aptitude nor any of the other pre-compiled packages.
I've downloaded and compiled libssh2. During the pecl process, it asks where the library is located. It's in "~/usr/local/lib" and I've tried several variations, including fully qualified. But I kept getting the same error.
The error message doesn't spell out precisely which file it's looking for. libssh2.so is in that directory. I know the output is supposed to be ssh2.so. I wondered if there is supposed to be an ss2.something, or libssh.nothing?
I fixed it thus. In my case, after compiling libssh2 I downloaded the PEAR tarball. The trick was:
./configure --with-ssh2=<libssh2 location> --prefix=<libssh2 location>
Another trick is that, since Pair.com is running FreeBSD, I have to do a "cd ." after the ./configure command. Otherwise, make produces a "Permission denied" error. Apparently, this is necessary on all *nix BSD flavors.
The error:
checking for ssh2 files in default path... not found
configure: error: The required libssh2 library was not found.
...can be seen in the source code.
The logic in the code reveals that it will throw this error if it cannot find /include/libssh2.h in either /usr/local, /usr or in the path supplied by the optional --with-ssh2=[DIR] directive. In other words, without customising the directive, it needs to find one of the following:
/usr/local/include/libssh2.h
/usr/include/libssh2.h
If it passes this check, it then assumes it can find the libssh2 lib at /usr/local/lib or /usr/lib.
Hopefully the info above is enough to help someone debug their issue. My own case is fairly specific and unusual (macOS with Homebrew in a custom install path), but in case it helps anyone else, here's my horrifically hacky workaround. Works perfectly lol
In a nutshell I'm creating two temporary symlinks so that pecl can find ssh2 where it expects.
# First check that neither /usr/local/include nor /usr/local/lib exists
sudo ln -s /usr/local/CustomInstallPath/Homebrew/Cellar/libssh2/1.9.0_1/include /usr/local/include
sudo ln -s /usr/local/CustomInstallPath/Homebrew/Cellar/libssh2/1.9.0_1/lib /usr/local/lib
pecl install -a ssh2-1.3.1
sudo rm -rf /usr/local/include
sudo rm -rf /usr/local/lib