Compiling OracleInstantClient + Apache + PHP
Prepared by Sarang Acharya
Initially install apache normal compilation
#./configure –enable-module=so
Here prefix path is taken as default i.e., /usr/local/apache2
#make
# make install
To start the service
#/usr/local/apche2/bin/apachect1 start
Compile PHP normally with apache
# ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/apache2/conf/ --enable-sigchild
# make clean
# make
# make install
Copy the PHP Initialization file from php source code
#cp php.ini-recommended /usr/local/apache2/conf/php.ini
Edit Apache's configuration file /usr/local/apache/conf/httpd.conf and add the following lines:
AddType application/x-httpd-php .php
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php-source .phps
#
# This is the directory containing php.ini
#
PHPIniDir "/usr/local/apache/conf"
Restart the apache service
#/usr/local/apche2/bin/apachect1 stop
#/usr/local/apche2/bin/apachect1 start
For testing PHP need to place PHP file in htdocs i.e. /usr/local/apache2/htdocs
#cd /usr/local/apache2/htdocs
#vi phpinfo.php
Add the following lines in the file
<?php
phpinfo();
?>
Save the file and exit the editor.
To test basic PHP Installation, Open it in a browser with http://localhost/phpinfo.php
Now Install the downloaded instantclient rpm's
rpm -Uvh oracle-instantclient11.1-basic-11.1.0.7.0-1.i386.rpm
rpm -Uvh oracle-instantclient11.1-devel-11.1.0.7.0-1.i386.rpm
The first RPM puts the Oracle libraries in /usr/lib/oracle/11.1/client/lib and the second creates headers in /usr/include/oracle/11.1/client
# tar xzf oci8-1.3.5.tgz
# cd oci8-1.3.5
# phpize
# ./configure –with-oci8=instantclient,/usr/lib/oracle/11.2/client64/lib
# make install
Now make sure that mysql and curl packages are installed and now compile the PHP with OCI8 using the following command.
# ./configure --prefix=/usr/local/apache2/ --with-oci8=instantclient,/usr/lib/oracle/11.2/client64/lib --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/apache2/conf/ --enable-sigchild --with-zlib-dir=/usr/lib/ --with-mysql --with-libdir=lib64 –with-curl
#make clean
#make
#make install
Now check the PHP installation config using http://localhost/phpinfo.php
The url should show the above configure command and installed modules.
For example is as shown below..
Prepared by Sarang Acharya