Linux+Apache+Php+Oracle 基礎環境搭建

來源:互聯網
上載者:User

標籤:

前言:                     不能保證100%一次通過,每個系統都會或多或少有區別,如果缺少某些依賴包的話,還請見諒 1、安裝Apache需要編譯安裝的包,各官方網站下載 Pcre、Apr、Apr-Util 2、編譯安裝Apache:./configure --prefix=/usr/local/apache --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre --with-mpm=prefork --enable-cache --enable-disk-cache --enable-mem-cache --enable-file-cache --enable-nonportable-atormics --enable-mods-shared=most --enable-so  3、安裝PHP需要安裝的包 (1)YUM方式安裝,163的源 yum install libxml2-devel curl-devel libpng-devel freetype-devel libjpeg-devel -y (2)編譯方式安裝,各軟體官網下載 Libiconv、libmcrypt (3)RPM方式安裝,從ORACLE官網下載 oracle-instantclient11.2-basicoracle-instantclient11.2-develoracle-instantclient11.2-sqlplus  4、需要更新的環境變數 export ORACLE_HOME=/usr/lib/oracle/11.2/client64   #串連ORACLE會話的位置export LD_LIBRARY_PATH=$ORACLE_HOME/lib           #LIB的位置export NLS_LANG=AMERICAN_AMERICA.AL32UTF8     #讓中文顯示非亂碼  5、在/etc/hosts中添加主機名稱127.0.0.1 BJ-NQ-V-xxx  6、編譯安裝PHP ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-apxs2=/usr/local/apache/bin/apxs --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --enable-sockets --with-gettext --with-oci8=instantclient --with-pdo-oci --with-iconv=/usr/local/libiconv --enable-opcache=no  7、測試PHP連通ORACLE代碼#測試代碼轉載於:http://blog.chinaunix.net/uid-20438355-id-61148.html

$db_server = "localhost";  #ORACLE的IP
$db_user = "atyu30";        #ORACLE的使用者名稱
$db_pass = "atyu30";       #ORACLE的密碼
$db_sid = "atyu30";          #ORACLE的SID
$dbconn=OCILogon($db_user,$db_pass,"(DEscriptION=(ADDRESS=(PROTOCOL =TCP)(HOST=127.0.0.1)(PORT = 1521))(CONNECT_DATA =(SID=$db_sid)))");

if($dbconn!=false) 

echo "串連"; 
echo "DB伺服器:".$db_server;
echo "使用者:".$db_user;
echo "口令:".$db_pass;
echo "SID:".$db_sid;
echo "成功\n";
if(OCILogOff($dbconn)==true) 

echo "關閉串連成功!";


else 

echo "串連失敗"; 

?>

Linux+Apache+Php+Oracle 基礎環境搭建

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.