Outils pour utilisateurs

Outils du site


linux:installer_php_avec_oci

Installing OCI8 extension for PHP 5.4 debian wheezy (x86)

First of all, download those both files from the official Oracle website: oracle-instantclient11.2-basic-11.2.0.3.0-1.x86_64.rpm library files later extracted in

/usr/lib/oracle/11.2/client/ 

oracle-instantclient11.2-devel-11.2.0.3.0-1.x86_64.rpm headers files extracted in

/usr/include/oracle/11.2/client

Put them on your server, and convert them to .deb files with alien for example and install :

apt-get install alien

# Converting to deb

alien -d oracle-instantclient11.2-basic-11.2.0.3.0-1.x86_64.rpm  
alien -d oracle-instantclient11.2-devel-11.2.0.3.0-1.x86_64.rpm 

# Installing

dpkg -i oracle-instantclient11.2-devel_11.2.0.4.0-2_i386.deb  
dpkg -i oracle-instantclient11.2-basic_11.2.0.4.0-2_i386.deb

Now it's becoming tricky, as the PHP documentation says it should be done in one command pecl install oci8, but don't dream it'll rarely work… So, after trying, I'll do it the manual way :

# Downloading oci8
pecl download oci8  
tar xzf oci8-2.0.7.tgz  
cd oci8-2.0.7  
phpize  
# I had an error there 1)
./configure

# And there too 2)
make

# Once you've succeded you can do
make install

# Add the oci8 extension to the /etc/php5/cli/php.ini and test with :
php -v

# If it shows an error extension isn't loaded 3)

1) configure error No such file or directory The path to the ORACLE_HOME should be automatically detected, if not export

ORACLE_HOME=/usr/lib/oracle/11.2/client/ and try again!

2) make error No such file or directory If it doesn't find a header file (i.e: oci.h: No such file or directory) you should export

C_INCLUDE_PATH=/usr/include/oracle/11.2/client

3) php -v almost done… While trying with the php -v command it throwed :

 
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20100525+lfs/oci8.so' - libaio.so.1: cannot open shared object file: No such file or directory in Unknown on line 0 
 

Hopefully it wasn't a big deal and the solution was :

sudo apt-get install libaio1

That doesn't look hard like hell, but it was! Glad it's done and fully working as the phpinfo() mentions OCI8 Support enabled.  Compiling PHP with PDO OCI First check if aspx2 is available, if not : sudo apt-get install apache2-prefork-dev

According to dpkg -l | grep apache2. Set your

$ORACLE_HOME (export ORACLE_HOME=/usr/lib/oracle/11.2/client/)

 download php and extract it.

./configure --with-pdo-oci --with-oci8 --with-apxs2=/usr/bin/apxs2 --with-mysql --with-pdo-mysql
make  
sudo make install  
sudo service apache2 restart 

More options

./configure --with-apxs2=/usr/bin/apxs2 --enable-bcmath --with-bz2 --enable-calendar --with-curl --enable-dba --enable-exif --enable-ftp --with-gd --with-gettext --with-imap --with-imap-ssl --with-kerberos --enable-mbstring --with-mcrypt --with-openssl --enable-shmop --enable-soap --enable-sockets --enable-sysvmsg --enable-wddx --enable-zip --with-zlib --with-xsl --with-mysql --with-mysqli --with-pgsql --with-pdo-mysql --with-pdo-pgsql --with-oci8 --with-pdo-oci

On Debian :

bz2 requires libbz2-dev source 
gd requires libpng-dev or libpng12-dev 
imap requires libc-client-dev (also for a utf8 error) 
mcrypt requires libmcrypt-dev 
libxml requires libxml2-dev 
openssl requires libcurl4-openssl-dev 
xsl requires libxslt1-dev or libxslt-dev 
curl requires libcurl4-gnutls-dev

Retour...

linux/installer_php_avec_oci.txt · Dernière modification: 2019/01/25 15:56 (modification externe)