{"id":395,"date":"2015-11-16T09:31:40","date_gmt":"2015-11-16T09:31:40","guid":{"rendered":"http:\/\/onlinelab.info\/?p=395"},"modified":"2015-11-16T09:31:40","modified_gmt":"2015-11-16T09:31:40","slug":"install-php-oracle-client-on-ubuntu","status":"publish","type":"post","link":"https:\/\/www.asianux.org.vn\/index.php\/2015\/11\/16\/install-php-oracle-client-on-ubuntu\/","title":{"rendered":"Install Php Oracle Client on Ubuntu"},"content":{"rendered":"<ol>\n<li><strong> Y\u00eau c\u1ea7u:<\/strong><\/li>\n<\/ol>\n<p>&#8211; H\u1ec7 \u0111i\u1ec1u h\u00e0nh: Ubuntu.<\/p>\n<p>&#8211; PHP phi\u00ean b\u1ea3n: 5.5.29.<\/p>\n<p>&#8211; Oracle Client: 2 g\u00f3i ph\u1ea7n m\u1ec1m c\u00f3 t\u00ean instantclient-basic-linux-12.1.0.2.0 v\u00e0 instantclient-sdk-linux-12.1.0.2.0.<\/p>\n<ol start=\"2\">\n<li><strong> C\u00e1c b\u01b0\u1edbc c\u00e0i \u0111\u1eb7t:<\/strong><\/li>\n<\/ol>\n<p>B\u01b0\u1edbc 1: b\u1ea1n ch\u1ea1y c\u00e1c c\u00e2u l\u1ec7nh sau:<\/p>\n<p>sudo apt-get install build-essential<\/p>\n<p>sudo apt-get install php5-dev php-pear libaio1<\/p>\n<p>&nbsp;<\/p>\n<p>B\u01b0\u1edbc 2: B\u1ea1n ch\u1ec9nh s\u1eeda file \/etc\/environment ch\u00fa \u00fd thay \u0111\u1ed5i \u0111\u01b0\u1eddng d\u1eabn c\u1ee7a b\u1ea1n<\/p>\n<p># Oracle Instant ClientLD_LIBRARY_PATH=&#8221;\/usr\/local\/lib\/instantclient_11_2&#8243;<\/p>\n<p>TNS_ADMIN=&#8221;\/usr\/local\/lib\/instantclient_11_2&#8243;<\/p>\n<p>ORACLE_BASE=&#8221;\/usr\/local\/lib\/instantclient_11_2&#8243;<\/p>\n<p>ORACLE_HOME=$ORACLE_BASE<\/p>\n<p>V\u1edbi b\u1ea3n 12.1<\/p>\n<p>LD_LIBRARY_PATH=&#8221;\/usr\/local\/lib\/instantclient_12_1&#8243;<\/p>\n<p>TNS_ADMIN=&#8221;\/usr\/local\/lib\/instantclient_12_1&#8243;<\/p>\n<p>ORACLE_BASE=&#8221;\/usr\/local\/lib\/instantclient_12_1&#8243;<\/p>\n<p>ORACLE_HOME=$ORACLE_BASE<\/p>\n<p>&nbsp;<\/p>\n<p>B\u01b0\u1edbc 3: B\u1ea1n download 2 g\u00f3i ph\u1ea7n m\u1ec1m c\u00f3 t\u00ean tr\u00ean v\u00e0 gi\u1ea3i n\u00e9n v\u00e0o th\u01b0 m\u1ee5c: \/usr\/local\/lib<\/p>\n<p>cd \/usr\/local\/lib<\/p>\n<p>sudo unzip &lt;location-of-instant-client-basic&gt;<\/p>\n<p>sudo unzip &lt;location-of-instant-client-sdk&gt;<\/p>\n<p>cd instantclient_11_2sudo<\/p>\n<p>ln -s libclntsh.so.11.1 libclntsh.so<\/p>\n<p>ln -s libclntsh.so.12.1 libclntsh.so<\/p>\n<p>&nbsp;<\/p>\n<p>B\u01b0\u1edbc 4: B\u1ea1n ch\u1ea1y l\u1ec7nh sau:<\/p>\n<p>sudo pecl install oci8<\/p>\n<p>&nbsp;<\/p>\n<p>N\u1ebfu ch\u01b0\u01a1ng tr\u00ecnh c\u00f3 y\u00eau c\u1ea7u nh\u1eadp, b\u1ea1n nh\u1eadp:<\/p>\n<p>instantclient,\/usr\/local\/lib\/instantclient_12_1<\/p>\n<p>B\u01b0\u1edbc 5: B\u1ea1n c\u1ea7n ch\u1ec9nh s\u1eeda file c\u1ea5u h\u00ecnh c\u1ee7a php \u0111\u1ec3 enable oci l\u00ean<\/p>\n<p>vim \u00a0\/etc\/php5\/cli\/php.iniextension=oci8.so<\/p>\n<p>B\u01b0\u1edbc 5: Kh\u1edfi \u0111\u1ed9ng l\u1ea1i Apache:<\/p>\n<p>sudo \/etc\/init.d\/apache2 reload<\/p>\n<p>I fix this problem in my CENTOS 6.6 and php 5.6.8 in these two ways:<\/p>\n<ol>\n<li>If you need DTRACE:\n<ul>\n<li>yum install systemtap-sdt-devel<\/li>\n<li>export PHP_DTRACE=yes<\/li>\n<li>pecl install oci8<\/li>\n<\/ul>\n<\/li>\n<li>if you don&#8217;t like DTRACE:\n<ul>\n<li>Download the oci8 tar ball and extract the files<\/li>\n<li>modify the file &#8216;php_oci8_int.h&#8217;, change the 48th line<br \/>\n#include &#8220;oci8_dtrace_gen.h&#8221;to\u00a0#undef HAVE_OCI8_DTRACE<\/li>\n<li>phpize<\/li>\n<li>.\/configure &#8211;with-oci8=<\/li>\n<li>make<\/li>\n<li>make install<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Y\u00eau c\u1ea7u: &#8211; H\u1ec7 \u0111i\u1ec1u h\u00e0nh: Ubuntu. &#8211; PHP phi\u00ean b\u1ea3n: 5.5.29. &#8211; Oracle Client: 2 g\u00f3i ph\u1ea7n m\u1ec1m c\u00f3 t\u00ean instantclient-basic-linux-12.1.0.2.0 v\u00e0 instantclient-sdk-linux-12.1.0.2.0. C\u00e1c b\u01b0\u1edbc c\u00e0i \u0111\u1eb7t: B\u01b0\u1edbc 1: b\u1ea1n ch\u1ea1y c\u00e1c c\u00e2u l\u1ec7nh&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,3],"tags":[],"class_list":["post-395","post","type-post","status-publish","format-standard","hentry","category-database","category-linux"],"_links":{"self":[{"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/posts\/395","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/comments?post=395"}],"version-history":[{"count":0,"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/posts\/395\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/media?parent=395"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/categories?post=395"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/tags?post=395"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}