Giter Site home page Giter Site logo

phpredis's People

Contributors

albertofem avatar alexander-schranz avatar crocodele avatar f0ff886f avatar iyesin avatar jan-e avatar marius-meissner avatar maxbeutel avatar michael-grunder avatar mithunsatheesh avatar mlocati avatar nasr avatar nbraun-amazon avatar nicolas-grekas avatar nicolasff avatar orangejuiced avatar remicollet avatar rlunar avatar ruudk avatar savar avatar szepeviktor avatar tersmitten avatar tillkruss avatar titpetric avatar ttodua avatar tysonandre avatar weltling avatar yatsukhnenko avatar yulonghu avatar zakay avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

phpredis's Issues

Variable number of arguments to methods

Some methods such as sUnion() take a variable number of arguments. It would be awesome to have a variant of each method which takes an array of arguments - i.e. something like sprintf vs. vsprintf.

Currently we have to call_user_func_array or do a switch on count($args) if we don't know the number of arguments in advance.

Delete doesn't work ...

Hello, i tried to bench Redis vs Memcache, but i have a problem : the delete doesn't work with phpredis (but work with redis-cli...).

Here my code to bench :

$TAILLE_CHAINE = 100;
$NB_ITER = 10000;

$chaine = '';
for($i=0; $i<$TAILLE_CHAINE; ++$i)
    $chaine .= 'a';

$redis = new Redis();
$redis->pconnect('/var/run/redis/redis.sock');
$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_NONE);

echo 'Redis : SET<br />';
$dateDeb = microtime(true);
for($i=0; $i<$NB_ITER; ++$i)
    $redis->set($i, $chaine);
echo (microtime(true) - $dateDeb).' secondes<br /><br />';

echo 'Redis : GET<br />';
$dateDeb = microtime(true);
for($i=0; $i<$NB_ITER; ++$i)
    if( $redis->get($i) === FALSE )
        echo 'NOT FOUND '.$i.'<br />';
echo (microtime(true) - $dateDeb).' secondes<br /><br />';

echo 'Redis : DEL<br />';
$dateDeb = microtime(true);
for($i=0; $i<$NB_ITER; ++$i)
    if( $redis->delete($i) == 0)
        var_dump($redis->delete($i));
echo (microtime(true) - $dateDeb).' secondes<br /><br />';

Write :

Redis : SET
0.64885401725769 secondes

Redis : GET
0.53704690933228 secondes

Redis : DEL
bool(false) bool(false) bool(false) bool(false) bool(false) bool(false) [...] bool(false) bool(false) 1.2805261611938 secondes

When i go on redis-cli, I can "GET 10" for example who returns the value. After DEL 10, GET 10 returns null, so the problem come from my php or php-redis.

Can you help me??

Thanks, Max

Build Lion complete but missing classes

creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
config.status: config.h is unchanged
marvin:phpredis francis$ make && sudo make install

Build complete.
Don't forget to run 'make test'.

Password:
Installing shared extensions:     /usr/lib/php/extensions/no-debug-non-zts-20090626/
marvin:phpredis francis$ 

but where is my Redis.php class :-)

php_redis-nts.dll

Is it possible that you can make a build with NTS instead of TS?

Error Msg:

PHP Warning: PHP Startup: redis: Unable to initialize module
Module compiled with build ID=API20090626,TS,VC9
PHP compiled with build ID=API20090626,NTS,VC9
These options need to match in Unknown on line 0

redis setBit('key', $offset, 0) $offset not support unsigned int

redis setBit('key', $offset, 0) $offsevt not support unsigned int

this code

line no: 1311 redis.c

cmd_len = redis_cmd_format_static(&cmd, "SETBIT", "sdd", key, key_len, (int)offset, (int)val);
->
cmd_len = redis_cmd_format_static(&cmd, "SETBIT", "sud", key, key_len, (unsigned int)offset, (int)val);

line no:252 library.c

        case 'd': {
            int i = va_arg(ap, int);
            char tmp[32];
            int tmp_len = snprintf(tmp, sizeof(tmp), "%d", i);
            smart_str_append_long(&buf, tmp_len);
            smart_str_appendl(&buf, _NL, sizeof(_NL) - 1);
            smart_str_appendl(&buf, tmp, tmp_len);
        }
            break;
                                                 case 'u': {
            unsigned int i = va_arg(ap,unsigned int);
            char tmp[32];
            int tmp_len = snprintf(tmp, sizeof(tmp), "%u", i);
            smart_str_append_long(&buf, tmp_len);
            smart_str_appendl(&buf, _NL, sizeof(_NL) - 1);
            smart_str_appendl(&buf, tmp, tmp_len);
        }
            break;

A PEAR Channel or inclusion in pecl.php.net

It would be great if you could publishes releases via a pear channel so tools like the PEAR install (pecl install phpredis) and Pyrus (next gen of the PEAR installer, still in development) can install and manage the extension.

http://www.pirum-project.org/ could get you up and running real quick - pear.zero.mq is an example of pecl packages hosted externally. All the files generated are static so in theory you should be able to run the channel directly from github but I have never tried it... I know running it directly from SVN does work.

The other alternative which would also be nice it to get the package accepted into pecl.php.net :-)

apache cannot load redis.so in CentOS 5.5

I installed redis & phpredis without any problem. However when restarting httpd , the apache's error_log just says that there's error loading module, with no useful info.
And when i try a simple PHP snippet

I got the error
Fatal error: Class 'Redis' not found in /xxx/r.php on line 2

I sure did not forget to copy the redis.so to appropriate place (in this case /usr/lib/php/modules)
Anyway, i thought there was some error with the latest versions of redis & phpredis, so i go back and get the 2 packages: redis-2.2.6 and phpredis-2.1.2-0-g35e6bc7 , which I deployed on my Ubuntu box a few months ago

When i use those 2 packages on my real production server CentOS, i get the same error as above

I'm not sure even how this bug is possible, given that both redis & phpredis only requires very basic dependent packages. Please help Nicolas

When key is a string key, hLen() gets wrong value.

The doc said:
hLen()
Return value
LONG the number of items in a hash, FALSE if the key doesn't exist or isn't a hash.

However, when I called hLen() from a string key, I got the value of the string key, as just using "get" command.
My phpredis version is 2.1.3

$redis->connect connect success return true failure not false

Fatal error: Uncaught exception 'RedisException' with message 'Can't connect to 192.168.8.251:63791' in /www/web/default/redis.php:16 Stack trace: #0 /www/web/default/redis.php(16): Redis->connect('192.168.8.251', 63791) #1 {main} thrown in /www/web/default/redis.php on line 16

compile failure on Solaris: ps_globals: referenced symbol not found

Hi, I'm getting the following error while trying to compile with 5.3.7

[20-Aug-2011 21:21:42] PHP Warning: PHP Startup: Unable to load dynamic library '/opt/local/lib/php/extensions/no-debug-non-zts-20090626/redis.so' - ld.so.1: httpd: fatal: relocation error: file /opt/local/lib/php/extensions/no-debug-non-zts-20090626/redis.so: symbol ps_globals: referenced symbol not found in Unknown on line 0

Would love any suggestions for fixes.

$ uname -a
SunOS xxxx.joyent.us 5.11 snv_121 i86pc i386 i86pc Solaris

$ gcc -v
Using built-in specs. Target: i386-pc-solaris2.11 Configured with: /tmp/pkgsrc/lang/gcc44/work/gcc-4.4.4/configure --disable-nls --prefix=/opt/local/gcc44 --enable-languages='c c++ fortran java objc' --with-system-zlib --enable-shared --enable-__cxa_atexit --enable-long-long --with-local-prefix=/opt/local/gcc44 --disable-libssp --enable-threads=posix --with-gmp=/opt/local --with-mpfr=/opt/local Thread model: posix gcc version 4.4.4 (GCC)

And below is the compile process:

[root@xxxx ~/phpredis]# phpize
Configuring for: PHP Api Version: 20090626 Zend Module Api No: 20090626 Zend Extension Api No: 220090626

[root@xxxx ~/phpredis]# ./configure --enable-redis --disable-redis-session
loading cache ./config.cache checking for Cygwin environment... (cached) no checking for mingw32 environment... (cached) no checking for egrep... (cached) grep -E checking for a sed that does not truncate output... (cached) /opt/local/bin/sed checking for gcc... (cached) gcc checking whether the C compiler (gcc ) works... yes checking whether the C compiler (gcc ) is a cross-compiler... no checking whether we are using GNU C... (cached) yes checking whether gcc accepts -g... (cached) yes checking how to run the C preprocessor... (cached) gcc -E checking for icc... no checking for suncc... no checking whether gcc and cc understand -c and -o together... (cached) yes checking for system library directory... lib checking if compiler supports -R... (cached) yes checking host system type... i386-pc-solaris2.11 checking target system type... i386-pc-solaris2.11 checking for PHP prefix... /opt/local checking for PHP includes... -I/opt/local/include/php -I/opt/local/include/php/main -I/opt/local/include/php/TSRM -I/opt/local/include/php/Zend -I/opt/local/include/php/ext -I/opt/local/include/php/ext/date/lib checking for PHP extension directory... /opt/local/lib/php/extensions/no-debug-non-zts-20090626 checking for PHP installed headers prefix... /opt/local/include/php checking if debug is enabled... no checking if zts is enabled... no checking for re2c... no configure: warning: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers. checking for gawk... (cached) gawk checking whether to enable redis support... yes, shared checking whether to enable sessions... no checking build system type... i386-pc-solaris2.11 checking for ld used by gcc... (cached) /usr/ccs/bin/ld checking if the linker (/usr/ccs/bin/ld) is GNU ld... (cached) no checking for /usr/ccs/bin/ld option to reload object files... (cached) -r checking for BSD-compatible nm... (cached) /usr/bin/nm -p checking whether ln -s works... (cached) yes checking how to recognize dependent libraries... (cached) pass_all checking for object suffix... (cached) o checking for executable suffix... (cached) no checking for dlfcn.h... (cached) yes checking the maximum length of command line arguments... (cached) 786240 checking command to parse /usr/bin/nm -p output from gcc object... (cached) ok checking for objdir... (cached) .libs checking for ar... (cached) ar checking for ranlib... (cached) ranlib checking for strip... (cached) strip checking if gcc supports -fno-rtti -fno-exceptions... (cached) no checking for gcc option to produce PIC... -fPIC checking if gcc PIC flag -fPIC works... (cached) yes checking if gcc static flag -static works... (cached) no checking if gcc supports -c -o file.o... (cached) yes checking whether the gcc linker (/usr/ccs/bin/ld) supports shared libraries... yes checking whether -lc should be explicitly linked in... yes checking dynamic linker characteristics... solaris2.11 ld.so (cached) (cached) checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... no checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... no creating libtool appending configuration tag "CXX" to libtool creating ./config.status creating config.h config.h is unchanged

[root@xxxx ~/phpredis]# make

mkdir .libs
 gcc -I. -I/root/phpredis -DPHP_ATOM_INC -I/root/phpredis/include -I/root/phpredis/main -I/root/phpredis -I/opt/local/include/php -I/opt/local/include/php/main -I/opt/local/include/php/TSRM -I/opt/local/include/php/Zend -I/opt/local/include/php/ext -I/opt/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /root/phpredis/redis.c  -fPIC -DPIC -o .libs/redis.o
/bin/sh /root/phpredis/libtool --mode=compile gcc  -I. -I/root/phpredis -DPHP_ATOM_INC -I/root/phpredis/include -I/root/phpredis/main -I/root/phpredis -I/opt/local/include/php -I/opt/local/include/php/main -I/opt/local/include/php/TSRM -I/opt/local/include/php/Zend -I/opt/local/include/php/ext -I/opt/local/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /root/phpredis/library.c -o library.lo 
 gcc -I. -I/root/phpredis -DPHP_ATOM_INC -I/root/phpredis/include -I/root/phpredis/main -I/root/phpredis -I/opt/local/include/php -I/opt/local/include/php/main -I/opt/local/include/php/TSRM -I/opt/local/include/php/Zend -I/opt/local/include/php/ext -I/opt/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /root/phpredis/library.c  -fPIC -DPIC -o .libs/library.o
/bin/sh /root/phpredis/libtool --mode=compile gcc  -I. -I/root/phpredis -DPHP_ATOM_INC -I/root/phpredis/include -I/root/phpredis/main -I/root/phpredis -I/opt/local/include/php -I/opt/local/include/php/main -I/opt/local/include/php/TSRM -I/opt/local/include/php/Zend -I/opt/local/include/php/ext -I/opt/local/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /root/phpredis/redis_session.c -o redis_session.lo 
 gcc -I. -I/root/phpredis -DPHP_ATOM_INC -I/root/phpredis/include -I/root/phpredis/main -I/root/phpredis -I/opt/local/include/php -I/opt/local/include/php/main -I/opt/local/include/php/TSRM -I/opt/local/include/php/Zend -I/opt/local/include/php/ext -I/opt/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /root/phpredis/redis_session.c  -fPIC -DPIC -o .libs/redis_session.o
