{"id":287,"date":"2017-11-28T22:02:11","date_gmt":"2017-11-28T21:02:11","guid":{"rendered":"http:\/\/oliver-frick.ch\/?p=287"},"modified":"2020-05-04T19:37:22","modified_gmt":"2020-05-04T18:37:22","slug":"build-oci-for-php","status":"publish","type":"post","link":"https:\/\/oliver-frick.ch\/wordpress\/index.php\/2017\/11\/28\/build-oci-for-php\/","title":{"rendered":"Build oci for PHP"},"content":{"rendered":"<p>mount DVD iso<\/p>\n<p>mkdir \/media\/CentOS<\/p>\n<p>mount \/dev\/cdrom \/media\/CentOS -o loop<\/p>\n<p>vi \/etc\/yum.repos.d\/CentOS-Media.repo<\/p>\n<p>add file:\/\/\/media\/xxx\u00a0\u00a0 corresponding to the DVD media<\/p>\n<p>download php source<\/p>\n<p>yum \u2013enablerepo=c6-media install libxml-devel<\/p>\n<p>resp. yum \u2013enablerepo=c8-media-AppStream install libxml-devel<\/p>\n<p>yum \u2013enablerepo=c6-media install httpd-devel<\/p>\n<p>yum \u2013enablerepo=c8-media-AppStream install libnsl<\/p>\n<p>(replaces the NIS library that used to be in glibc)<\/p>\n<p>extract php sources<\/p>\n<p>.\/confgure<\/p>\n<p>make<br \/>\nmake test<br \/>\nmake install<\/p>\n<p>Download Oracle Client &amp; SDK<\/p>\n<p>vi \/etc\/ld.so.conf.d\/oracle-11g-64.conf<br \/>\n\/opt\/app\/oracle\/product\/11.2.0<\/p>\n<p>ldconfig -v<\/p>\n<p>export ORACLE_HOME=\/opt\/app\/oracle\/product\/11.2.0<br \/>\nln -s libclntsh.so.11.1 libclntsh.so<\/p>\n<p>\/usr\/sbin\/setenforce 0\u00a0\u00a0\u00a0\u00a0 ??<\/p>\n<p>yum groupinstall &#8222;Development tools&#8220;<\/p>\n<p>export CFLAGS=-m64<br \/>\nexport CPPFLAGS=-m64<br \/>\nexport CCASFLAGS=-m64<\/p>\n<p>export CPPFLAGS=&#8220;-I\/usr\/include\/oracle\/19.5\/client64 -m64&#8243;<\/p>\n<p>cd php sources<br \/>\ncd ext<br \/>\ncd oci8<br \/>\nphpize<br \/>\n.\/configure \u2013with-oci8=instantclient,\/opt\/app\/oracle\/product\/11.2.0,11.2.0.3.0<br \/>\nmake<br \/>\nls modules<\/p>\n<p>cd php sources<br \/>\ncd ext<br \/>\ncd pdo_oci<br \/>\nphpize<br \/>\n.\/configure \u2013with-pdo-oci=shared,instantclient,\/opt\/app\/oracle\/product\/11.2.0,11.2.0.3.0<br \/>\nmake<br \/>\nls modules<\/p>\n<p>check with<\/p>\n<p>ldd modules\/oci8.so<\/p>\n<p>all links ok?<\/p>\n<p>make install<\/p>\n<p>check which php.ini is used. If \/etc\/php.d Directory, add 20.oci.ini with<\/p>\n<p>extension=oci8<\/p>\n<p>and run php -v to see if any errors with so<\/p>\n<p>restart Webserver and FPM (if used)<\/p>\n<p>&nbsp;<\/p>\n<p>Update for CentOS 8, Minimal Installation (command history):<\/p>\n<pre>   16  less \/etc\/yum.repos.d\/CentOS-Media.repo \r\n   17  mkdir \/media\/CentOS\r\n   19  mount \/dev\/cdrom \/media\/CentOS -o loop\r\n   41  yum --enablerepo=c8-media-BaseOS install mailcap\r\n   49  rpm -ql mailcap\r\n   50  yum --enablerepo=c8-media-AppStream install httpd\r\n   51  yum --enablerepo=c8-media-AppStream install php.x86_64\r\n   56  yum --enablerepo=c8-media-BaseOS install net-tools\r\n   57  rpm -ql net-tools\r\n   58  rpm -q net-tools\r\n   59  find \/media -name \"net*.rpm\"\r\n   60  rpm -qlp \/media\/CentOS\/BaseOS\/Packages\/net-tools-2.0-0.51.20160912git.el8.x86_64.rpm \r\n   61  rpm -qlp \/media\/CentOS\/BaseOS\/Packages\/net-tools-2.0-0.51.20160912git.el8.x86_64.rpm | less\r\n   62  yum --enablerepo=c8-media-BaseOS install net-tools\r\n   66  apachectl configtest\r\n   67  apachectl start\r\n   69  telnet localhost 80\r\n   73  yum --enablerepo=c8-media-AppStream install telnet\r\n   77  ifconfig\r\n   78  dhclient\r\n   79  ifconfig\r\n   90  firewall-cmd --get-default-zone\r\n   91  ip link show\r\n   93  firewall-cmd --list-all --zone=public\r\n   94  systemctl enable firewalld\r\n   95  firewall-cmd --state\r\n   97  firewall-cmd --get-zones\r\n   98  firewall-cmd --get-services\r\n  103  firewall-cmd --get-active-zones\r\n  105  firewall-cmd --zone=public\r\n  106  firewall-cmd --zone=public --list-services\r\n  107  firewall-cmd --zone=public --permanent --add-service=https\r\n  108  firewall-cmd --zone=public --permanent --add-service=http\r\n  109  firewall-cmd --zone=public --list-services\r\n  110  firewall-cmd --reload\r\n  111  firewall-cmd --zone=public --list-services\r\n  112  firewall-cmd --get-active-zones\r\n  122  less \/etc\/httpd\/conf\/httpd.conf \r\n  115  cd \/var\/www\r\n  129  cd html\r\n  133  vi test.php\r\n  137  mount \/dev\/cdrom \/media\/CentOS -o loop\r\n  140  yum --enablerepo=c8-media-AppStream install wget\r\n  143  wget https:\/\/download.oracle.com\/otn_software\/linux\/instantclient\/195000\/oracle-instantclient19.5-basic-19.5.0.0.0-1.x86_64.rpm\r\n  144  wget https:\/\/download.oracle.com\/otn_software\/linux\/instantclient\/195000\/oracle-instantclient19.5-devel-19.5.0.0.0-1.x86_64.rpm\r\n  149  cksum oracle-instantclient19.5-basic-19.5.0.0.0-1.x86_64.rpm \r\n  150  cksum oracle-instantclient19.5-devel-19.5.0.0.0-1.x86_64.rpm \r\n  157  rpm -iv oracle-instantclient19.5-basic-19.5.0.0.0-1.x86_64.rpm \r\n  158  rpm -iv oracle-instantclient19.5-devel-19.5.0.0.0-1.x86_64.rpm \r\n  159  find \/ -name \"oci.h\"\r\n  160  echo $ORACLE_HOME\r\n  161  find \/ -name \"libclntsh.so\"\r\n  163  grep -r oracle \/etc\/* | less\r\n  164  ldconfig -v\r\n  168  wget https:\/\/www.php.net\/distributions\/php-7.2.11.tar.bz2\r\n  177  yum --enablerepo=c8-media-BaseOS install bzip\r\n  179  mkdir php\r\n  180  mv php-7.2.11.tar.bz2 php\/\r\n  181  cd php\/\r\n  183  bunzip2 php-7.2.11.tar.bz2 \r\n  188  yum --enablerepo=c8-media-BaseOS install tar\r\n  189  tar xvf php-7.2.11.tar \r\n  190  cd php-7.2.11\/ext\/oci8\/\r\n  194  yum --enablerepo=c8-media-AppStream install php-devel\r\n  196  yum --enablerepo=c8-media-AppStream install libxml2-devel\r\n  197  phpize\r\n  202  rpm -qlp \/root\/oracle-instantclient19.5-basic-19.5.0.0.0-1.x86_64.rpm \r\n  203  export ORACLE_HOME=\/usr\/lib\/oracle\/19.5\/client64\r\n  208  yum groupinstall \"Development tools\"\r\n  211  find \/ -name \"oci.h\"\r\n  210  echo $CPPFLAGS\r\n  222  export CPPFLAGS=\"-I\/usr\/include\/oracle\/19.5\/client64 -m64\"\r\n  228  .\/configure --with-oci8=shared,$ORACLE_HOME\r\n  229  make\r\n  230  ls modules\r\n  231  ldd modules\/oci8.so \r\n  233  yum --enablerepo=c8-media-AppStream install libnsl\r\n  234  ldd modules\/oci8.so \r\n  235  make install\r\n  236  cd \/etc\/php.d\r\n  241  vi 20.oci.ini \r\n  248  systemctl restart httpd\r\n  249  systemctl restart php-fpm\r\n\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>RHEL<\/p>\n<p>Upgrading from PHP 5.4 to 7.3<\/p>\n<p>php &#8211;modules | tee \/tmp\/54<br \/>\nscl enable rh-php73 &#8218;php &#8211;modules&#8216; | tee \/tmp\/73<br \/>\ndiff \/tmp\/54 \/tmp\/73<\/p>\n<p>systemctl stop php-fpm<br \/>\nsystemctl start rh-php73-php-fpm<br \/>\nTODO: enable \/ disable&#8230;<\/p>\n<p>scl enable rh-php73 &#8218;php -v&#8216;<\/p>\n<p>yum install rh-php73-php-7.3.11-1.el7.x86_64 rh-php73-php-cli-7.3.11-1.el7.x86_64 rh-php73-php-common-7.3.11-1.el7.x86_64 rh-php73-php-devel-7.3.11-1.el7.x86_64 rh-php73-php-fpm-7.3.11-1.el7.x86_64 rh-php73-php-gd-7.3.11-1.el7.x86_64 rh-php73-php-gmp-7.3.11-1.el7.x86_64 rh-php73-php-intl-7.3.11-1.el7.x86_64 rh-php73-php-ldap-7.3.11-1.el7.x86_64 rh-php73-php-pdo-7.3.11-1.el7.x86_64 rh-php73-php-pecl-apcu-5.1.17-1.el7.x86_64<\/p>\n<p>yum install libxml2-devel<\/p>\n<p>yum remove php-devel.x86_64<\/p>\n<p>tar xvzf php-7.3.11.tar.gz<\/p>\n<p>.\/configure<br \/>\nmake<\/p>\n<p>cd ext\/oci8<\/p>\n<p>phpize<\/p>\n<p>echo $ORACLE_HOME<br \/>\nexport ORACLE_HOME=\/usr\/lib\/oracle\/12.1\/client64<br \/>\nexport CPPFLAGS=&#8220;-I\/usr\/include\/oracle\/12.1\/client64 -m64&#8243;<\/p>\n<p>scl enable rh-php73 &#8218;.\/configure -with-oci8=instantclient&#8216;<br \/>\nscl enable rh-php73 &#8218;make&#8216;<br \/>\ncp modules\/oci8.so \/opt\/rh\/rh-php73\/root\/usr\/lib64\/php\/modules\/<\/p>\n<p>vi \/etc\/opt\/rh\/rh-php73\/php.d\/30-oci.ini<\/p>\n<p>yum install rh-php73-php-soap-7.3.11-1.el7.x86_64<\/p>\n<p>systemctl restart rh-php73-php-fpm<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>mount DVD iso mkdir \/media\/CentOS mount \/dev\/cdrom \/media\/CentOS -o loop vi \/etc\/yum.repos.d\/CentOS-Media.repo add file:\/\/\/media\/xxx\u00a0\u00a0 corresponding to the DVD media download php source yum \u2013enablerepo=c6-media install libxml-devel resp. yum \u2013enablerepo=c8-media-AppStream install libxml-devel yum \u2013enablerepo=c6-media install httpd-devel yum \u2013enablerepo=c8-media-AppStream install libnsl (replaces &hellip; <a href=\"https:\/\/oliver-frick.ch\/wordpress\/index.php\/2017\/11\/28\/build-oci-for-php\/\">Weiterlesen <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-287","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/oliver-frick.ch\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/287","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/oliver-frick.ch\/wordpress\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/oliver-frick.ch\/wordpress\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/oliver-frick.ch\/wordpress\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/oliver-frick.ch\/wordpress\/index.php\/wp-json\/wp\/v2\/comments?post=287"}],"version-history":[{"count":12,"href":"https:\/\/oliver-frick.ch\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/287\/revisions"}],"predecessor-version":[{"id":410,"href":"https:\/\/oliver-frick.ch\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/287\/revisions\/410"}],"wp:attachment":[{"href":"https:\/\/oliver-frick.ch\/wordpress\/index.php\/wp-json\/wp\/v2\/media?parent=287"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/oliver-frick.ch\/wordpress\/index.php\/wp-json\/wp\/v2\/categories?post=287"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/oliver-frick.ch\/wordpress\/index.php\/wp-json\/wp\/v2\/tags?post=287"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}