How to compile php5 with oracle instant client 11

Well, this is very easy.

First you need to download apache web server ,the latest php 5.2.6 from www.php.net and the instantclient11 from oracle download (you need an accont for this one)

Unpack your apache archive in your work dir and then type

./configure --enable-so
--with-mpm=prefork --enable-ssl=static --with-ssl=/usr/include/openssl/


If all is ok, type make, and after this make install

This will install the http server in /usr/local/apache2 dir

If you want to have php with oracle instantclient11, unpack the php archive on your disk and type:

'./configure' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-pgsql' '--with-gd' '--with-zlib' '--with-oci8=instantclient,/opt/instantclient_11' '--enable-bcmath' '--with-sqlite' '--with-mysql' '--with-mysql-sock=/var/lib/mysql/mysql.sock' '--enable-mbstring' '--with-mcrypt'

Offcourse, you must unpack the oracle instantclient11 zip file in /opt/instantclient_11

This will give you, postgreSql support, mysql support, gd, zlib, mcrypt and offcourse instantclient11 for accesing your oracle server.

If everything is ok, and no error messages displayed, type make, and after this make install

This will make libphp5.2.6.so in /usr/local/apache2/modules dir.

Php scripts will add in your httpd.conf file this line LoadModule php5_module modules/libphp5.so
This will make apache load the php lib file at runtime, and it will execute php script file, but i'm sure that you allready know this issue :)

To test your php just make a simple php script like this.




$server="127.0.0.1";
$port=1521;
$SID="XE";
$user="oracle_user";
$password="oracle_password";
$db_connect =OCIlogon("$user", "$password", "//$server:$port/$SID");
if (!$db_connect)
{ echo "i made buba :";
echo $error = ocierror();

}

else {
echo "good to go";
}

?>



It is very simple to add more tests, like insert into a table, create a tabel, remove, etc.

Comments

Popular posts from this blog

Why sometimes oracle 10g XE sucks big time

Review of Yashica ML 50mm F2

NAT in opensolaris