{"id":251,"date":"2023-04-18T16:58:28","date_gmt":"2023-04-18T08:58:28","guid":{"rendered":"https:\/\/www.tysql.com\/?p=251"},"modified":"2023-04-18T16:58:28","modified_gmt":"2023-04-18T08:58:28","slug":"%e5%ae%9d%e5%a1%94%e9%9d%a2%e6%9d%bfphp7-2%e5%ae%89%e8%a3%85oracle%e6%89%a9%e5%b1%95tp5%e8%bf%9e%e6%8e%a5oracle%e6%95%b0%e6%8d%ae%e5%ba%93","status":"publish","type":"post","link":"https:\/\/www.tysql.com\/index.php\/2023\/04\/18\/%e5%ae%9d%e5%a1%94%e9%9d%a2%e6%9d%bfphp7-2%e5%ae%89%e8%a3%85oracle%e6%89%a9%e5%b1%95tp5%e8%bf%9e%e6%8e%a5oracle%e6%95%b0%e6%8d%ae%e5%ba%93\/","title":{"rendered":"\u5b9d\u5854\u9762\u677fPHP7.2\u5b89\u88c5Oracle\u6269\u5c55,TP5\u8fde\u63a5Oracle\u6570\u636e\u5e93"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">\u7b2c\u4e00\u90e8\u5206 \u5b9d\u5854\u9762\u677fPHP7.2\u5b89\u88c5Oracle\u6269\u5c55<\/h2>\n\n\n\n<p>1.\u5b89\u88c5InstantClient<\/p>\n\n\n\n<p>\u4e0b\u8f7d\u6253\u5305\u597d\u7684\u6587\u4ef6\uff0c\u6216\u8005\u5230<a rel=\"noreferrer noopener\" href=\"https:\/\/www.oracle.com\/technetwork\/database\/database-technologies\/instant-client\/downloads\/index.html\" target=\"_blank\">\u5b98\u7f51\u4e0b\u8f7d<\/a>\u3002\uff08\u6ce8\u610f\u8981\u4e0b\u8f7dbasic\u548cdevel\uff0c\u7528\u6765\u7f16\u8bd1oci\u548cpdo_oci\u3002\u6211\u8fd9\u91cc\u4e0b\u8f7d\u7684\u662frpm\uff0c\u65b9\u4fbf\u5b89\u88c5\u3002\u6211\u8fd9\u91cc\u4e0b\u8f7d\u7684\u662f18.3\uff09<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:false,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;apl&quot;,&quot;mime&quot;:&quot;text\/apl&quot;,&quot;theme&quot;:&quot;darcula&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;APL&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;apl&quot;}\">\u5c06\u4e0b\u8f7d\u7684\u6587\u4ef6\u653e\u5728\/usr\/lib\/oracle\/,\u7136\u540e\u8fd0\u884c\u547d\u4ee4\u5b89\u88c5.\nrpm -ivh \/usr\/lib\/oracle\/oracle-instantclient18.3-*\n\n\u7136\u540e\u6253\u5f00 \/etc\/profile\nvi \/etc\/profile<\/pre><\/div>\n\n\n\n<p>\u5728\u6587\u4ef6\u5e95\u90e8\u589e\u52a0\uff08\u6ce8\u610f\u7248\u672c\u548c\u6587\u4ef6\u8def\u5f84\uff09<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:false,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;apl&quot;,&quot;mime&quot;:&quot;text\/apl&quot;,&quot;theme&quot;:&quot;darcula&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;APL&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;apl&quot;}\">export ORACLE_HOME=\/usr\/lib\/oracle\/18.3\/client64\nexport PATH=$PATH:$ORACLE_HOME\/bin\nexport LD_LIBRARY_PATH=$LD_LIBRARY_PATH:\/usr\/lib\/oracle\/18.3\/client64\/lib\nexport C_INCLUDE_PATH=$C_INCLUDE_PATH:\/usr\/include\/oracle\/18.3\/client64\nexport NLS_LANG='SIMPLIFIED CHINESE_CHINA.ZHS16GBK'<\/pre><\/div>\n\n\n\n<p>\u6dfb\u52a0\u540e\u7684\u6837\u5b50<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"587\" height=\"142\" src=\"https:\/\/www.tysql.com\/wp-content\/uploads\/2023\/04\/image.png\" alt=\"\" class=\"wp-image-255\" srcset=\"https:\/\/www.tysql.com\/wp-content\/uploads\/2023\/04\/image.png 587w, https:\/\/www.tysql.com\/wp-content\/uploads\/2023\/04\/image-300x73.png 300w\" sizes=\"auto, (max-width: 587px) 100vw, 587px\" \/><\/figure>\n\n\n\n<p>\u4fdd\u5b58\u540e\u5728\u7ec8\u7aef\u8fd0\u884c\u00a0 source \/etc\/profile\uff0c\u8ba9\u73af\u5883\u53d8\u91cf\u7acb\u5373\u751f\u6548\u3002<\/p>\n\n\n\n<p>2.\u5b89\u88c5OCI8<\/p>\n\n\n\n<p>\u8fd9\u91cc\u8981\u6ce8\u610f\u5148\u5c06php7.1\u7684\u914d\u7f6e\u9879\u3010\u7981\u7528\u51fd\u6570\u3011\u4e2d\u5220\u9664popen\u3001readlink\u4e24\u4e2a\u51fd\u6570\u3002\u7136\u540e\u7ec8\u7aef\u4e2d\u8fd0\u884c<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:false,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;apl&quot;,&quot;mime&quot;:&quot;text\/apl&quot;,&quot;theme&quot;:&quot;darcula&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;APL&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;apl&quot;}\">pecl channel-update pecl.php.net\n\n\/www\/server\/php\/72\/bin\/pecl install oci8-2.2.0 --with-php-config=\/www\/server\/php\/72\/bin\/php-config\n\n# \u6267\u884c\u8fc7\u7a0b\u4e2d\u53ef\u80fd\u8ba9\u8f93\u5165,\u8f93\u5165\u4e0b\nshared,instantclient,\/usr\/lib\/oracle\/18.3\/client64\/lib --with-php-config=\/www\/server\/php\/72\/bin\/php-config<\/pre><\/div>\n\n\n\n<p>3.\u5b89\u88c5PDO_OCI<\/p>\n\n\n\n<p>\u56e0\u4e3a\u7248\u672c\u95ee\u9898\u4e0d\u80fd\u4f7f\u7528pecl\u5b89\u88c5pdo_oci\uff0c\u6240\u4ee5\u81ea\u5df1\u7f16\u8bd1\u3002<\/p>\n\n\n\n<p><a href=\"http:\/\/be.php.net\/distributions\/php-7.1.26.tar.gz\">\u4e0b\u8f7dphp\u6e90\u7801<\/a>\u3002\u5c06\u6e90\u7801\u5305\u4e2d\u7684\u538b\u7f29\u5305\u4e2d\u7684ext\/pdo_oci\u6587\u4ef6\u5939\u4e0a\u4f20\u5230\/www\/server\/php\/72\/include\/php\/ext\/\u3002<\/p>\n\n\n\n<p>\u7136\u540e\u5c06php.ini\u914d\u7f6e\u6587\u4ef6\u4e2d[oci8]\u4e0b\u9762\u7684oci8.privileged_connect\uff0c\u524d\u9762\u5206\u53f7\u53bb\u6389\uff0cOff\u4fee\u6539\u4e3aOn\uff0c\u540e\u9762\u7684\u914d\u7f6e\u9879\u81ea\u5df1\u4f9d\u636e\u5b9e\u9645\u60c5\u51b5\u53bb\u914d\u7f6e\u3002\u7136\u540e\u4fdd\u5b58\u91cd\u542f\u6216\u91cd\u8f7dphp\u670d\u52a1\u3002<\/p>\n\n\n\n<p>\u7136\u540e\u7ec8\u7aef\u8fd0\u884c<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:false,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;apl&quot;,&quot;mime&quot;:&quot;text\/apl&quot;,&quot;theme&quot;:&quot;darcula&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;APL&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;apl&quot;}\">cd \/www\/server\/php\/72\/include\/php\/ext\/pdo_oci\n\/www\/server\/php\/72\/bin\/phpize\n.\/configure --with-php-config=\/www\/server\/php\/72\/bin\/php-config --with-oci8=shared,instantclient,\/usr\/lib\/oracle\/18.3\/client64\/lib\nmake &amp;&amp; make install<\/pre><\/div>\n\n\n\n<p>4.PHP-FPM\u914d\u7f6e<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:false,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;apl&quot;,&quot;mime&quot;:&quot;text\/apl&quot;,&quot;theme&quot;:&quot;darcula&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;APL&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;apl&quot;}\">\u7f16\u8f91\/www\/server\/php\/72\/etc\/php-fpm.conf\uff0c\u5c06\u4e0b\u9762\u4e24\u884c\u4ee3\u7801\u52a0\u8fdb\u53bb\u3002\n\nenv[LD_LIBRARY_PATH] = \/usr\/lib\/oracle\/18.3\/client64\/lib\nenv[ORACLE_HOME] = \/usr\/lib\/oracle\/18.3\/client64\/lib<\/pre><\/div>\n\n\n\n<p>\u8fd0\u884c\u6210\u529f\u540e\uff0c\u518d\u5230php.ini\u6587\u4ef6\u4e2d\u68c0\u67e5\u662f\u5426\u6709\u4e24\u4e2aso\uff0c\u6ca1\u6709\u7684\u8bdd\u8981\u8bb0\u5f97\u6dfb\u52a0\u3002<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:false,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;apl&quot;,&quot;mime&quot;:&quot;text\/apl&quot;,&quot;theme&quot;:&quot;darcula&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;APL&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;apl&quot;}\">#\/www\/server\/php\/72\/etc\/php.ini\nextension=&quot;oci8.so&quot;\nextension=&quot;pdo_oci.so&quot;<\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>\u7b2c\u4e8c\u90e8\u5206 TP5\u8fde\u63a5oracle(\u672c\u6765\u9700\u8981\u88c5\u4e1c\u897f,\u4f46\u662f\u8fd9\u91cc\u7a81\u7136\u76f4\u63a5\u597d\u4f7f\u4e86??\u4e0d\u7ba1\u4e86)<\/p>\n\n\n\n<p>database\u5c40\u90e8\u914d\u7f6e<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:false,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;apl&quot;,&quot;mime&quot;:&quot;text\/apl&quot;,&quot;theme&quot;:&quot;darcula&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;APL&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;apl&quot;}\">\t\/\/ \u6570\u636e\u5e93\u7c7b\u578b\n    'type'            =&gt; 'oracle',\n    \/\/ \u670d\u52a1\u5668\u5730\u5740\n    'hostname'        =&gt; '127.0.0.1',\n    \/\/ \u6570\u636e\u5e93\u540d\n    'database'        =&gt; 'ORCL',\n    \/\/ \u7528\u6237\u540d\n    'username'        =&gt; 'TEST',\n    \/\/ \u5bc6\u7801\n    'password'        =&gt; 'test',\n    \/\/ \u7aef\u53e3\n    'hostport'        =&gt; '1521',<\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>\u539f\u6587\u94fe\u63a5:https:\/\/blog.csdn.net\/pmlptf\/article\/details\/126668688<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7b2c\u4e00\u90e8\u5206 \u5b9d\u5854\u9762\u677fPHP7.2\u5b89\u88c5Oracle\u6269\u5c55 1.\u5b89\u88c5InstantClient \u4e0b\u8f7d\u6253\u5305\u597d\u7684\u6587\u4ef6\uff0c\u6216\u8005 &hellip; <a href=\"https:\/\/www.tysql.com\/index.php\/2023\/04\/18\/%e5%ae%9d%e5%a1%94%e9%9d%a2%e6%9d%bfphp7-2%e5%ae%89%e8%a3%85oracle%e6%89%a9%e5%b1%95tp5%e8%bf%9e%e6%8e%a5oracle%e6%95%b0%e6%8d%ae%e5%ba%93\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u5b9d\u5854\u9762\u677fPHP7.2\u5b89\u88c5Oracle\u6269\u5c55,TP5\u8fde\u63a5Oracle\u6570\u636e\u5e93<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,5,9],"tags":[],"class_list":["post-251","post","type-post","status-publish","format-standard","hentry","category-linux","category-php","category-thinkphp"],"_links":{"self":[{"href":"https:\/\/www.tysql.com\/index.php\/wp-json\/wp\/v2\/posts\/251","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tysql.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tysql.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tysql.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tysql.com\/index.php\/wp-json\/wp\/v2\/comments?post=251"}],"version-history":[{"count":8,"href":"https:\/\/www.tysql.com\/index.php\/wp-json\/wp\/v2\/posts\/251\/revisions"}],"predecessor-version":[{"id":260,"href":"https:\/\/www.tysql.com\/index.php\/wp-json\/wp\/v2\/posts\/251\/revisions\/260"}],"wp:attachment":[{"href":"https:\/\/www.tysql.com\/index.php\/wp-json\/wp\/v2\/media?parent=251"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tysql.com\/index.php\/wp-json\/wp\/v2\/categories?post=251"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tysql.com\/index.php\/wp-json\/wp\/v2\/tags?post=251"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}