/bin/sh /root/phpredis/libtool --mode=compile gcc  -I. -I/root/phpredis -DPHP_ATOM_INC -I/root/phpredis/include -I/root/phpredis/main -I/root/phpredis -I/opt/local/include/php -I/opt/local/include/php/main -I/opt/local/include/php/TSRM -I/opt/local/include/php/Zend -I/opt/local/include/php/ext -I/opt/local/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /root/phpredis/igbinary/igbinary.c -o igbinary/igbinary.lo 
mkdir igbinary/.libs
 gcc -I. -I/root/phpredis -DPHP_ATOM_INC -I/root/phpredis/include -I/root/phpredis/main -I/root/phpredis -I/opt/local/include/php -I/opt/local/include/php/main -I/opt/local/include/php/TSRM -I/opt/local/include/php/Zend -I/opt/local/include/php/ext -I/opt/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /root/phpredis/igbinary/igbinary.c  -fPIC -DPIC -o igbinary/.libs/igbinary.o
/bin/sh /root/phpredis/libtool --mode=compile gcc  -I. -I/root/phpredis -DPHP_ATOM_INC -I/root/phpredis/include -I/root/phpredis/main -I/root/phpredis -I/opt/local/include/php -I/opt/local/include/php/main -I/opt/local/include/php/TSRM -I/opt/local/include/php/Zend -I/opt/local/include/php/ext -I/opt/local/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /root/phpredis/igbinary/hash_si.c -o igbinary/hash_si.lo 
 gcc -I. -I/root/phpredis -DPHP_ATOM_INC -I/root/phpredis/include -I/root/phpredis/main -I/root/phpredis -I/opt/local/include/php -I/opt/local/include/php/main -I/opt/local/include/php/TSRM -I/opt/local/include/php/Zend -I/opt/local/include/php/ext -I/opt/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /root/phpredis/igbinary/hash_si.c  -fPIC -DPIC -o igbinary/.libs/hash_si.o
/bin/sh /root/phpredis/libtool --mode=compile gcc  -I. -I/root/phpredis -DPHP_ATOM_INC -I/root/phpredis/include -I/root/phpredis/main -I/root/phpredis -I/opt/local/include/php -I/opt/local/include/php/main -I/opt/local/include/php/TSRM -I/opt/local/include/php/Zend -I/opt/local/include/php/ext -I/opt/local/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /root/phpredis/igbinary/hash_function.c -o igbinary/hash_function.lo 
 gcc -I. -I/root/phpredis -DPHP_ATOM_INC -I/root/phpredis/include -I/root/phpredis/main -I/root/phpredis -I/opt/local/include/php -I/opt/local/include/php/main -I/opt/local/include/php/TSRM -I/opt/local/include/php/Zend -I/opt/local/include/php/ext -I/opt/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /root/phpredis/igbinary/hash_function.c  -fPIC -DPIC -o igbinary/.libs/hash_function.o
/bin/sh /root/phpredis/libtool --mode=link gcc -DPHP_ATOM_INC -I/root/phpredis/include -I/root/phpredis/main -I/root/phpredis -I/opt/local/include/php -I/opt/local/include/php/main -I/opt/local/include/php/TSRM -I/opt/local/include/php/Zend -I/opt/local/include/php/ext -I/opt/local/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -o redis.la -export-dynamic -avoid-version -prefer-pic -module -rpath /root/phpredis/modules  redis.lo library.lo redis_session.lo igbinary/igbinary.lo igbinary/hash_si.lo igbinary/hash_function.lo 
gcc -shared -Wl,-h -Wl,redis.so -o .libs/redis.so  .libs/redis.o .libs/library.o .libs/redis_session.o igbinary/.libs/igbinary.o igbinary/.libs/hash_si.o igbinary/.libs/hash_function.o  -lc 
creating redis.la
(cd .libs && rm -f redis.la && ln -s ../redis.la redis.la)
/bin/sh /root/phpredis/libtool --mode=install cp ./redis.la /root/phpredis/modules
cp ./.libs/redis.so /root/phpredis/modules/redis.so
chmod +x /root/phpredis/modules/redis.so
cp ./.libs/redis.lai /root/phpredis/modules/redis.la
Libraries have been installed in:
   /root/phpredis/modules
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the`-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the 'LD_LIBRARY_PATH' environment variable
   during execution
- use the -RLIBDIR' linker flag
  See any operating system documentation about shared libraries for
  more information, such as the ld(1) and ld.so(8) manual pages.
  Build complete.
  Don't forget to run 'make test'.

[root@xxxx ~/phpredis]# make install
Installing shared extensions: /opt/local/lib/php/extensions/no-debug-non-zts-20090626/```

lrem input different

lrem order of parameters are listed different on the redis commands page

Redis Page:
LREM key count value

PHPRedis:
lrem(key, value, count)

Connecting to certain db

It would be nice, if not essential, to be able to choose which database to connect to. (Not host/port, but database)

redis.c:453: error: too many arguments to function ‘redis_sock_create’

Following directions for installation gives me the error in our title, redis.c:453: error: too many arguments to function ‘redis_sock_create’.

I did the phpize, and ./configure (went smoothly).

when i run make && make install I get the following errors:

infolock@d0n31:/code/phpredis$ sudo make
/bin/bash /code/phpredis/libtool --mode=compile cc -I. -I/code/phpredis -DPHP_ATOM_INC -I/code/phpredis/include -I/code/phpredis/main -I/code/phpredis -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H -g -O2 -c /code/phpredis/redis.c -o redis.lo
libtool: compile: cc -I. -I/code/phpredis -DPHP_ATOM_INC -I/code/phpredis/include -I/code/phpredis/main -I/code/phpredis -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H -g -O2 -c /code/phpredis/redis.c -fPIC -DPIC -o .libs/redis.o
/code/phpredis/redis.c: In function ‘redis_connect’:
/code/phpredis/redis.c:453: error: too many arguments to function ‘redis_sock_create’
make: *** [redis.lo] Error 1

make failed (osx), duplicate symbol _redis_array_ce [49bc7c]

I just tried to build the latest phpredis on my mac (lion), and it failed with a message:

ld: duplicate symbol _redis_array_ce in .libs/redis_array.o and .libs/redis.o for architecture x86_64
collect2: ld returned 1 exit status
make: *** [redis.la] Error 1

Commit 267c12 is the latest that builds fine.

brpoplpush, where are you ?

hi

Our queuing system is based on the BRPOPLPUSH command. This is the only thing that make our application to use a native php socket library instead of your great work.

regards

Bertand

renameNx delivers false on success

If I use renameNx and rename a key to a key that is currently not existing the operation is performed well on Redis server. Nevertheless I get false as result from phpredis.

The follwing test fails:

$redis->set('oldkey', 'value');
$this->assertTrue(
    $redis->renameNx('oldkey', 'newkey')
);

How do I weight servers?

Hi,

I can see you can weight servers in the php session config settings, but how do you weight servers yourself? Sorry if I'm missing something, I don't see this documented.

It would be nice to do something like this:

    $redis = new Redis();
    foreach ($connection as $ip => $weight)
        $redis->pconnect($ip, $port, $timeout, $weight);

phpredis do not make on FreeBSD

Hi. I have some problem with making phpredis on FreeBSD v7.2
So, I put a text of console here:

-> phpize

Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
configure.in:150: warning: AC_CACHE_VAL(lt_prog_compiler_static_works, ...): suspicious cache-id, must contain cv to be cached
../../lib/autoconf/general.m4:1973: AC_CACHE_VAL is expanded from...
../../lib/autoconf/general.m4:1993: AC_CACHE_CHECK is expanded from...
aclocal.m4:3555: AC_LIBTOOL_LINKER_OPTION is expanded from...
aclocal.m4:5493: _LT_AC_LANG_C_CONFIG is expanded from...
aclocal.m4:5492: AC_LIBTOOL_LANG_C_CONFIG is expanded from...
aclocal.m4:2972: AC_LIBTOOL_SETUP is expanded from...
aclocal.m4:2952: _AC_PROG_LIBTOOL is expanded from...
aclocal.m4:2915: AC_PROG_LIBTOOL is expanded from...
configure.in:150: the top level
configure.in:150: warning: AC_CACHE_VAL(lt_prog_compiler_pic_works, ...): suspicious cache-id, must contain cv to be cached
aclocal.m4:3510: AC_LIBTOOL_COMPILER_OPTION is expanded from...
aclocal.m4:7620: AC_LIBTOOL_PROG_COMPILER_PIC is expanded from...
configure.in:150: warning: AC_CACHE_VAL(lt_prog_compiler_pic_works_CXX, ...): suspicious cache-id, must contain cv to be cached
aclocal.m4:5606: _LT_AC_LANG_CXX_CONFIG is expanded from...
aclocal.m4:5605: AC_LIBTOOL_LANG_CXX_CONFIG is expanded from...
aclocal.m4:4641: _LT_AC_TAGCONFIG is expanded from...

