I tried to use idn_to_ascii() function with the pre installed PHP instance of Max OSX 10.9.4 (which is 5.4.24).
I read through lot of Stackoverflow questions and in the most of them they say: intl is precompiled since PHP 5.3 and you don't need an extension and it works out of the box.
But why are the intl functions not available in this PHP instance then? I just get a
Fatal error: Call to undefined function idn_to_ascii() in /path/test.php on line 3
Also I tried it with XAMPP 1.8.3-4 on OSX 10.9 with PHP 5.5.x and I also get
Fatal error: Call to undefined function idn_to_ascii() in /Applications/XAMPP/xamppfiles/htdocs/test.php on line 3
Is this a problem with OSX or are there problems with both instances of PHP?
intl is bundled with the PHP source code, but must be enabled using the --enable-intl compile-time option. This is apparently not the case for those two PHP installations. You can check using php -i | grep intl. You'll probably have to go with the PECL installation method. Alternatively I'd recommend maintaining your own flexible PHP installation with homebrew's homebrew-php tap.
The problem also occures on Debian 7.9 too and you can install php5-intl package with apt-get to solve it.
I had the same issue on my servers. Unlike the proposed solution here, I had PHP version 7. So I had to install the corresponding intl packages:
For PHP 7.1:
sudo apt-get install php7.1-intl
For PHP 7.0
sudo apt-get install php7.0-intl
Related
I'm trying to install PHP 7.2 thread-safe on a mac (Sierra 10.13).
I've tried:
with homebrew, using the --with-thread-safety option, but it's not recognized anymore
recompiling PHP with the --with-tsrm-pthreads option passed to ./configure, but failed
brew install php72 --with-thread-safety Warning: php: this formula has no --with-thread-safety option so it will be ignored!
Any suggestion?
In the end, I solved installing it through phpbrew.
Homebrew has started a migration of PHP related formulaes a while ago, so most of the parameters on most of the guides will not work anymore until someone will add support for them to the formulae.
Also, for most of the packages from now on Brew team recommends to use PECL.
You can try to build with flag --enable-maintainer-zts that should enable thread safety, it actually has worked out for me.
I changed my default apache server setup on my mac to be able of easily switching between php versions following this guide.
Now, when I return to my project which is based on the CMS TYPO3, I get the error, that "The PHP extension "apcu" must be installed and loaded in order to use the APCu backend.".
So I was following the tutorial (by the same author) to install and enable apcu.
I can sum up the installation process:
$ sphp 5.6
$ brew install autoconf
$ pecl channel-update pecl.php.net
$ pecl install apcu-4.0.11
This actually worked perfectly for php 5.6! But I wanted php 7.2 for my project. The tutorial instructs to do this:
$ sphp 7.2
$ pecl uninstall -r apcu
$ pecl install apcu
No errors here. But the CMS still claims no apcu! Searching for "apc" in phpinfo also returns in no results! Pecl added the extension="apcu.so" line in the loaded php 7.2 ini, so I don't understand what's wrong. Of course I restarted apache every time. Also no errors or warnings here.
Also after googling I have no idea what to do :/
You may try using an absolute path of the apcu.so in php.ini,
Like
extension="/usr/local/Cellar/php/7.3.2/pecl/20180731/apcu.so"
The path depends. Don't know why but this works for me anyway.
You may also need to check the following ini config entry for apcu:
apc.enabled=on
apc.enable_cli=on
Debian : 7.4
I have some difficulty to make ssh2 work with php5. i didn't find a solution on other topics and i search a LOT ! all has been well installed according to debian outputs but it still doesn't work.
This is what i'v done
Package installed :
- php5
- php5-dev
- libssh2-php
- libssh2-1-dev
I used PECL to install
pecl install -f ssh2
I just press enter for auto prefix.
And extension=ssh2.so to /etc/php5/apache2/php.ini
Restart more than one time apache2.
But the package ssh2 still not appear in output of php -m and says that ssh2_connect is undefined
I totally out of resources to make it works, so please can anybody helps me ?
Here some info provided by phpinfo() :
extension_dir /usr/local/lib/php/extensions/no-debug-non-zts-20100525/
extension version 0.12
libssh2 version 1.4.3
banner SSH-2.0-libssh2_1.4.3
If you need i can give more informations
I use phpseclib's libssh2-compatibility-layer to avoid having to install libssh2. You can use all the libssh2 functions without having it installed thanks to the use of phpseclib.
If you're writing your application from scratch maybe try just using phpseclib from the onset intsead of libssh2.
I have installed PHP(5.5.9) via Homebrew(0.9.5), and I can't seem to install any packages with pecl. For instance when I try to install APC with sudo pecl install apc I got the following string returned:
WARNING: php_bin /usr/local/Cellar/php55/5.5.9/bin/php appears to have a
suffix 55/5.5.9/bin/php, but config variable php_suffix does not match
If I just ignore the warning and proceed, at the end it fails with:
2 warnings and 6 errors generated.
make: *** [apc_compile.lo] Error 1
ERROR: `make' failed
I have make installed via homebrew as well as pecl.
APC is outdated, and has never been updated/released for PHP 5.5.
Since version 5.5, PHP comes with it's own opcache.
See: http://nl1.php.net/manual/en/book.opcache.php
I'm trying to install the PHP extension intl on my fresh install of OS X 10.6.6, using the PHP version that shipped with it (v5.3.3).
I know that the extension needs ICU so I installed it with homebrew. My installed version of ICU is 4.4.1 and is stored in /usr/local/Cellar/icu4c/4.4.1.
I tried two different ways to install the intl extension:
pecl install
pecl asked me for the ICU prefix, which is /usr/local/Cellar/icu4c/4.4.1. configure ran without problems, however make aborted with:
/private/var/tmp/apache_mod_php/apache_mod_php-53~1/Build/tmp/pear/temp/intl/collator/collator_class.c:107: error: duplicate ‘static’
make: * [collator/collator_class.lo] Error 1
ERROR: `make' failed
build directly
I downloaded the current version of PHP (v5.3.5) and then installed the intl extension from ext/intl by running:
phpize &&
configure --enable-intl --with-icu-dir=/usr/local/Cellar/icu4c/4.4.1 &&
make &&
make test &&
sudo make install
This seemed to work; I got an extension in the PHP extension directory and didn't get any error messages.
The file tells me: Mach-O 64-bit bundle x86_64
However, when I loaded the extension in php.ini, I got the message:
PHP Warning: PHP Startup: Invalid library (maybe not a PHP library) '/usr/lib/php/extensions/no-debug-non-zts-20090626/intl.so' in Unknown on line 0
I have no idea why this is happening. I'm guessing that it is because the extension is installed from PHP v5.3.5 and I am using v5.3.3, but I can't imagine that 2 bugfix releases would break compatibility.
Any Ideas?
UPDATE 2011-03-16:
I found a solution! When I explicitly set the -m64 flag in configure (which tells gcc to produce 64-bit code) then the extension loads correctly:
CFLAGS=-m64 CPPFLAGS=-m64 CCASFLAGS=-m64 ./configure
Maybe a little late, but here is a post on how to add intl to OS X Lion, using system tools:
http://mansion.im/2011/php-with-intl-and-gettext-on-osx-lion/