|
| 1 | +# Installation from pecl |
| 2 | + |
| 3 | +To pull latest stable released version, from [pecl](https://pecl.php.net/package/redis): |
| 4 | + |
| 5 | +~~~ |
| 6 | +pecl install redis |
| 7 | +~~~ |
| 8 | + |
| 9 | +# Installation from sources |
| 10 | + |
| 11 | +To build this extension for the sources tree: |
| 12 | + |
| 13 | +~~~ |
| 14 | +phpize |
| 15 | +./configure [--enable-redis-igbinary] |
| 16 | +make && make install |
| 17 | +~~~ |
| 18 | + |
| 19 | +If you would like phpredis to serialize your data using the igbinary library, run configure with `--enable-redis-igbinary`. |
| 20 | +`make install` copies `redis.so` to an appropriate location, but you still need to enable the module in the PHP config file. To do so, either edit your php.ini or add a redis.ini file in `/etc/php5/conf.d` with the following contents: `extension=redis.so`. |
| 21 | + |
| 22 | +You can generate a debian package for PHP5, accessible from Apache 2 by running `./mkdeb-apache2.sh` or with `dpkg-buildpackage` or `svn-buildpackage`. |
| 23 | + |
| 24 | +This extension exports a single class, [Redis](#class-redis) (and [RedisException](#class-redisexception) used in case of errors). Check out https://github.com/ukko/phpredis-phpdoc for a PHP stub that you can use in your IDE for code completion. |
| 25 | + |
| 26 | + |
| 27 | +# Binary packages |
| 28 | + |
| 29 | +Most distributions provides pre-build binary packages of this extension. |
| 30 | + |
| 31 | +## Windows: |
| 32 | + |
| 33 | +Follow the DLL link on the [https://pecl.php.net/package/redis](https://pecl.php.net/package/redis) page. |
| 34 | + |
| 35 | +## Fedora |
| 36 | + |
| 37 | +Fedora users can install the package from the official repositor. |
| 38 | + |
| 39 | +**Fedora ≤ 28, Version 3 ** |
| 40 | + |
| 41 | +Installation of the [php-pecl-redis](https://apps.fedoraproject.org/packages/php-pecl-redis) package: |
| 42 | + |
| 43 | +~~~ |
| 44 | +dnf install php-pecl-redis |
| 45 | +~~~ |
| 46 | + |
| 47 | +**Fedora ≥ 27, Version 4 ** |
| 48 | + |
| 49 | +Installation of the [php-pecl-redis4](https://apps.fedoraproject.org/packages/php-pecl-redis4) package: |
| 50 | + |
| 51 | +~~~ |
| 52 | +dnf install php-pecl-redis4 |
| 53 | +~~~ |
| 54 | + |
| 55 | +## RHEL / CentOS |
| 56 | + |
| 57 | +Installation of the [php-pecl-redis](https://apps.fedoraproject.org/packages/php-pecl-redis) package, from the [EPEL repository](https://fedoraproject.org/wiki/EPEL): |
| 58 | + |
| 59 | +~~~ |
| 60 | +yum install php-pecl-redis |
| 61 | +~~~ |
| 62 | + |
| 63 | + |
| 64 | +# Installation on OSX |
| 65 | + |
| 66 | +If the install fails on OSX, type the following commands in your shell before trying again: |
| 67 | +~~~ |
| 68 | +MACOSX_DEPLOYMENT_TARGET=10.6 |
| 69 | +CFLAGS="-arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp" |
| 70 | +CCFLAGS="-arch i386 -arch x86_64 -g -Os -pipe" |
| 71 | +CXXFLAGS="-arch i386 -arch x86_64 -g -Os -pipe" |
| 72 | +LDFLAGS="-arch i386 -arch x86_64 -bind_at_load" |
| 73 | +export CFLAGS CXXFLAGS LDFLAGS CCFLAGS MACOSX_DEPLOYMENT_TARGET |
| 74 | +~~~ |
| 75 | + |
| 76 | +If that still fails and you are running Zend Server CE, try this right before "make": `./configure CFLAGS="-arch i386"`. |
| 77 | + |
| 78 | +Taken from [Compiling phpredis on Zend Server CE/OSX ](http://www.tumblr.com/tagged/phpredis). |
| 79 | + |
| 80 | +See also: [Install Redis & PHP Extension PHPRedis with Macports](http://www.lecloud.net/post/3378834922/install-redis-php-extension-phpredis-with-macports). |
| 81 | + |
| 82 | +You can install it using Homebrew: |
| 83 | + |
| 84 | +- [Get homebrew-php](https://github.com/Homebrew/homebrew-php) |
| 85 | +- `brew install php55-redis` (or php53-redis, php54-redis) |
| 86 | + |
| 87 | +# Building on Windows |
| 88 | + |
| 89 | +See [instructions from @char101](https://github.com/phpredis/phpredis/issues/213#issuecomment-11361242) on how to build phpredis on Windows. |
| 90 | + |
0 commit comments