How to connect oracle database with PHP? it's easy:
Requirement:
A. Webserver, Apache is the most popular webserver.
B. PHP5.
C. Oracle Client (Optional)
1. Or the most simple way is by download webserver package it will include all requirement except oracle client you can find a lot of this kind of package for the example phpTriad and so on but im using easyPHP coz it's much easiest to configuration than other webserver package.
2. And then install the easyPHP, after installation completed run easy php by executing .exe file, easyPHP icon will appear on right below of windows toollbars.
3. Right click the icon go to configuration and click PHP extensions and we need oci and oracle module as basic requirement for PHP to understand the Oracle functionality, check the PHP_oci8 and PHP_oracle or you can edit manually from php.ini by remove ";"
;extension=php_oci8.dll
;extension=php_openssl.dll
;extension=php_oracle.dll
after:
extension=php_oci8.dll
;extension=php_openssl.dll
extension=php_oracle.dll
and then restart the apache and php
4. Ok next steep is for PHP script:
Herewith the connection script to oracle database:
$db = "(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.17.24.31)(PORT = 1521))(CONNECT_DATA = (SERVICE_NAME = cbsms)))";and below is very simple search engine PHP-Oracle and then then display the result:
$conn = OCILogon("VIEWONLYSMS","smg",$db)
or die( "Could not connect to Oracle database!")
or die(ocierror());
?>
1. Search Form: