Preface: cannot guarantee 100% pass, each system will be more or less different, If some of the dependencies are missing, please also forgive 1, install Apache need to compile and install the package, the official website download pcre, APR, apr-util 2, compile and install 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, install PHP installation package (1) Yum mode installation, 163 source yum Install libxml2-devel curl-devel libpng-devel freetype-devel libjpeg-devel-y (2) Compile-mode installation, the software official website download Libiconv, libmcrypt (3) RPM mode installation, download from Oracle website Oracle-instantclient11.2-basicoracle-instantclient11.2-develoracle-instantclient11.2-sqlplus 4, Environment variables that need to be updated 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, add host name 127.0.0.1 bj-nq-v-xxx 6 in/etc/hosts, compile and install 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, test PHP connectivity Oracle Code # Test code reproduced in: 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 "Connection";
echo "DB server:". $db _server;
echo "User:". $db _user;
echo "Password:". $db _pass;
echo "SID:". $db _sid;
echo "Success \ n";
if (Ocilogoff ($dbconn) ==true)
{
echo "Close connection succeeded!";
}
}
Else
{
echo "Connection Failed";
}
?>
Linux+apache+php+oracle Basic Environment Construction