Linux + Apache + PHP + Oracle Basic Environment Construction
Preface:
There is no guarantee that each system will pass 100% at a time. Each system will be more or less different. If some dependent packages are missing, please forgive me.
1. To install Apache, You need to compile and install packages and download them from various official websites.
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 --- 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 the PHP package
(1) YUM installation, source 163
Yum install libxml2-devel curl-devel libpng-devel freetype-devel libjpeg-devel-y
(2) install the software by compiling and download the software from the official website.
Libiconv, libmcrypt
(3) install RPM on the Oracle official website.
Oracle-instantclient11.2-basic
Oracle-instantclient11.2-devel
Oracle-instantclient11.2-sqlplus
4. Environment variables to be updated
Export ORACLE_HOME =/usr/lib/oracle/11.2/client64 # location of the ORACLE session
Export LD_LIBRARY_PATH = $ ORACLE_HOME/lib # LIB location
Export NLS_LANG = AMERICAN_AMERICA.AL32UTF8 # Show non-garbled characters in Chinese
5. Add the host name in/etc/hosts.
127.0.0.1 BJ-NQ-V-xxx
6. 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 connection to ORACLE code
# Test code:
$ Db_server = "localhost"; # oracle ip Address
$ Db_user = "atyu30"; # ORACLE user name
$ Db_pass = "atyu30"; # ORACLE Password
$ Db_sid = "atyu30"; # SID of ORACLE
$ 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 "Connect ";
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 "the connection is closed successfully! ";
}
}
Else
{
Echo "connection failed ";
}
?>
Install a Web Server on Ubuntu Server 14.04 (Linux + Apache + MySQL + PHP)
Install and configure the PHP environment in Linux (Apache2)
Install the LAMP \ Vsftpd \ Webmin \ phpMyAdmin service and settings in Ubuntu 13.04
Compile and install LAMP in CentOS 5.9 (Apache 2.2.44 + MySQL 5.6.10 + PHP 5.4.12)
Source code for Web server architecture in RedHat 5.4 build the LAMP environment and application PHPWind
Apache details: click here
Apache: click here
This article permanently updates the link address: