cannot install APC with PECL & PHP 5.5.9 - php

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

Related

How To Install PECL YAML Extension on Mac?

My goals is to be able to use the PHP functions for parsing YAML detailed in the PHP docs:
http://php.net/manual/en/ref.yaml.php
To install the PECL yaml extension I've opened Terminal and typed:
brew install libyaml
Then
sudo /usr/local/php5/bin/pecl install pecl_http
Then
sudo /usr/local/php5/bin/pecl install yaml
But I think it fails to install the PECL yaml extension. It says:
3 warnings and 16 errors generated.
make: *** [yaml.lo] Error 1
ERROR: `make' failed
And when I try to use yaml_parse_file() in my program, it says:
Fatal error: Call to undefined function yaml_parse_file()
How do I properly install the PECL yaml extension so I can use the PHP functions for parsing YAML?
I had similar issue and below steps helped me.
First be sure you have installed yaml extension (as I know since brew will not help us for packages so better to use pecl)
Even though some errors (such as failed for mkdir) occurred during installation it was completed.
pecl install yaml
Next open your php.ini file and add this line according to your path to yaml.so file.
extension=/usr/local/Cellar/php70-yaml/2.0.0/yaml.so
Hope it helps..

intl and PHP 5.4.24 on OSX 10.9

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

Setting memcached for lampp on linux using pecl

ORIGINAL POST
First of all, I want to install memcached, not memcache.
I'm trying to set up memcached to work with my lampp server on ubuntu 12.10 since yesterday. I've already followed almost every tutorial I could find. The most recent thing, I tried to do was:
in terminal
apt-get install libmemcached-dev
cd /opt/lampp
./bin/pecl install memcached
and then adding extension="memcached.so" in php.ini file. After this I restarted lampp using /opt/lampp/lampp restart
When I tried to open php script in my browser it just got downloaded. Running tail -20 /opt/lampp/logs/php_error_logthis is what I see:
PHP Warning: PHP Startup: Unable to load dynamic library '/opt/lampp/lib/php/extensions/no-debug-non-zts-20100525/memcached.so' - /opt/lampp/lib/php/extensions/no-debug-non-zts-20100525/memcached.so: wrong ELF class: ELFCLASS64 in Unknown on line 0
It seems this guy had same problem but with different extension. When I try to compile 32 bit version of the extension using:
phpize
CFLAGS=-m32 CPPFLAGS=-m32 CCASFLAGS=-m32 ./configure
make
But make throws the following error:
/usr/bin/ld: skipping incompatible /usr/local/lib/libmemcached.so when searching for -lmemcached
/usr/bin/ld: cannot find -lmemcached
/usr/bin/ld: cannot find -lz
collect2: error: ld returned 1 exit status
make: *** [memcached.la] Error 1
The problem is that I don't even know if I'm on the right path. If someone could write short step-by-step guide how to get this working or just show me where the issue is it would be great.
UPDATE
After executing sudo dpkg --add-architecture i386 sudo apg-get update sudo apt-get install libmemcached-dev:i386 libz-dev:i386 and phpize CFLAGS=-m32 CPPFLAGS=-m32 CCASFLAGS=-m32 ./configure make memcached compiles fine. It still doesn't work however. After checking php error logs again I get this
PHP Startup: Unable to load dynamic library '/opt/lampp/lib/php/extensions/no-debug-non-zts-20100525/memcached.so' - /opt/lampp/lib/libgcc_s.so.1: version `GCC_4.2.0' not found (required by /usr/lib/i386-linux-gnu/libstdc++.so.6) in Unknown on line 0
You are on the right path - your lampp is 32bit while rest of the system (i assume) is 64bit. So when you installed libmemcached an compiled php-libmemcached it is 64bit version. That's why you get the "Wrong ELF class" error.
Before you can compile 32bit version of php-memchached you need to install 32bit versions of libmemcached and libz (and their headers).
You need to:
sudo dpkg --add-architecture i386
sudo apg-get update
sudo apt-get install libmemcached-dev:i386 libz-dev:i386
I think that should be enough to let you compile 32bit version of php-libmemcached.
There is a dirt way to fix your problem
go to /usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.x.x
and copied the libgcc_s.so into
/opt/lampp/lib and renamed it to libgcc_s.so.1 to overwrite the previous file.

Install fileinfo php extension

As the fileinfo is moved from PECL to PHP. What is the best way to install it through WHM or putty.?
I tried following command:
pecl install fileinfo
and received following error:
WARNING: "pear/Fileinfo" is deprecated in favor of "channel://php-src/ext/fileinfo/in php sources
"WARNING: channel "pear.php.net" has updated its protocols, use "pecl channel-update pear.php.net" to update
downloading Fileinfo-1.0.4.tgz ...
Starting to download Fileinfo-1.0.4.tgz (5,835 bytes)
.....done: 5,835 bytes
3 source files, building
running: phpize
Cannot find config.m4.
Make sure that you run '/usr/local/bin/phpize' in the top level source directory of the module
ERROR: `phpize' failed
This extension is enabled by default as of PHP 5.3.0. Before this time, fileinfo was a PECL extension but is no longer maintained there. However, versions prior to 5.3+ may use the » discontinued PECL extension.
Reference:
http://www.php.net/manual/en/fileinfo.installation.php
ERROR: `phpize' failed
This error is displayed because you don't have php-devel package installed
Are you install php-devel?
phpize execute need's php-devel package. if you are on centos run the following code
yum install php-devel
I encountered this, and needed to install php-fileinfo for WHM on a VPS Dedicated server. This https://www.inmotionhosting.com/support/website/how-to-install-a-php-extension-using-easyapache-4/
was very helpful. I figured id post this for the next guy.
For me this is working
#yum install rh-php70-php-devel
https://centos.pkgs.org/7/centos-sclo-rh/rh-php70-php-devel-7.0.10-2.el7.x86_64.rpm.html

Installing intl on OS X 10.6.6: Invalid library (maybe not a PHP library) intl.so

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/

Categories