-> ./configure

creating cache ./config.cache
checking for Cygwin environment... no
checking for mingw32 environment... no
checking for egrep... grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for gcc... gcc
checking whether the C compiler (gcc ) works... yes
checking whether the C compiler (gcc ) is a cross-compiler... no
checking whether we are using GNU C... yes
checking whether gcc accepts -g... yes
checking how to run the C preprocessor... gcc -E
checking for icc... no
checking for suncc... no
checking whether gcc and cc understand -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... yes
checking host system type... x86_64-unknown-freebsd7.2
checking target system type... x86_64-unknown-freebsd7.2
checking for PHP prefix... /usr/local
checking for PHP includes... -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/lib/php/20090626
checking for PHP installed headers prefix... /usr/local/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: warning: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
: not found
checking whether to enable redis support... yes, shared
: not found
: not found
./configure: 11723: Syntax error: end of file unexpected (expecting "then")

Commands and results. Has It source for FreeBSD?

SERIALIZER_IGBINARY and objects containing multiple DateTime object instances

Hello,

I'm facing a weird issue : when I set an object containing more than one DateTime object property with the igbinary serializer option, the first datetime object is restored correctly, others are restored as incomplete PHP class

Here's a piece of code to reproduce the bug :

    date_default_timezone_set('Europe/Berlin');
    
    class baba
    {
            protected $date1;
            protected $date2;
    
            public function __construct()
            {
                    $this->date1 = new DateTime('2011-04-07 13:17:09');
                    $this->date2 = new DateTime('2011-04-10 15:17:09');
                    return $this;
            }
            public function print_datas()
            {
                    echo $this->date1->format(DATE_ATOM)."\n";
                    echo $this->date2->format(DATE_ATOM)."\n";
                    return $this;
            }
    
    }
    
    $baba = new baba();
    
    $redis = new Redis();
    $redis->connect('127.0.0.1', 6379);
    $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_IGBINARY);
    
    $redis->set("__baba__", $baba);
    
    $cached_datas = $redis->get("__baba__");
    
    var_dump($cached_datas);
    
    $cached_datas->print_datas();
    
    $redis->delete("__baba__");
    

This bad behavior does not exists when I use the default PHP serializer.

This bad behavior does not exists when I use igbinary_serialize

I use igbinary 1.1.1 and phpredis 2.1.0.

keys() returning keys with prefix

I don't know if this is intended behavior, but it got me puzzled for a while:

$redis = new Redis();
$redis->connect('127.0.0.1');
$redis->setOption(Redis::OPT_PREFIX, 'somefix:');

$redis->set('foo', 'bar');

foreach ($redis->keys("*") as $key)
{
    echo $redis->get($key); // won't work, as it's trying to get somefix:somefix:foo

    $key = str_replace('somefix:', '', $key);
    echo $redis->get($key); // will work, returns bar.
}

Differences between multi get and getMultiple

Hello,

I just want to know the differencies between multiple get inside a transaction and the getMultiple command. Are the commands sended in one time in the first case, are they queue on the server itself or on the client side ?

what is the more efficient between the two ways ?

Thx

redis PHP session support doesn't lock the session

The standard php session handler "locks" the php session. This prevents race conditions resulting from allowing concurrent requests to modify the session. Have you considered building this same locking mechanism into the phpredis extension? The memcache extension in php does session locking (as of version 3.0.4) and might be a place to look at for insipration.

Thanks,
~Jeff

Apache can't load redis.so: "undefined symbol: ps_globals"

Debian 6, Apache 2.2, PHP 5.3.6, phpredis 2.1.3
Error:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20090626/redis.so' - /usr/lib/php/extensions/no-debug-non
-zts-20090626/redis.so: undefined symbol: ps_globals in Unknown on line 0

PHP config:
./configure -prefix=/usr --with-apxs2=/usr/bin/apxs2 --with-config-file-path=/etc/php5/apache2/ --with-mysql=/usr/lib --enable-mbstring --enable-gd-native-ttf=/usr/local --enable-shmop --enable-sockets --enable-inline-optimization --with-gd --with-openssl=/usr --with-jpeg-dir=/usr/lib --with-png-dir=/usr/lib --with-freetype-dir=/usr --enable-zip --with-zlib=/usr/ --disable-posix --with-curl --enable-sysvsem --enable-sysvshm --enable-sysvmsg --disable-fileinfo --without-pdo-sqlite --disable-session --without-sqlite --without-sqlite3 --with-mysqli=mysqlnd --with-pdo-mysql

