Linux + Apache + Php + Oracle Basic Environment Construction
1. install Apache by compiling and installing packages. Download Pcre, Apr, Apr-Util from various official websites. 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. package to be installed for PHP installation (1) YUM installation, 163 source yum install libxml2-devel curl-devel libpng-devel freetype-devel libjpeg-devel-y (2) Build method installation, download the Libiconv and libmcrypt (3) RPM installation methods from various software official websites, download the oracle-instantclient11.2-basicoracle-instantclient11.2-develoracle-instantclient11.2-sqlplus from the ORACLE official website 4, the environment variable to be updated export ORACLE_HOME =/usr/lib/oracle/11.2/client64 # connection ORACLE session location 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 127.0.0.1 BJ-NQ-V-xxx in/etc/hosts. 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
# The test code is reproduced in: region = "localhost"; # oracle ip address $ db_user = "atyu30"; # ORACLE username $ db_pass = "atyu30 "; # ORACLE password $ 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 "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 ";}?>