{"id":1979,"date":"2011-08-25T23:10:00","date_gmt":"2011-08-25T23:10:00","guid":{"rendered":"https:\/\/supportex.net\/?p=1979"},"modified":"2019-05-10T19:51:48","modified_gmt":"2019-05-10T17:51:48","slug":"rpm-build-redis-library-package-php","status":"publish","type":"post","link":"https:\/\/supportex.net\/blog\/2011\/08\/rpm-build-redis-library-package-php\/","title":{"rendered":"RPM: how to build Redis library package for PHP"},"content":{"rendered":"<p>At Supportex we use Redis a lot. It&#8217;s extremely fast and doesn&#8217;t consume a lot of resources.&nbsp; Besides it&#8217;s easy to use for developers (especially for those who worked with Memcache). Unlike Python which has only one mature <a href=\"https:\/\/github.com\/andymccurdy\/redis-py\">client<\/a>, PHP has various of them. &nbsp;For instance, <a href=\"https:\/\/github.com\/nrk\/predis\">Predis<\/a>, <a href=\"https:\/\/github.com\/nicolasff\/phpredis\">phpredis<\/a>, &nbsp;<a href=\"https:\/\/github.com\/Shumkov\/Rediska\">Rediska<\/a>, etc. We prefer phpredis. It&#8217;s written in C and that is a better way to go. Now it is being developed &nbsp;by Nicolas Favre-Felix.<\/p>\n<p>If you use rpm-based system like Fedora or Centos you definitely should install it from rpm. Here is what you need to do. &nbsp;I assume that you already have rpmbuild environment.<\/p>\n<p><a href=\"https:\/\/github.com\/nicolasff\/phpredis\/archives\/master\">Download<\/a> last version of library to SOURCES directory.<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">wget -O nicolasff-phpredis-2.1.3-20-g9e1d068.tar.gz https:\/\/github.com\/nicolasff\/phpredis\/archives\/master<\/code><\/p>\n<p><em>Note that version nicolasff-phpredis-2.1.3-20-g9e1d068 was the last at the time of writing and you probably will need to change its name<\/em>.<\/p>\n<p>Download .spec file to SPECS directory:<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">wget -O php-redis.spec https:\/\/raw.github.com\/nicolasff\/phpredis\/master\/rpm\/php-redis.spec<\/code><\/p>\n<p>Change Source0 and setup lines to your tarball name:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">Source0: nicolasff-phpredis-2.1.3-20-g9e1d068.tar.gz\n%setup -q -n nicolasff-phpredis-9e1d068<\/pre>\n<p>Run rpmbuild:<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">rpmbuild -bb ~\/rpmbuild\/SPECS\/redis-php.spec<\/code><\/p>\n<p>If there are no errors, you will get RPM package:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">[builder@playground ~]$ ls -l ~\/rpmbuild\/RPMS\/x86_64\/<\/pre>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">-rw-rw-r-- 1 builder&nbsp;builder 224184 Aug 25 12:14 php-redis-2.1.3-1.fc15.x86_64.rpm\n[builder@playground ~]$<\/pre>\n<p>Install it:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">[root@playground ~]# rpm -ivh \/home\/builder\/rpmbuild\/RPMS\/x86_64\/php-redis-2.1.3-1.fc15.x86_64.rpm\nPreparing... ########################################### [100%]\n1:php-redis ########################################### [100%]\n[root@playground ~]#<\/pre>\n<p>And use:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">&amp;amp;amp;lt;?php $redis = new Redis(); \n$redis-&amp;amp;amp;gt;\npconnect('127.0.0.1', 6379);\necho $redis-&amp;amp;amp;gt;\nping(), \"n\"; \n?&amp;amp;amp;gt;<\/pre>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">[web@playground ~]$ php -f redis.php\n+PONG\n[web@playground ~]$<\/pre>\n<p><strong>Didn&#8217;t find the answer to your question? <a href=\"\/contacts\/\">Ask it<\/a> our administrators to reply we will publish on website.<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>At Supportex we use Redis a lot. It&#8217;s extremely fast and doesn&#8217;t consume a lot of resources.&nbsp; Besides it&#8217;s easy to use for developers (especially for those who worked with Memcache). Unlike Python which has only one mature client, PHP has various of them. &nbsp;For instance, Predis, phpredis, &nbsp;Rediska, etc. We prefer phpredis. It&#8217;s written&hellip; <\/p>\n<div class=\"readmore-wrapper\"><a href=\"https:\/\/supportex.net\/blog\/2011\/08\/rpm-build-redis-library-package-php\/\" class=\"more-link\">Read <\/a><\/div>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[152],"tags":[275,238,233],"class_list":["post-1979","post","type-post","status-publish","format-standard","hentry","category-linux","tag-linux","tag-php-en","tag-redis-en"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>RPM: how to build Redis library package for PHP &#8211; Supportex.NET blog<\/title>\n<meta name=\"description\" content=\"How to build Redis RPM library package for PHP\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/supportex.net\/blog\/2011\/08\/rpm-build-redis-library-package-php\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"RPM: how to build Redis library package for PHP &#8211; Supportex.NET blog\" \/>\n<meta property=\"og:description\" content=\"How to build Redis RPM library package for PHP\" \/>\n<meta property=\"og:url\" content=\"https:\/\/supportex.net\/blog\/2011\/08\/rpm-build-redis-library-package-php\/\" \/>\n<meta property=\"og:site_name\" content=\"Supportex.NET blog\" \/>\n<meta property=\"article:published_time\" content=\"2011-08-25T23:10:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-05-10T17:51:48+00:00\" \/>\n<meta name=\"author\" content=\"Oleksii Tykhonov\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Oleksii Tykhonov\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/supportex.net\/blog\/2011\/08\/rpm-build-redis-library-package-php\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/supportex.net\/blog\/2011\/08\/rpm-build-redis-library-package-php\/\"},\"author\":{\"name\":\"Oleksii Tykhonov\",\"@id\":\"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/0690c26a0266603129fc15eae6243251\"},\"headline\":\"RPM: how to build Redis library package for PHP\",\"datePublished\":\"2011-08-25T23:10:00+00:00\",\"dateModified\":\"2019-05-10T17:51:48+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/supportex.net\/blog\/2011\/08\/rpm-build-redis-library-package-php\/\"},\"wordCount\":205,\"commentCount\":0,\"keywords\":[\"linux\",\"php\",\"redis\"],\"articleSection\":[\"linux\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/supportex.net\/blog\/2011\/08\/rpm-build-redis-library-package-php\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/supportex.net\/blog\/2011\/08\/rpm-build-redis-library-package-php\/\",\"url\":\"https:\/\/supportex.net\/blog\/2011\/08\/rpm-build-redis-library-package-php\/\",\"name\":\"RPM: how to build Redis library package for PHP &#8211; Supportex.NET blog\",\"isPartOf\":{\"@id\":\"https:\/\/supportex.net\/blog\/en\/#website\"},\"datePublished\":\"2011-08-25T23:10:00+00:00\",\"dateModified\":\"2019-05-10T17:51:48+00:00\",\"author\":{\"@id\":\"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/0690c26a0266603129fc15eae6243251\"},\"description\":\"How to build Redis RPM library package for PHP\",\"breadcrumb\":{\"@id\":\"https:\/\/supportex.net\/blog\/2011\/08\/rpm-build-redis-library-package-php\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/supportex.net\/blog\/2011\/08\/rpm-build-redis-library-package-php\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/supportex.net\/blog\/2011\/08\/rpm-build-redis-library-package-php\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/supportex.net\/blog\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"RPM: how to build Redis library package for PHP\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/supportex.net\/blog\/en\/#website\",\"url\":\"https:\/\/supportex.net\/blog\/en\/\",\"name\":\"Supportex.NET blog\",\"description\":\"Server and network management company\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/supportex.net\/blog\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/0690c26a0266603129fc15eae6243251\",\"name\":\"Oleksii Tykhonov\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/4fd5f58002717075c88963469b9babef?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/4fd5f58002717075c88963469b9babef?s=96&d=mm&r=g\",\"caption\":\"Oleksii Tykhonov\"},\"url\":\"https:\/\/supportex.net\/blog\/author\/oleksiitykhonov\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"RPM: how to build Redis library package for PHP &#8211; Supportex.NET blog","description":"How to build Redis RPM library package for PHP","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/supportex.net\/blog\/2011\/08\/rpm-build-redis-library-package-php\/","og_locale":"en_US","og_type":"article","og_title":"RPM: how to build Redis library package for PHP &#8211; Supportex.NET blog","og_description":"How to build Redis RPM library package for PHP","og_url":"https:\/\/supportex.net\/blog\/2011\/08\/rpm-build-redis-library-package-php\/","og_site_name":"Supportex.NET blog","article_published_time":"2011-08-25T23:10:00+00:00","article_modified_time":"2019-05-10T17:51:48+00:00","author":"Oleksii Tykhonov","twitter_misc":{"Written by":"Oleksii Tykhonov","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/supportex.net\/blog\/2011\/08\/rpm-build-redis-library-package-php\/#article","isPartOf":{"@id":"https:\/\/supportex.net\/blog\/2011\/08\/rpm-build-redis-library-package-php\/"},"author":{"name":"Oleksii Tykhonov","@id":"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/0690c26a0266603129fc15eae6243251"},"headline":"RPM: how to build Redis library package for PHP","datePublished":"2011-08-25T23:10:00+00:00","dateModified":"2019-05-10T17:51:48+00:00","mainEntityOfPage":{"@id":"https:\/\/supportex.net\/blog\/2011\/08\/rpm-build-redis-library-package-php\/"},"wordCount":205,"commentCount":0,"keywords":["linux","php","redis"],"articleSection":["linux"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/supportex.net\/blog\/2011\/08\/rpm-build-redis-library-package-php\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/supportex.net\/blog\/2011\/08\/rpm-build-redis-library-package-php\/","url":"https:\/\/supportex.net\/blog\/2011\/08\/rpm-build-redis-library-package-php\/","name":"RPM: how to build Redis library package for PHP &#8211; Supportex.NET blog","isPartOf":{"@id":"https:\/\/supportex.net\/blog\/en\/#website"},"datePublished":"2011-08-25T23:10:00+00:00","dateModified":"2019-05-10T17:51:48+00:00","author":{"@id":"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/0690c26a0266603129fc15eae6243251"},"description":"How to build Redis RPM library package for PHP","breadcrumb":{"@id":"https:\/\/supportex.net\/blog\/2011\/08\/rpm-build-redis-library-package-php\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/supportex.net\/blog\/2011\/08\/rpm-build-redis-library-package-php\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/supportex.net\/blog\/2011\/08\/rpm-build-redis-library-package-php\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/supportex.net\/blog\/en\/"},{"@type":"ListItem","position":2,"name":"RPM: how to build Redis library package for PHP"}]},{"@type":"WebSite","@id":"https:\/\/supportex.net\/blog\/en\/#website","url":"https:\/\/supportex.net\/blog\/en\/","name":"Supportex.NET blog","description":"Server and network management company","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/supportex.net\/blog\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/0690c26a0266603129fc15eae6243251","name":"Oleksii Tykhonov","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/4fd5f58002717075c88963469b9babef?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4fd5f58002717075c88963469b9babef?s=96&d=mm&r=g","caption":"Oleksii Tykhonov"},"url":"https:\/\/supportex.net\/blog\/author\/oleksiitykhonov\/"}]}},"_links":{"self":[{"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/posts\/1979","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/comments?post=1979"}],"version-history":[{"count":5,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/posts\/1979\/revisions"}],"predecessor-version":[{"id":3206,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/posts\/1979\/revisions\/3206"}],"wp:attachment":[{"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/media?parent=1979"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/categories?post=1979"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/tags?post=1979"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}