php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70751 Memcache port for PHP7
Submitted: 2015-10-20 18:50 UTC Modified: 2016-03-31 06:09 UTC
Votes:28
Avg. Score:4.6 ± 0.9
Reproduced:26 of 26 (100.0%)
Same Version:20 (76.9%)
Same OS:13 (50.0%)
From: jseder at gmail dot com Assigned: pajoye (profile)
Status: Closed Package: memcache (PECL)
PHP Version: 7.0.0RC5 OS: Windows 10
Private report: No CVE-ID: None
 [2015-10-20 18:50 UTC] jseder at gmail dot com
Description:
------------
I can't get memcache to work with PHP7 RC5 in Windows 10 using the 3.0.8 DLL.

In fact, neither of these versions of php_memcache.dll works with PHP7 RC5:
   2013-02-20  08:09            69,120
   2014-04-10  12:09            90,112

Setting the 69,120 byte DLL (which worked with PHP5) as a PHP7 extension generates "PHP Warning:  PHP Startup: Unable to load dynamic library 'ext\php_memcache.dll' - %1 is not a valid Win32 application."

The 90,112 byte DLL (the current 3.0.8 version) generates "PHP Warning:  PHP Startup: Unable to load dynamic library 'c:\php7\ext\php_memcache.dll' - The specified module could not be found." (The file is there - I just renamed the DLLs between these steps. And I checked it a zillion times...)

Is there a version of php_memcache.dll built with VS14?

Test script:
---------------
<?php
   $memcache = false;
   if(class_exists("Memcache")) {
      echo 'Class Memcache exists!';
      $memcache = new Memcache;
      $memcacherror = $memcache->connect("localhost",11211);
      if(false==$memcacherror) {
         echo 'memcache->connect returned false';
         exit;
         }
      else echo 'memcache daemon version: '.$memcache->getVersion();
      }
   else echo 'class Memcache does not exist';
   echo "\n\n";
   ?>

Expected result:
----------------
Class Memcache exists!
memcache daemon version: 1.4.5

Actual result:
--------------
PHP error.log: either
   "PHP Warning:  PHP Startup: Unable to load dynamic library 'ext\php_memcache.dll' - %1 is not a valid Win32 application."

or

"PHP Warning:  PHP Startup: Unable to load dynamic library 'c:\php7\ext\php_memcache.dll' - The specified module could not be found."

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-10-21 02:35 UTC] kalle@php.net
-Summary: PHP 7 - Windows 10 - Unable to load dynamic library ext\memcache.dll +Summary: Memcache port for PHP7
 [2015-10-21 02:35 UTC] kalle@php.net
Morning

Maybe I can clarrify a little what those warnings mean:
"is not a valid Win32 application."

This generally means that you are trying to load a PHP5 extension under PHP7 or you are using a 64bit version of an extension on a 32bit version of PHP.


The second one, which is rather interesting actually means that an external library could not be found, such as a DLL from which the extension was linked with, like openssl for example for ext/openssl.


I've looked at the source tree on pecl and it doesn't seem like there have been any changes to pecl/memcache since 2012, which was way before phpng even existed, which means the only options you have now are:

1) Make a pull request if you are a C developer and get it merged into pecl
2) Poke the developers, and see if they are interested in porting it to php7
3) Find an alternative to the extension for php7

I'll leave the bug report open, with a renamed title, in the hope that someone will pick this up
 [2015-10-21 16:24 UTC] jseder at gmail dot com
Dependency Walker shows that php_memcache.dll 3.0.8 looks for php5ts.dll. 

Adding that to the php7 directory changed "module could not be found" to "%1 is not a valid Win32 application". Maybe memcache needs to be built with php7ts.lib.

Thanks very much for keeping this alive. It's an important extension and I haven't found any alternatives.
 [2015-11-09 23:57 UTC] baloghsz at szabi dot org
i tried to port it,
take a look at https://github.com/websupport-sk/pecl-memcache/tree/php7
 [2015-12-04 13:46 UTC] supaducta at yahoo dot com
On CentOS 7, PHP 7.0.0, memcache 3.0.8:

