{"id":5560,"date":"2022-10-19T23:22:33","date_gmt":"2022-10-19T14:22:33","guid":{"rendered":"https:\/\/kumapress.com\/?p=5560"},"modified":"2022-10-22T03:25:36","modified_gmt":"2022-10-21T18:25:36","slug":"ubuntu20%ef%bc%8bphp7-4%e3%81%aboci8%e3%82%92%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/kumapress.com\/?p=5560","title":{"rendered":"Ubuntu20\uff0bPHP7.4\u306bOCI8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b"},"content":{"rendered":"\n\n<p>PHP7.4\u304b\u3089oci8\u306e\u4f7f\u7528\u3059\u308b\u305f\u3081\u306e\u74b0\u5883\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<br>\u5185\u5bb9\u3068\u3057\u3066\u306f\u300c<a href=\"https:\/\/gist.github.com\/eSkiSo\/781269c79b4dd740e90fcc059c1985ae\" target=\"_blank\" rel=\"noopener\">Install OCI8 on Ubuntu 20.04 with PHP 7.4<\/a>\u300d\u3092\u307b\u307c\u305d\u306e\u307e\u307e\u8e0f\u8972\u3057\u3066\u3044\u307e\u3059\u3002<br>\u305f\u3060\u3001\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306e\u9014\u4e2d\u3067PHP8\u306b\u5909\u308f\u3063\u3066\u3057\u307e\u3046\u306e\u3067\u3001PHP7.4\u306b\u623b\u3059\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<br>\u305d\u306e\u3042\u305f\u308a\u3092\u8ffd\u8a18\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n<h2 class=\"wp-block-heading\">\uff11\uff09Client\u3068SDK\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u307e\u3059\u3002<\/h2>\n\n\n\n<p>\u3053\u3061\u3089\u3088\u308a\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u307e\u3059\u3002<br>\u300cOracle Instant Client Downloads for Linux x86-64 (64-bit)\u300d<br>\u30fbBasic Package\uff1a <a class=\"o-hf\" href=\"https:\/\/download.oracle.com\/otn_software\/linux\/instantclient\/217000\/instantclient-basic-linux.x64-21.7.0.0.0dbru.zip\">instantclient-basic-linux.x64-21.7.0.0.0dbru.zip<\/a><br>\u30fbSDK Package\uff1a <a class=\"o-hf\" href=\"https:\/\/download.oracle.com\/otn_software\/linux\/instantclient\/217000\/instantclient-sdk-linux.x64-21.7.0.0.0dbru.zip\">instantclient-sdk-linux.x64-21.7.0.0.0dbru.zip<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\uff12\uff09\u4f5c\u696d\u5834\u6240\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/h2>\n\n\n\n<p>\u203b\u3053\u3053\u304b\u3089\u306froot\u3068\u3057\u3066\u4f5c\u696d\u3057\u307e\u3059\u3002<br># mkdir \/usr\/lib\/oracle<br># mkdir \/usr\/lib\/oracle\/21.1<br># mkdir \/usr\/lib\/oracle\/21.1\/client64<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\uff13\uff09\u89e3\u51cd\u3057\u307e\u3059\u3002<\/h2>\n\n\n<p># cp instantclient-basic-linux.x64-21.7.0.0.0.zip \/usr\/lib\/oracle\/21.1\/client64<br># cp instantclient-sdk-linux.x64-21.7.0.0.0.zip \/usr\/lib\/oracle\/21.1\/client64<\/p>\n<p># cd \/usr\/lib\/oracle\/21.1\/client64<\/p>\n<p># unzip instantclient-basic-linux.x64-21.7.0.0.0.zip<br># unzip instantclient-sdk-linux.x64-21.7.0.0.0.zip<\/p>\n<p># mv instantclient_21_7 lib<\/p>\n\n\n\n\n<h2 class=\"wp-block-heading\">\uff14\uff09\u30b7\u30f3\u30dc\u30ea\u30c3\u30af\u30ea\u30f3\u30af\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/h2>\n\n\n<p>\u30b7\u30f3\u30dc\u30ea\u30c3\u30af\u30ea\u30f3\u30af\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u305f\u3089\u4e0b\u8a18\u306e\u4f5c\u696d\u306f\u4e0d\u8981\u3067\u3059\u3002<br># cd \/usr\/lib\/oracle\/21.1\/client64\/lib\/ <br># ln -s libclntsh.so.21.1 libclntsh.so<br># ln -s libocci.so.21.1 libocci.so<\/p>\n\n\n<h2 class=\"wp-block-heading\">\uff15\uff09\u30d1\u30b9\u306b\u30d5\u30a1\u30a4\u30eb\u3092\u8a2d\u5b9a\u3057,\u53cd\u6620\u3059\u308b<\/h2>\n\n\n<p># echo \/usr\/lib\/oracle\/21.1\/client64\/lib &gt; \/etc\/ld.so.conf.d\/oracle.conf<br># ldconfig<\/p>\n\n\n<h2 class=\"wp-block-heading\">\uff16\uff09PHP\u74b0\u5883\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b<\/h2>\n\n\n<p># apt install php-dev php-pear build-essential libaio1<br>\u3053\u306e\u3042\u3068\u3001php\u304cphp8\u306b\u306a\u3063\u3066\u3057\u307e\u3046\u305f\u3081\u3001PHP7.4\u306b\u623b\u3059<br># apt install php7.4-dev<br># update-alternatives &#8211;set phpize \/usr\/bin\/phpize7.4<br># update-alternatives &#8211;set php \/usr\/bin\/php7.4<br># update-alternatives &#8211;set php-config \/usr\/bin\/php-config7.4<br>\u203bphp7.4\u3060\u3051\u3060\u3068\u3001OCI8\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067make\u30a8\u30e9\u30fc\u3068\u306a\u308b\u3002<br># ls -al \/etc\/alternatives\/php-config<br>\/etc\/alternatives\/php-config -&gt; \/usr\/bin\/php-config7.4<br># ls -al \/etc\/alternatives\/php<br>\/etc\/alternatives\/php -&gt; \/usr\/bin\/php7.4<br># ls -al \/etc\/alternatives\/phpize<br>\/etc\/alternatives\/phpize -&gt; \/usr\/bin\/phpize7.4<\/p>\n\n\n<h2 class=\"wp-block-heading\">\uff17\uff09OCI8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b<\/h2>\n\n\n<p>\u30fbPECL\u3092\u66f4\u65b0\u3059\u308b<br># pecl channel-update pecl.php.net<br>Updating channel &#8220;pecl.php.net&#8221;<br>Update of Channel &#8220;pecl.php.net&#8221; succeeded<br>\u30fbOCI8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b<br>PHP7.x\u306e\u5834\u5408\u306f\u3000#&nbsp;pecl install oci8-2.2.0<br>PHP8.x\u306e\u5834\u5408\u306f\u3000# pecl install oci8<\/p>\n<p>Instant Client\u3078\u306e\u30d1\u30b9\u304c\u8981\u6c42\u3055\u308c\u305f\u3068\u304d\u306f\u4e0b\u8a18\u3092\u5165\u529b\u3059\u308b<br>instantclient,\/usr\/lib\/oracle\/21.1\/client64\/lib<\/p>\n<p>\u3053\u3093\u306a\u7d50\u679c\u304c\u8868\u793a\u3055\u308c\u308b<br>Build process completed successfully<br>Installing &#8216;\/usr\/lib\/php\/20190902\/oci8.so&#8217;<br>install ok: channel:\/\/pecl.php.net\/oci8-2.2.0<br>configuration option &#8220;php_ini&#8221; is not set to php.ini location<br>You should add &#8220;extension=oci8.so&#8221; to php.ini<\/p>\n\n\n<h2 class=\"wp-block-heading\">\uff18\uff09Apache\u306b\u53cd\u6620\u3059\u308b<\/h2>\n\n\n<p># echo &#8220;extension=oci8.so&#8221; &gt;&gt; \/etc\/php\/7.4\/cli\/php.ini<br \/>php-fpm\u4f7f\u3063\u3066\u308b\u3068\u304d\u306f<br \/># echo &#8220;extension=oci8.so&#8221; &gt;&gt; \/etc\/php\/7.4\/fpm\/php.ini<br \/><br \/># systemctl restart apache2<\/p>\n\n\n<h2 class=\"wp-block-heading\">\uff19\uff09\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u8ffd\u52a0\u3059\u308b<\/h2>\n\n\n<p># cd \/etc\/php\/7.4\/mods-available\/<br># vi oci.ini\u3000\u65b0\u898f\u30d5\u30a1\u30a4\u30eb<br>\u4e0b\u8a18\u3092\u8ffd\u52a0\u3059\u308b<br>extension = oci8.so<\/p>\n\n\n<h2 class=\"wp-block-heading\">\uff11\uff10\uff09Apache\u306bini\u30d5\u30a1\u30a4\u30eb\u3092\u8ffd\u52a0\u3059\u308b<\/h2>\n\n\n<p># cd \/etc\/php\/7.4\/apache2\/conf.d<br \/>php-fpm\u4f7f\u3063\u3066\u308b\u3068\u304d\u306f<br \/># cd \/etc\/php\/7.4\/fpm\/conf.d<br \/><br \/># ln -s \/etc\/php\/7.4\/mods-available\/oci.ini 20-oci.ini<br \/># systemctl restart apache2<\/p>\n\n\n<h2 class=\"wp-block-heading\">\uff11\uff11\uff09\u78ba\u8a8d\u3059\u308b<\/h2>\n\n\n<p>$ php -i | grep oci<br>oci8<br>oci8.connection_class =&gt; no value =&gt; no value<br>oci8.default_prefetch =&gt; 100 =&gt; 100<br>oci8.events =&gt; Off =&gt; Off<br>oci8.max_persistent =&gt; -1 =&gt; -1<br>oci8.old_oci_close_semantics =&gt; Off =&gt; Off<br>oci8.persistent_timeout =&gt; -1 =&gt; -1<br>oci8.ping_interval =&gt; 60 =&gt; 60<br>oci8.privileged_connect =&gt; Off =&gt; Off<br>oci8.statement_cache_size =&gt; 20 =&gt; 20<\/p>\n\n<aside class=\"row veu_insertAds after\"><div class=\"col-md-6\"><script async src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script>\r\n<!-- \u7b2c 1 \u9762 - 2\uff08www.kumapress.com\uff09 -->\r\n<ins class=\"adsbygoogle\"\r\n     style=\"display:block\"\r\n     data-ad-client=\"ca-pub-5987681888830890\"\r\n     data-ad-slot=\"5379270693\"\r\n     data-ad-format=\"auto\"\r\n     data-full-width-responsive=\"true\"><\/ins>\r\n<script>\r\n     (adsbygoogle = window.adsbygoogle || []).push({});\r\n<\/script><\/div><div class=\"col-md-6\"><script async src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script>\r\n<!-- \u7b2c 1 \u9762 - 1\uff08www.kumapress.com\uff09 -->\r\n<ins class=\"adsbygoogle\"\r\n     style=\"display:block\"\r\n     data-ad-client=\"ca-pub-5987681888830890\"\r\n     data-ad-slot=\"7353370294\"\r\n     data-ad-format=\"auto\"\r\n     data-full-width-responsive=\"true\"><\/ins>\r\n<script>\r\n     (adsbygoogle = window.adsbygoogle || []).push({});\r\n<\/script><\/div><\/aside>","protected":false},"excerpt":{"rendered":"<p>PHP7.4\u304b\u3089oci8\u306e\u4f7f\u7528\u3059\u308b\u305f\u3081\u306e\u74b0\u5883\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u5185\u5bb9\u3068\u3057\u3066\u306f\u300cInstall OCI8 on Ubuntu 20.04 with PHP 7.4\u300d\u3092\u307b\u307c\u305d\u306e\u307e\u307e\u8e0f\u8972\u3057\u3066\u3044\u307e\u3059\u3002\u305f\u3060\u3001\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306e\u9014\u4e2d\u3067PHP8 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"vkexunit_cta_each_option":"","footnotes":""},"categories":[126],"tags":[],"class_list":["post-5560","post","type-post","status-publish","format-standard","hentry","category-blog-memo"],"_links":{"self":[{"href":"https:\/\/kumapress.com\/index.php?rest_route=\/wp\/v2\/posts\/5560","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kumapress.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kumapress.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kumapress.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kumapress.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5560"}],"version-history":[{"count":11,"href":"https:\/\/kumapress.com\/index.php?rest_route=\/wp\/v2\/posts\/5560\/revisions"}],"predecessor-version":[{"id":5576,"href":"https:\/\/kumapress.com\/index.php?rest_route=\/wp\/v2\/posts\/5560\/revisions\/5576"}],"wp:attachment":[{"href":"https:\/\/kumapress.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5560"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kumapress.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5560"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kumapress.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5560"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}