{"id":5828,"date":"2021-09-30T13:25:41","date_gmt":"2021-09-30T04:25:41","guid":{"rendered":"https:\/\/www.sria.co.jp\/blog\/?p=5828"},"modified":"2021-09-30T09:31:50","modified_gmt":"2021-09-30T00:31:50","slug":"5828","status":"publish","type":"post","link":"https:\/\/www.sria.co.jp\/blog\/2021\/09\/5828\/","title":{"rendered":"AppService on Linux\u4e0a\u3067PHP\u306e\u30bb\u30c3\u30b7\u30e7\u30f3\u7ba1\u7406\u3092Azure Cache for Redis\u3067\u884c\u3046"},"content":{"rendered":"<p>Azure Cache for Redis\u3067PHP\u306e\u30bb\u30c3\u30b7\u30e7\u30f3\u7ba1\u7406\u3092\u884c\u3046\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<ol>\n<li>AppService\u4e0a\u306ePHP\u30a2\u30d7\u30ea\u3067\u306e\u30bb\u30c3\u30b7\u30e7\u30f3\u7ba1\u7406\u306b\u3064\u3044\u3066<\/li>\n<li>AppService\u306bPHPRedis\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/li>\n<li>PHP\u306e\u30bb\u30c3\u30b7\u30e7\u30f3\u306e\u8a2d\u5b9a\u3092\u5909\u66f4<\/li>\n<li>\u307e\u3068\u3081<\/li>\n<\/ol>\n<h2>1. AppService\u4e0a\u306ePHP\u30a2\u30d7\u30ea\u3067\u306e\u30bb\u30c3\u30b7\u30e7\u30f3\u7ba1\u7406\u306b\u3064\u3044\u3066<\/h2>\n<p>Azure\u306eAppService on Linux\u4e0a\u306ePHP\u30a2\u30d7\u30ea\u3067\u30bb\u30c3\u30b7\u30e7\u30f3\u7ba1\u7406\u3092\u3057\u3088\u3046\u3068\u3059\u308b\u3068\u3001<\/p>\n<ul>\n<li>\u30b9\u30b1\u30fc\u30eb\u30a2\u30a6\u30c8\u6642<\/li>\n<li>\u30c7\u30d7\u30ed\u30a4\u306a\u3069\u306e\u518d\u8d77\u52d5\u6642<\/li>\n<\/ul>\n<p>\u306b\u30bb\u30c3\u30b7\u30e7\u30f3\u304c\u7834\u68c4\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u305d\u306e\u305f\u3081\u3001\u53b3\u5bc6\u306b\u30bb\u30c3\u30b7\u30e7\u30f3\u3092\u7ba1\u7406\u3059\u308b\u5834\u5408\u3001Redis\u306a\u3069\u306e\u5916\u90e8\u30b9\u30c8\u30ec\u30fc\u30b8\u3092\u4f7f\u7528\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<h2>2. AppService\u306bPHPRedis\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h2>\n<p>AppService on Linux\u3067\u306f\u3001pecl\u3092\u4f7f\u3048\u308b\u306e\u3067\u3053\u308c\u3067PHPRedis\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-plain\" data-lang=\"Plain Text\"><code># pecl install redis\nCannot load Zend OPcache - it was already loaded\ndownloading redis-5.3.4.tgz ...\nStarting to download redis-5.3.4.tgz (268,154 bytes)\n........................................................done: 268,154 bytes\n29 source files, building\n\n\/\/ ... \u7565\n\nconfig.status: creating config.h\nrunning: make\n\/bin\/bash \/tmp\/pear\/temp\/pear-build-rootA3nVEX\/redis-5.3.4\/libtool --mode=compile cc -I. -I\/tmp\/pear\/temp\/redis -I\/tmp\/pear\/temp\/pear-build-rootA3nVEX\/redis-5.3.4\/include -I\/tmp\/pear\/temp\/pear-bui\nld-rootA3nVEX\/redis-5.3.4\/main -I\/tmp\/pear\/temp\/redis -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\/ex\nt -I\/usr\/local\/include\/php\/ext\/date\/lib -I\/usr\/local\/include\/php\/ext -DHAVE_CONFIG_H -g -O2 -c \/tmp\/pear\/temp\/redis\/redis.c -o redis.lo\nmkdir .libs\ncc -I. -I\/tmp\/pear\/temp\/redis -I\/tmp\/pear\/temp\/pear-build-rootA3nVEX\/redis-5.3.4\/include -I\/tmp\/pear\/temp\/pear-build-rootA3nVEX\/redis-5.3.4\/main -I\/tmp\/pear\/temp\/redis -I\/usr\/local\/include\/php -I\n\/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 -I\/usr\/local\/include\/php\/ext -DHAVE_CONFI\nG_H -g -O2 -c \/tmp\/pear\/temp\/redis\/redis.c -fPIC -DPIC -o .libs\/redis.o\n\/tmp\/pear\/temp\/redis\/redis.c:22:10: fatal error: config.h: No such file or directory\n#include \"config.h\"\n^~~~~~~~~~\ncompilation terminated.\nmake: *** [Makefile:209: redis.lo] Error 1\nERROR: `make' failed<\/code><\/pre>\n<\/div>\n<p>\u4e0a\u8a18\u306e\u3088\u3046\u306b\u30a8\u30e9\u30fc\u304c\u51fa\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u3002<\/p>\n<p>\u4ee5\u4e0b\u306eURL\u306bpecl\u3067PHPRedis\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u6642\u306b\u30a8\u30e9\u30fc\u304c\u51fa\u305f\u5834\u5408\u306e\u5bfe\u51e6\u6cd5\u304c\u3042\u3063\u305f\u306e\u3067\u3001\u3053\u3061\u3089\u3067PHPRedis\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/docs.microsoft.com\/en-us\/answers\/questions\/252433\/still-not-possible-to-build-redisso-under-php-74-u.html\">https:\/\/docs.microsoft.com\/en-us\/answers\/questions\/252433\/still-not-possible-to-build-redisso-under-php-74-u.html<\/a><\/p>\n<p>\u624b\u52d5\u3067PHPRedis\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-plain\" data-lang=\"Plain Text\"><code># mkdir \/tmp\/pear\/temp\n# cd \/tmp\/pear\/temp<\/code><\/pre>\n<\/div>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-plain\" data-lang=\"Plain Text\"><code># pecl bundle redis\nCannot load Zend OPcache - it was already loaded\ndownloading redis-5.3.4.tgz ...\nStarting to download redis-5.3.4.tgz (268,154 bytes)\n........................................................done: 268,154 bytes\nPackage ready at '\/tmp\/pear\/temp\/redis'<\/code><\/pre>\n<\/div>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-plain\" data-lang=\"Plain Text\"><code># cd redis\n# phpize\nConfiguring for:\nPHP Api Version: 20200930\nZend Module Api No: 20200930\nZend Extension Api No: 420200930<\/code><\/pre>\n<\/div>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-plain\" data-lang=\"Plain Text\"><code># .\/configure --with-php-config=\/usr\/local\/bin\/php-config --enable-redis-igbinary=no --enable-redis-lzf=no --enable-redis-zstd=no\nchecking for grep that handles long lines and -e... \/bin\/grep\nchecking for egrep... \/bin\/grep -E\nchecking for a sed that does not truncate output... \/bin\/sed\nchecking for pkg-config... \/usr\/bin\/pkg-config\n<\/code>checking whether to build static libraries... no <code><\/code>creating libtool appending configuration tag \"CXX\" to libtool configure: patching config.h.in configure: creating .\/config.status config.status: creating config.h<\/pre>\n<\/div>\n<div class=\"hcb_wrap\">\n<pre># make \n\n\/\/ ... \u7565\n\n----------------------------------------------------------------------\nLibraries have been installed in:\n\/tmp\/pear\/temp\/redis\/modules\n\nIf you ever happen to want to link against installed libraries\nin a given directory, LIBDIR, you must either use libtool, and\nspecify the full pathname of the library, or use the `-LLIBDIR'\nflag during linking and do at least one of the following:\n- add LIBDIR to the `LD_LIBRARY_PATH' environment variable\nduring execution\n- add LIBDIR to the `LD_RUN_PATH' environment variable\nduring linking\n- use the `-Wl,--rpath -Wl,LIBDIR' linker flag\n- have your system administrator add LIBDIR to `\/etc\/ld.so.conf'\n\nSee any operating system documentation about shared libraries for\nmore information, such as the ld(1) and ld.so(8) manual pages.\n----------------------------------------------------------------------\n\nBuild complete.\nDon't forget to run 'make test'.<\/pre>\n<\/div>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-plain\" data-lang=\"Plain Text\"><code># mkdir -p \/home\/site\/ext \n# cp \/tmp\/pear\/temp\/redis\/modules\/<span class=\"s1\">redis.so<\/span>\u00a0\/home\/site\/ext\/<span class=\"s1\">redis.so<\/span> \n# mkdir -p \/home\/site\/ini \n# echo \"extension=\/home\/site\/ext\/<span class=\"s1\">redis.so<\/span>\" &gt;&gt; \/home\/site\/ini\/extensions.ini\n<\/code><\/pre>\n<\/div>\n<p>\u6700\u5f8c\u306b\u3001AppService\u306e\u30dd\u30fc\u30bf\u30eb\u306e\u300c\u69cb\u6210\u300d\u304b\u3089\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u8a2d\u5b9a\u306b<\/p>\n<p>\u540d\u524d\uff1aPHP_INI_SCAN_DIR<\/p>\n<p>\u5024\uff1a\/usr\/local\/etc\/php\/conf.d:\/home\/site\/ini<\/p>\n<p>\u3092\u8ffd\u52a0\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><a href=\"https:\/\/www.sria.co.jp\/blog\/wp-content\/uploads\/2021\/09\/b53790e848f4366e417baa154ef746ea.png\"><img loading=\"lazy\" src=\"https:\/\/www.sria.co.jp\/blog\/wp-content\/uploads\/2021\/09\/b53790e848f4366e417baa154ef746ea-300x60.png\" alt=\"\" width=\"300\" height=\"60\" class=\"alignnone size-medium wp-image-5830\" srcset=\"https:\/\/www.sria.co.jp\/blog\/wp-content\/uploads\/2021\/09\/b53790e848f4366e417baa154ef746ea-300x60.png 300w, https:\/\/www.sria.co.jp\/blog\/wp-content\/uploads\/2021\/09\/b53790e848f4366e417baa154ef746ea-1024x205.png 1024w, https:\/\/www.sria.co.jp\/blog\/wp-content\/uploads\/2021\/09\/b53790e848f4366e417baa154ef746ea-768x154.png 768w, https:\/\/www.sria.co.jp\/blog\/wp-content\/uploads\/2021\/09\/b53790e848f4366e417baa154ef746ea.png 1185w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<h2>3. PHP\u306e\u30bb\u30c3\u30b7\u30e7\u30f3\u306e\u8a2d\u5b9a\u3092\u5909\u66f4<\/h2>\n<p>PHP\u306e\u30bb\u30c3\u30b7\u30e7\u30f3\u7ba1\u7406\u3092Redis\u3067\u884c\u3046\u3088\u3046\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<p>PHP\u30a2\u30d7\u30ea\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u76f4\u4e0b\u306b.user.ini\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3001\u305d\u3053\u306b\u8a2d\u5b9a\u3092\u8a18\u8ff0\u3057\u307e\u3059\u3002<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-plain\" data-lang=\"Plain Text\">session.save_handler = redis;\nsession.save_path = \"tls:\/\/{Redis\u306e\u30db\u30b9\u30c8\u540d}.redis.cache.windows.net:6380?auth=${REDIS_AUTH}\";<\/pre>\n<\/div>\n<p>${REDIS_AUTH}\u3067\u74b0\u5883\u5909\u6570\u3092\u53c2\u7167\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>${REDIS_AUTH}\u306b\u5f53\u3066\u306f\u307e\u308b\u90e8\u5206\u306f\u3001Azure Cache for Redis\u306e\u30dd\u30fc\u30bf\u30eb\u306e\u300c\u30a2\u30af\u30bb\u30b9\u30ad\u30fc\u300d\u306e\u300c\u30d7\u30e9\u30a4\u30de\u30ea\u30ad\u30fc\u300d\u3092URL\u30a8\u30f3\u30b3\u30fc\u30c9\u3057\u305f\u5024\u3092\u74b0\u5883\u5909\u6570\u306b\u8a2d\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u4ee5\u4e0a\u3067\u3001Azure Cache for Redis\u3092\u4f7f\u7528\u3057\u305f\u30bb\u30c3\u30b7\u30e7\u30f3\u7ba1\u7406\u3092\u884c\u3048\u307e\u3059\u3002<\/p>\n<h2>4. \u307e\u3068\u3081<\/h2>\n<p>AppService\u3067\u306f\u3001\u30b9\u30b1\u30fc\u30eb\u30a2\u30a6\u30c8\u6642\u3084\u30c7\u30d7\u30ed\u30a4\u6642\u306b\u30bb\u30c3\u30b7\u30e7\u30f3\u306f\u7834\u68c4\u3055\u308c\u307e\u3059\u304c\u3001\u30bb\u30c3\u30b7\u30e7\u30f3\u306e\u7834\u68c4\u3092\u8a31\u5bb9\u3067\u304d\u308b\u306a\u3089\u308f\u3056\u308f\u3056Redis\u3067\u7ba1\u7406\u3059\u308b\u5fc5\u8981\u304c\u306a\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n<p>\u53b3\u5bc6\u306b\u30bb\u30c3\u30b7\u30e7\u30f3\u7ba1\u7406\u3092\u884c\u3044\u305f\u3044\u5834\u5408\u306fRedis\u3067\u7ba1\u7406\u3059\u308b\u3053\u3068\u3092\u304a\u52e7\u3081\u3057\u307e\u3059\u3002<\/p>\n<h2>\u53c2\u8003<\/h2>\n<p><a href=\"https:\/\/docs.microsoft.com\/en-us\/answers\/questions\/252433\/still-not-possible-to-build-redisso-under-php-74-u.html\">https:\/\/docs.microsoft.com\/en-us\/answers\/questions\/252433\/still-not-possible-to-build-redisso-under-php-74-u.html<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Azure Cache for Redis\u3067PHP\u306e\u30bb\u30c3\u30b7\u30e7\u30f3\u7ba1\u7406\u3092\u884c\u3046\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002 AppService\u4e0a\u306ePHP\u30a2\u30d7\u30ea\u3067\u306e\u30bb\u30c3\u30b7\u30e7\u30f3\u7ba1\u7406\u306b\u3064\u3044\u3066 AppService\u306bPHPRedis\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb PHP\u306e\u30bb&#8230;<\/p>\n","protected":false},"author":5,"featured_media":4718,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[178,8],"tags":[260,159,50,259],"_links":{"self":[{"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/posts\/5828"}],"collection":[{"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/comments?post=5828"}],"version-history":[{"count":30,"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/posts\/5828\/revisions"}],"predecessor-version":[{"id":6043,"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/posts\/5828\/revisions\/6043"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/media\/4718"}],"wp:attachment":[{"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/media?parent=5828"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/categories?post=5828"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/tags?post=5828"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}