( all the work may be same if connecting to a database at localhost, i didn't try it )
You have to do the following-----
assuming that no php,mysql,apache server is installed in your machine . then just download wampserver and install it .
it has all the three items I mentioned earlier .
download Instant Client Package - Basic file from here ( i used version 10.2.0.4 , windows 32-bit ) and extract it under some folder say
C:\Program Files\OracleClient ( no folder under this directory only the dll and jar files )
then add the directory mentioned ( that means the directory where you extracted the files ) above to your PATH environment variable . you can do it here
start >> My Computer >> Properties ( clicking right button on My Computer ) >> Advanced >> Environment Variable >> System variables
PATH variable may already defined in your pc then just Edit it by adding a semicolon and the directory where Instant Client Package - Basic is extracted otherwise add it .
( while comparing ignore case , all "PATH" , "Path" , "path" means the same because environment variable is case insensitive )
open php.ini from here
..................\wamp\bin\apache\Apache2.2.11\bin\ and remove the starting semicolon ( uncomment the following line )
extension=php_oci8.dll ( if using oracle 10g )
extension=php_oci8_11g.dll ( if using oracle 11g )
but don't do the both.
( you can also edit the file by clicking wamp's task-bar icon then focusing on php you will get a pop-up menu there you will have a php.ini file )
then save the file and restart your pc .
then start wampserver If you are lucky enough then you will not have any error . That means inclusion of oci8 module was successful.
you can verify by this..........
click here http://localhost and you will go to wampserver home page then you will get
phpinfo() ( you can also try to find oci8 in Loaded Extensions at wamp's homepage )
click it and try to find something like the following .
oci8
OCI8 Support | enabled |
Version | 1.3.5 |
Revision | $Revision: 1.269.2.16.2.38.2.32 $ |
Active Persistent Connections | 0 |
Active Connections | 0 |
Oracle Instant Client Version | 10.2 |
Temporary Lob support | enabled |
Collections support | enabled |
Directive | Local Value | Master Value |
---|---|---|
oci8.connection_class | no value | no value |
oci8.default_prefetch | 100 | 100 |
oci8.events | Off | Off |
oci8.max_persistent | -1 | -1 |
oci8.old_oci_close_semantics | Off | Off |
oci8.persistent_timeout | -1 | -1 |
oci8.ping_interval | 60 | 60 |
oci8.privileged_connect | Off | Off |
oci8.statement_cache_size | 20 | 20 |
to check your database connection use the following code inside the php tag
$conn = oci_connect('username', 'password', 'ip address/service_name'); if (!$conn)
{ trigger_error("Could not connect to database", E_USER_ERROR); } else { echo "Connected" ; }
- copy it to .... \wamp\www\
yourfilename.php file - change the username , password ,
according to yours . - service name - according to your Service name
- check the link
if the page shows connected that means you are connected to the database.
you may need to download MSVCR71.dll and copy file to the directory where all the Instant Client Package - Basic files are situated.