make test output:

=====================================================================
PHP         : /usr/bin/php  
CWD         : /dist/nicolasff-phpredis-43bc590
Extra dirs  : 
VALGRIND    : Not used
=====================================================================
TIME START 2011-06-25 23:33:44
=====================================================================
No tests were run.

HMGET memory leak

Hi, I found that memory in the method hmget leaked. Here's a script to check.

<?php

echo 'memory usage start: ' . memory_get_usage(true) . PHP_EOL;

$redis = new Redis();
$redis->connect('127.0.0.1');

$redis->hMSet('htest', array(
                         'hash1' => str_pad('value1', 50),
                         'hash2' => str_pad('value2', 50),
                         'hash3' => str_pad('value3', 50),
                         'hash4' => str_pad('value4', 50),
                       ));

for($i = 0; $i < 1000000; $i++ )
{
    $data = $redis->hMGet('htest', array('hash1', 'hash2'));

    unset( $data );

    if ( $i % 100000 == 0 )
    {
        echo 'memory usage: ' . memory_get_usage(true) . PHP_EOL;
    }

}

echo 'memory usage: ' . memory_get_usage(true) . PHP_EOL;

The result will be:

php misc/ukko/hmget-memory-leak.php
memory usage start: 786432
memory usage: 786432
memory usage: 21495808
memory usage: 42467328
memory usage: 63176704
memory usage: 83886080
memory usage: 104857600
memory usage: 125566976

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 51 bytes) in /www/zarium/misc/ukko/hmget-memory-leak.php on line 17

Call Stack:
    0.0002     641432   1. {main}() /www/zarium/misc/ukko/hmget-memory-leak.php:0
   36.5578  134184184   2. Redis->hMget() /www/zarium/misc/ukko/hmget-memory-leak.php:17

subscribe method doesn`t supports closures as an callback

It would be great if you will add closures support into the subscribe method.

For example:

$redis->subscribe(array($channel), function($redis, $channel, $message){
    echo 'Handle message ' . $message . ' for chanel ' . $channel . PHP_EOL;
});

sAdd() with integer as key doesn't work, while set() does

PHPRedis will not add items to a set whose key is an integer. If I add an item to a set whose name is a string everything is fine. This might be planned behavior, but since set() works perfectly fine on an integer key, I expected sadd() to work, as well.

The SADD command does not show up when I MONITOR the redis server, so I assume the problem lies in the way phpredis parses and sends set keys to the server.

I'm running a recent redis/unstable and the most recent phpredis/master. In the python client everything works as expected.

how to reproduce it:

$r = new Redis();
$r->connect('localhost');

$r->sadd('test','works');
$ret = $r->spop('test');
echo "spop (string): $ret\n";

// doesn't go through to the redis server
$r->sadd(1234,'should_work');
$ret = $r->spop(1234);
echo "spop (int): $ret\n";

$r->set(1234,'works');
$ret = $r->get(1234);
echo "get (int): $ret\n";

Output:

spop (string): works
spop (int): 
get (int): works

Publish/subscribe (Segmentation fault)

This small script crache php.

function f($redis, $chan, $msg) {
echo "Handle message " . $msg . ' for chanel ' . $chan;
}

$r = new Redis();
if($r->connect('127.0.0.1', 6379)) {
echo 'Sleepping' . PHP_EOL;
sleep(5);

$chanel = 'chanel_'  . rand(1, 10);
echo 'Subscribe  to chanel ' . $chanel . PHP_EOL;
$r->subscribe(array($chanel), 'f');

/* for($i = 0; $i < 10; $i++) {
$r->publish('chanel_' . $i, 'test msg ' . rand(1, 10));
}*/

/*
for($i = 1; $i < 100; $i++) {
    echo $i . PHP_EOL;
    usleep(100000);
}
*/

} else {
echo "Can`t connect to redis." . PHP_EOL;
}

segfault in master

When I try to use gzencode with built-in phpredis I get Segmentation fault. With the same php and older phpredis it's ok.

Bad type specifier (zAdd)

Hi,

Great module! All commands works, strings, hashes, etc, but this one command zAdd for sorted sets gives me an error:

$redis->zadd('zkey', 1000, "Test");

Message: Redis::zAdd(): bad type specifier while parsing parameters

Tried multiple combinations of keys, values, and scores..

error with LIST: protocol error, got '{' as reply type byte

