Memcache extension with PHP 7 on CentOS fails to install - memcached

I'm trying to upgrade a fairly large PHP 5.3 code base to PHP 7. It's hosted on CentOS 6.5, so I want to keep it on that OS. I'm currently doing it on a virgin Vagrant box - I've installed PHP 7 successfully, and all the modules except for Memcache.
As root, when I run pecl install memcache it tries to install v2.2.7 but I get a long list of errors and warnings from make. At the end is:
make: *** [memcache.lo] Error 1
ERROR: `make' failed
According to GoPHP7 it should work, Memcache should work with PHP 7 - it says "php7 port on github". There is indeed a Memcache PHP 7 port on GitHub. When I look at the Memcache page on Pecl page, it shows that I should be installing v3.0.8, but this in beta (and has been since 2013).
So I try to run pecl install memcache-3.0.8 and it still fails, with the same error as above:
make: *** [memcache.lo] Error 1
ERROR: `make' failed
So is it possible to get the Memcache extension working with PHP 7 on CentOS 6.5?

If you haven't solved this yet, I have a solution that worked for me. I'm on CentOS 7.x but it should still work for you, and anyone else wanting to use pecl-memcache with PHP 7 (not pecl-memcached as that's a completely different package).
As you have already discovered, you must use the Memcache PHP 7 port on GitHub for this.
Login to your shell and perform the following:
1. wget https://github.com/websupport-sk/pecl-memcache/archive/NON_BLOCKING_IO_php7.zip
2. unzip NON_BLOCKING_IO_php7.zip
3. cd pecl-memcache-NON_BLOCKING_IO_php7
4. /opt/cpanel/ea-php70/root/usr/bin/phpize && ./configure --enable-memcache --with-php-config=/opt/cpanel/ea-php70/root/usr/bin/php-config && make
5. cp modules/memcache.so /opt/cpanel/ea-php70/root/usr/lib64/php/modules/
6. echo 'extension=memcache.so' >/opt/cpanel/ea-php70/root/etc/php.d/memcached.ini
7. service httpd restart
Some notes for the above:
Replace each full path that I've used with the appropriate full path on your own system. While I have /opt/cpanel/ea-php70/root/, you may have /opt/php-7.0.7/. If you have multiple PHP versions installed, as I do, running phpize may end up building using an old version of PHP. I discovered this after much trial and error.
To find out where your PHP modules folder is, you can run "/opt/cpanel/ea-php70/root/usr/bin/php -i | grep extension_dir"
You may not need to perform step 6 where I am creating a memcached.ini if you already have it loaded elsewhere.
You can verify if it was correctly built and installed using "/opt/cpanel/ea-php70/root/usr/bin/php -i | grep memcache". If you see various memcache entries, everything was installed successfully.
I hope that helps!

Related

php_intl.dll issue while installing moodle

I am trying to install moodle. It has been a very frustrating experience with the "Server Checks" page during the installation process with 2 issues.
php_extension for php_intl.dll is failing. I have done nearly everything that is written anywhere but the server check still fails.
php_setting for opcache.enable also fails. All the settings in php.ini as per recommendation has been made and yet this check doesn't pass.
One pointer which may be useful. from the command prompt, when i tried to do php -v to check version or if i run php.exe, it throws an error saying:
"PHP Warning: PHP Startup: Unable to load dynamic library 'D:\Moodle_34\server\php\ext\php_intl.dll' - The specified module could not be found. in Unknown on line 0"
moodle 3.4.3+
Windows 8.1 pro desktop
PHP 7.1.10
Apache 2.4
XAMPP 3.2.2
Any help would be most welcome.

How to run PHP 5.5.4 mcrypt run on CentOS 6.4?

I am getting the following error:
PHP Warning: PHP Startup: Unable to load dynamic library
'/usr/lib/php/extensions/no-debug-non-zts-20121212/mcrypt.so' -
/lib64/libc.so.6: version `GLIBC_2.14' not found (required by
/usr/lib/php/extensions/no-debug-non-zts-20121212/mcrypt.so)
Does mcrypt require glibc 2.14?
We are running CentOS 6.4 (latest stable version of CentOS) and it comes with glibc 2.12 (can't really upgrade glibc as being a core part of OS, changing it will likely break lots of stuff)
How do I make my PHP 5.5.4 run mcsypt under these circumstances?
Current configuration (phpinfo output) is here.
I was also having issues installing mcrypt on my VPS dev server so I thought I would post my solution in the hopes that it helps someone. I am running Centos OS 6.5 and had upgraded PHP to 5.5.13 using the Webtatic EL yum repository. https://webtatic.com/packages/php55/
First shh into your server
ssh admin#domain.com
initially I was trying to do (which was not working):
yum update
yum install php-mcrypt
I then realized my mistake when I looked at php -v and realized php-common was conflicting as the above code was trying to load a dependency from 5.3.
I then executed the following correct commands:
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
yum update
yum install php55w-mcrypt
service httpd restart
This worked perfectly for me.
I also read while researching this issue that some people did have to add the extension to their .ini file manually by adding the following line but i did not have to do this.
extension=mcrypt.so
you can find the location of your php.ini file by looking at phpinfo(); and see which configuration it is loading. For me the following ini files were loading:
/etc/php.ini
/etc/php.d/mcrypt.ini
/var/www/vhosts/system/domain.com/etc/php.ini
If the installation is successful then you will see the extension when you echo phpinfo();
Try installing php-mcrypt using yum. That should pull in any other libraries you need to run it.
yum install php-mcrypt
In light of your update, it would appear that you are trying to use the MCrypt extension built from another PHP Source which was created by an updated GLIBC library. The only proper solution I can see is the following:
You first need to ensure you have libmcrypt, libmcrypt-devel, and mcrypt installed before continuing. Check your CentOS repository.
Download the PHP Source from http://php.net
Untar the downloaded source tar -zxf php-5.5.4.tar.gz
cd into the source cd php-5.4.4
Copy your current ./configure string. The whole thing!
Add support for Mcrypt --with-mcrypt=/usr and run the new configure command
make && make install
restart Apache and PHP-FPM
This will keep your current configuration just as CentOS has built it but with the additional support of MCrypt as you are looking to have. Once you've done this, you do not need to enable the MCrypt extension in your php.ini file as it will be built into PHP itself and will be automatically loaded for you now.
When in doubt, you can also read up on the installation here http://us1.php.net/manual/en/mcrypt.installation.php

Mountain Lion Zend Install - You must enable the openssl extension to download files via https

I've been trying to get Zend installed on my Mac Pro for some time. I've tried installing it manually, with homebrew, and with port. I've changed php's, reinstalled php, updated php, reinstalled openssl multiple times.
php.ini has openssl in it and it is uncommented, curl is also enabled.
no matter which way I go about it I always get a message like this or very similar (always ssl)
You must enable the openssl extension to download files via https
I also installed a certificate for ssl.
currently I have downloaded the zip for the Zend 2.2.2 'tutorial', extracted to a sites directory and have run
composer install
which as given me:
Loading composer repositories with package information
Installing dependencies (including require-dev)
- Installing zendframework/zendframework (2.2.2)
[RuntimeException]
You must enable the openssl extension to download files via https
install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-scripts] [--no-progress] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader]
I know its installed. I've reinstalled it 3 times. Only thing I can think of is maybe there is more than one php.ini but I haven't been able to find a second one.
thanks in advance for any advice.
I ran php info in apache and got the old install of php version 5.3, when I run it from the command line I get the new 5.4 ?
$ openssl version
OpenSSL 1.0.1e 11 Feb 2013
$ composer diag
Checking platform settings: FAIL
The openssl extension is missing, which will reduce the security and stability of Composer.
If possible you should enable it or recompile php with --with-openssl
Checking http connectivity: OK
Checking composer.json: OK
Checking disk free space: OK
Checking composer version: OK
There is more than one php.ini - the command line version of PHP has a separate one. To see what that is, run php -i | grep ini from the command line - the output should include the .ini files being used near the top.
(Disclaimer: I'm not a Mac user so things may be different in Apple world.)
I'd like to say there was an easy fix. My suggestion is to use homebrew, install everything, then make sure your php.ini is in the right spot (probably have to move it) and also that you change the permissions on local\openssl so that homebrew can write to it. Eventually by moving php.ini around and installing php54 I was able to get it to work.
these are great resources
http://juniorgrossi.com/2013/working-with-multiple-php-versions-on-mac-os-x/
http://railsapps.github.io/openssl-certificate-verify-failed.html

memcache install for MAMP using wrong API version

I'm attempting to install memcache for MAMP. It seems to configure/make/install fine but I'm getting an error saying the API version is wrong:
[26-Oct-2012 17:40:51 UTC] PHP Warning: PHP Startup: memcache: Unable to initialize module
Module compiled with module API=20090626
PHP compiled with module API=20100525
These options need to match
in Unknown on line 0
I am using MAMP 2.1.1 on OS X Mountain Lion.
I'm using this memcache build:
http://pecl.php.net/package/memcache/2.2.7
I extracted the archive into this directory:
/Applications/MAMP/bin/php/php5.4.4/include/memcache-2.2.7
And then ran these commands from the extracted directory:
/Applications/MAMP/bin/php/php5.4.4/bin/phpize
./configure
make
sudo make install
No errors except what I noted above, which I am seeing in:
/Applications/MAMP/logs/php_error.log
Any ideas on how to fix this?
Ok so after a few hours of trying to figure this out, I was able to find the problem and fix it. I'm pretty much a huge noob when it comes to all of this stuff, but here is the best I can explain what I think I figured out:
So, when I ran first ran phpize on the module, it was configured for my system's default installation of php. I had to point php and phpize to my PATH in my .bash_profile
export PATH=/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php/php5.4.3/bin:/usr/local/bin:$PATH:/opt/local/bin
Make sure to change the php version to what ever version you are running.
After adding this to your path, running phpize -v should return:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525
and running which phpize should return: /Applications/MAMP/bin/php/php5.4.3/bin/phpize
So then it was just a matter of deleting all of the files that were installed the first time, and running through the installation process again. I unzipped the downloaded file cd into the unzipped folder and ran:
/Applications/MAMP/bin/php/php5.4.3/bin/phpize
./configure
make
cp modules/memcache.so /Applications/MAMP/bin/php/php5.4.3/lib/php/extensions/no-debug-non-zts-20100525/
And boom done. It works!
This article helped me out a lot, even though it isn't related to memcache: http://drupal.org/node/1464236

Installing PDO-drivers for PostgreSQL on Mac (using Zend for eclipse)

How can I get PDO to work on my mac (os x 10.5)? I'm using the built in php and php in Zend/Eclipse. Can't seem to find useful drivers for it at all.
I had to install the PDO_PGSQL driver recently on Leopard, and I ran across a multitude of problems. In my search for answers, I stumbled across this question. Now I have it successfully installed, and so, even though this question is quite old, I hope that what I've found can help others (like myself) who will undoubtedly run into similar problems.
The first thing you'll need to do is install PEAR, if you haven't done so already, since it doesn't come installed on Leopard by default.
Once you do that, use the PECL installer to download the PDO_PGSQL package:
$ pecl download pdo_pgsql
$ tar xzf PDO_PGSQL-1.0.2.tgz
(Note: you may have to run pecl as the superuser, i.e. sudo pecl.)
After that, since the PECL installer can't install the extension directly, you'll need to build and install it yourself:
$ cd PDO_PGSQL-1.0.2
$ phpize
$ ./configure --with-pdo-pgsql=/path/to/your/PostgreSQL/installation
$ make && sudo make install
If all goes well, you should have a file called "pdo_pgsql.so" sitting in a directory that should look something like "/usr/lib/php/extensions/no-debug-non-zts-20060613/" (the PECL installation should have outputted the directory it installed the extension to).
To finalize the installation, you'll need to edit your php.ini file. Find the section labeled "Dynamic Extensions", and underneath the list of (probably commented out) extensions, add this line:
extension=pdo_pgsql.so
Now, assuming this is the first time you've installed PHP extensions, there are two additional steps you need to take in order to get this working. First, in php.ini, find the extension_dir directive (under "Paths and Directories"), and change it to the directory that the pdo_pgsql.so file was installed in. For example, my extension_dir directive looks like:
extension_dir = "/usr/lib/php/extensions/no-debug-non-zts-20060613"
The second step, if you're on a 64-bit Intel Mac, involves making Apache run in 32-bit mode. (If there's a better strategy, I'd like to know, but for now, this is the best I could find.) In order to do this, edit the property list file located at /System/Library/LaunchDaemons/org.apache.httpd.plist. Find these two lines:
<key>ProgramArguments</key>
<array>
Under them, add these three lines:
<string>arch</string>
<string>-arch</string>
<string>i386</string>
Now, just restart Apache, and PDO_PGSQL will be up and running.
Take a look at this PECL package: PDO_PGSQL
I haven't tried it myself, but I've been interested in playing with Postgres as an alternative to MySQL. If I have a chance to try it soon, I'll throw my results up here in case it helps.
I'm not sure this will help with the PDO drivers specifically, but you might look into BitNami's MAPPStack.
I had a ton of trouble with Postgres, PHP, and Apache on my Mac, some of it having to do with 64- vs 32-bit versions of some or all of them. So far, the BitNami MAPPStack install is working nicely in general. Maybe it will help with your PDO issues as well.
Install new php version via brew and restart server, and php -v, all issues are removed.
This is what worked for me
brew install php55-pdo-pgsql
This installs PHP 5.5.32 and PostgreSQL 9.5. I already had PostgreSQL 9.4 installed so I uninstalled the homebrew version with:
brew uninstall postgres
You then have to update /etc/apache2/httpd.conf to point to the correct PHP version and restart Apache:
LoadModule php5_module /usr/local/Cellar/php55/5.5.32/libexec/apache2/libphp5.so
My OSX version is Yosemite.