-------------------------------------------
[root@mahadeva memcache-3.0.8]# make
/bin/sh /root/rpmbuild/SOURCES/memcache-3.0.8/libtool --mode=compile cc -I/usr/php70/include/php -I. -I/root/rpmbuild/SOURCES/memcache-3.0.8 -DPHP_ATOM_INC -I/root/rpmbuild/SOURCES/memcache-3.0.8/include -I/root/rpmbuild/SOURCES/memcache-3.0.8/main -I/root/rpmbuild/SOURCES/memcache-3.0.8 -I/usr/php70/include/php -I/usr/php70/include/php/main -I/usr/php70/include/php/TSRM -I/usr/php70/include/php/Zend -I/usr/php70/include/php/ext -I/usr/php70/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /root/rpmbuild/SOURCES/memcache-3.0.8/memcache.c -o memcache.lo
mkdir .libs
 cc -I/usr/php70/include/php -I. -I/root/rpmbuild/SOURCES/memcache-3.0.8 -DPHP_ATOM_INC -I/root/rpmbuild/SOURCES/memcache-3.0.8/include -I/root/rpmbuild/SOURCES/memcache-3.0.8/main -I/root/rpmbuild/SOURCES/memcache-3.0.8 -I/usr/php70/include/php -I/usr/php70/include/php/main -I/usr/php70/include/php/TSRM -I/usr/php70/include/php/Zend -I/usr/php70/include/php/ext -I/usr/php70/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /root/rpmbuild/SOURCES/memcache-3.0.8/memcache.c  -fPIC -DPIC -o .libs/memcache.o
In file included from /root/rpmbuild/SOURCES/memcache-3.0.8/php_memcache.h:34:0,
                 from /root/rpmbuild/SOURCES/memcache-3.0.8/memcache.c:30:
/root/rpmbuild/SOURCES/memcache-3.0.8/memcache_pool.h:45:47: fatal error: ext/standard/php_smart_str_public.h: No such file or directory
 #include "ext/standard/php_smart_str_public.h"
                                               ^
compilation terminated.
make: *** [memcache.lo] Error 1
-------------------------------------------
 [2016-01-06 12:12 UTC] aik dot bold at gmail dot com
I'm also having that problem (not able to compile memcache extension) using PHP 7.0.1.
 [2016-01-13 04:05 UTC] naruskevic dot jan at gmail dot com
The same problem here. I really need memcache dll for win64.
 [2016-01-20 23:11 UTC] php at alternize dot com
the branch "NON_BLOCKING_IO_php7" of the git repository https://github.com/websupport-sk/pecl-memcache.git builds fine against php 7.0.2 in win32 x86 thread-safe mode. i have not tested it with non-thread-safe and/or x64.

to build the php_memcache.dll, i followed the instructions on https://wiki.php.net/internals/windows/stepbystepbuild#building_pecl_extensions using:

  C:\php-sdk\phpdev\vc14\x86\php-7.0.2-src>buildconf
  C:\php-sdk\phpdev\vc14\x86\php-7.0.2-src>configure --disable-all 
    --enable-cli --enable-zlib --enable-hash --enable-session 
    --without-gd --with-bz2 --enable-memcache=shared
  C:\php-sdk\phpdev\vc14\x86\php-7.0.2-src>nmake
 [2016-03-31 06:00 UTC] ammar dot fallaha at automata4 dot com
Dear php at alternize dot com:
Can you post the .dll that you compiled please?
 [2016-03-31 06:09 UTC] pajoye@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: pajoye
 [2016-03-31 06:09 UTC] pajoye@php.net
As pointed in a previous comment, please use the github php7 branche.

Closing this one.
 [2016-05-02 19:30 UTC] 13ilya at gmail dot com
On openSUSE Tumbleweed x86_64 php 7.0.6 with pecl I can't build memcache, redis and sphinx too.
 [2016-09-27 12:28 UTC] php-bugs-2016 at ryandesign dot com
Referring us to some branch of some github repository is not
sufficient. Please re-open this bug, until you have posted
an official PHP7-compatible version at:

https://pecl.php.net/package/memcache

Thank you.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 12:01:25 2019 UTC