Hi Nicolas,
I am trying to implement a Message Queue (job queue) using the master branch phpredis with latest redis, and working with LIST

Suppose my queue name is "queue:high". During the process of pushing and popping my test item (which is a json_encoded string) sometimes I get this RedisException

protocol error, got '{' as reply type byte

I unfortunately cannot find out exactly when this happen but my guess is it has to do with the 2 processes trying to pop one item from the list. That's actually the only thing I could think of

(My main worker loops indefinitely to pop items from the queue)

Please let me know if I need to provide anything else. Thank you Nicolas

blPop leaking memory

Hi,
We use redis to dispatch commands to worker processes based on lists (as queues).
The worker processes pop commands from lists in blocking mode.
The blPop command leaks memory heavily.

Please use following code snippet to reproduce the problem:
It is a consumer producer, just to showcase the bug.

Call the consumer from the command line and let it run.
Call the producer from the command line in parallel to the consumer.

You can see how the consumer (blPop) increases the memory usage until memory limit is reached.

Can't tell you the version of phpredis, it was a master checkout in february.

Best regards,
Patric

connect('10.10.0.1', 6379); while (true) { if ($r->lpush('queue', mt_rand(1,1232432342342)) > 10) usleep(500); echo "Memory used (".memory_get_usage().")\n"; } } public static function consumer() { $r = new Redis(); $r->connect('10.10.0.1', 6379); while (true) { $result = $r->blPop('queue', 1); // this bugs... echo "Memory used (".memory_get_usage().")\n"; } } ``` } ?>

subscribe Segment fault

code test.php
///

!/usr/bin/php -q

connect('127.0.0.1',6379); function channel($redis, $channel, $msg) { switch($channel) { case 'world': echo $msg . "\n"; break; case 'city': break; case 'union': break; case 'firend': break; } } $redis->subscribe(array('world', 'city', 'union', 'firend'), 'channel'); ?>

///
usage like ./test.php

the code like these under termial throw a Segment fault,is that a bug?

Extension segfaults when ->blPop() is called without the timeout argument

Steps to reproduce:

  1. Build and install the extension.
  2. Run the code below.
  3. Observe the warning and segfault.

Expected behavior: Just the warning.
Workaround: Call blPop() with the documented arguments.

The code:
<?php
$redis = new Redis();
$redis->connect('127.0.0.1', 6379);
$redis->blPop('test');

setlocale zadd issue

this will return error :

connect(redisServer); } catch (Exception $e) { die('please check that redis server at "'.redisServer.'" is up ! : '.$e->getMessage().''); } if(false === $redis->zAdd(redisPrefix.':test',0,'toto')) print 'error !'; else print 'ok !'; ?>

without setlocale all is nice

in redis-cli, monitor command show that the zadd command is send with good parameter

any help ?

Connect to multiple servers/slaves

Hi

It'd be really useful if we could specify more than 1 server to connect. and if one server is down, the client connects to the other server/fastest server.

Regards
Mojiz

zrange (withscores) and igbinary problem

$redis = new Redis();
$redis->connect( $host, $port );
$redis->setOption( Redis::OPT_SERIALIZER, Redis::SERIALIZER_IGBINARY );

$redis->zAdd( 'key',  102.40000000000001, (string)3188  );

$result = $redis->zRangeByScore( 'key', 0, 105, array('withscores' => TRUE) );

On last line i've got warning "igbinary_unserialize_header: unsupported version: 825242158, should be 1 or 2"

work with large massif of data

Hi. I have a task with handling large massif of data. I can get large count of keys (about million) by:

$keysList = $Redis->getKeys($somePattern);

Then I have to put it to a set. I can do it so only in very large cycle:

cicle {
$Redis->sAdd($setKey, $keyFromList);
}

So, I have to do it in cycle with million iterations. It's very very long!
Has it possible push data to set all together?

hmget should return NULL if a member key does not exist

When using hmget, if the key exists but the member key of the hash does not exist, the returned value for the member key is not NULL, but an empty string. This makes it impossible to distinguish between member keys that don't exist and member keys that have the value of an empty string.

Sort command, limit parameter

Hi,

i found a little issue with the Sort command today, involving the "limit" parameter.

When passed a String as either offset or count (array("0","4")), the function will ignore the limit parameter altogether. It's easy to reproduce, just run a sort command and pass it an offset or count as a String, while running MONITOR on Redis and you'll the the LIMIT param is missing from the command.

Is it an expected behavior of this function?

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.