• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Resolved Debian / oci8 extension for PHP 7.4

Erwan

Regular Pleskian
Server operating system version
Debian 11
Plesk version and microupdate number
18.0.42
Hi all,

We have problem to install oci8 extension.
5 years ago we have informations from Igor (Resolved - Fedora 7 / Plesk Onyx : oci8 extension).

We must install again oci8, but now:
Plesk Obsedian 18.0.42
Debian 11
PHP FTM 7.4

We did this:
Last instantclicent:
- https://download.oracle.com/otn_sof...antclient-basic-linux.x64-19.14.0.0.0dbru.zip
- https://download.oracle.com/otn_sof...stantclient-sdk-linux.x64-19.14.0.0.0dbru.zip

# mkdir /opt/oracle
# unzip instantclient-basic-linux.x64-19.14.0.0.0dbru.zip
# unzip instantclient-sdk-linux.x64-19.14.0.0.0dbru.zip
# echo /opt/oracle/instantclient_19_14 > /etc/ld.so.conf.d/oracle-instantclient
# ldconfig

Add other packages:
# apt-get install php-dev php-pear build-essential libaio1

Update PECL
#pecl channel-update pecl.php.net

Install the OCI8 extension via PECL
Can not install oci8 with PHP7.4 (error: pecl/oci8 requires PHP (version >= 8.1.0), installed version is 7.4.28)
So:
#echo "instantclient,/opt/oracle/instantclient_19_14" | /opt/plesk/php/7.4/bin/pecl install oci8-2.2.0

Load extension from php.ini
# echo "extension=oci8.so" > /opt/plesk/php/7.4/etc/php.d/oci.ini

# service apache2 restart

See:
#/opt/plesk/php/7.4/bin/php -m | grep oci
PHP Warning: Module 'oci8' already loaded in Unknown on line 0

And the phpinfo() don't have "oci8" module.

I presume the previous error message is from a previously configured call to oci8.
But i don't see "extension call" to oci in the php.ini (7.4), only one call in the /opt/plesk/php/7.4/etc/php.d/oci.ini.

If i delete "extension=oci8.so" fro oci.ini, there is no more error but still no "oci8" module in the phpinfo().

An idea of the problem?
Thank you very much.
 
So i've uninstall and reinstall:

# echo "instantclient,/opt/oracle/instantclient_19_14" | /opt/plesk/php/7.4/bin/pecl install oci8-2.2.0
# service apache2 restart

I've activated "oci8" in the plesk panel / PHP settings (7.4) / extensions.
There is "extension=oci8.so" in the php.ini file

No error in:
# /opt/plesk/php/7.4/bin/php -m
[PHP Modules]
bcmath
bz2
...
oci8
...

But no OCI8 extension available (control with a phpinfo in a file) on a website with 7.4.
is there anything else to activate?

Thank you for your help.
 
And:

# /opt/plesk/php/7.4/bin/php --ri oci8

oci8

OCI8 Support => enabled
OCI8 DTrace Support => disabled
OCI8 Version => 2.2.0
Oracle Run-time Client Library Version => 19.14.0.0.0
Oracle Compile-time Instant Client Version => 19.14

Directive => Local Value => Master Value
oci8.max_persistent => -1 => -1
oci8.persistent_timeout => -1 => -1
oci8.ping_interval => 60 => 60
oci8.privileged_connect => Off => Off
oci8.statement_cache_size => 20 => 20
oci8.default_prefetch => 100 => 100
oci8.old_oci_close_semantics => Off => Off
oci8.connection_class => no value => no value
oci8.events => Off => Off

Statistics =>
Active Persistent Connections => 0
Active Connections => 0
 
What about

# /opt/plesk/php/7.4/bin/php -i | grep oci8

?
 
# /opt/plesk/php/7.4/bin/php -i | grep oci8
oci8
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


my phpinfo attached.
I don't understand why "#/opt/plesk/php/7.4/bin/php --ri oci8" is ok and not web page with phpinfo.

Same php.ini used... : /opt/plesk/php/7.4/etc/php.ini

# /opt/plesk/php/7.4/bin/php --ini
Configuration File (php.ini) Path: /opt/plesk/php/7.4/etc
Loaded Configuration File: /opt/plesk/php/7.4/etc/php.ini
Scan for additional .ini files in: /opt/plesk/php/7.4/etc/php.d
Additional .ini files parsed: /opt/plesk/php/7.4/etc/php.d/00-ioncube-loader.ini,
/opt/plesk/php/7.4/etc/php.d/10-opcache.ini,
/opt/plesk/php/7.4/etc/php.d/20-mysqlnd.ini,
/opt/plesk/php/7.4/etc/php.d/50-xdebug.ini,
/opt/plesk/php/7.4/etc/php.d/bcmath.ini,
/opt/plesk/php/7.4/etc/php.d/curl.ini,
/opt/plesk/php/7.4/etc/php.d/dba.ini,
/opt/plesk/php/7.4/etc/php.d/dom.ini,
/opt/plesk/php/7.4/etc/php.d/enchant.ini,
/opt/plesk/php/7.4/etc/php.d/fileinfo.ini,
/opt/plesk/php/7.4/etc/php.d/gd.ini,
/opt/plesk/php/7.4/etc/php.d/imagick.ini,
/opt/plesk/php/7.4/etc/php.d/imap.ini,
/opt/plesk/php/7.4/etc/php.d/intl.ini,
/opt/plesk/php/7.4/etc/php.d/json.ini,
/opt/plesk/php/7.4/etc/php.d/ldap.ini,
/opt/plesk/php/7.4/etc/php.d/mbstring.ini,
/opt/plesk/php/7.4/etc/php.d/memcached.ini,
/opt/plesk/php/7.4/etc/php.d/mysqli.ini,
/opt/plesk/php/7.4/etc/php.d/oauth.ini,
/opt/plesk/php/7.4/etc/php.d/oci.ini,
/opt/plesk/php/7.4/etc/php.d/odbc.ini,
/opt/plesk/php/7.4/etc/php.d/pdo.ini,
/opt/plesk/php/7.4/etc/php.d/pdo_mysql.ini,
/opt/plesk/php/7.4/etc/php.d/pdo_odbc.ini,
/opt/plesk/php/7.4/etc/php.d/pdo_pgsql.ini,
/opt/plesk/php/7.4/etc/php.d/pdo_sqlite.ini,
/opt/plesk/php/7.4/etc/php.d/pgsql.ini,
/opt/plesk/php/7.4/etc/php.d/phar.ini,
/opt/plesk/php/7.4/etc/php.d/posix.ini,
/opt/plesk/php/7.4/etc/php.d/pspell.ini,
/opt/plesk/php/7.4/etc/php.d/redis.ini,
/opt/plesk/php/7.4/etc/php.d/snmp.ini,
/opt/plesk/php/7.4/etc/php.d/soap.ini,
/opt/plesk/php/7.4/etc/php.d/sodium.ini,
/opt/plesk/php/7.4/etc/php.d/sqlite3.ini,
/opt/plesk/php/7.4/etc/php.d/sysvmsg.ini,
/opt/plesk/php/7.4/etc/php.d/sysvsem.ini,
/opt/plesk/php/7.4/etc/php.d/sysvshm.ini,
/opt/plesk/php/7.4/etc/php.d/tidy.ini,
/opt/plesk/php/7.4/etc/php.d/xmlreader.ini,
/opt/plesk/php/7.4/etc/php.d/xmlrpc.ini,
/opt/plesk/php/7.4/etc/php.d/xmlwriter.ini,
/opt/plesk/php/7.4/etc/php.d/xsl.ini,
/opt/plesk/php/7.4/etc/php.d/zip.ini

# vi /opt/plesk/php/7.4/etc/php.d/oci.ini
extension=oci8.so
 

Attachments

  • phpinfo2.jpg
    phpinfo2.jpg
    1.6 MB · Views: 3
  • phpinfo1.jpg
    phpinfo1.jpg
    1.2 MB · Views: 4
But the functionality of your site or web application that required this module is being implemented?
If everything works as it should, what does it matter if this module is reflected in phpinfo()?
 
It doesn't work.

<?php
if (!extension_loaded('oci8'))
die("Extension 'OCI8' NOTOK!");
else
die("Extension 'OCI8' OK!");


Could the problem be environment variables? everything looks good to me though
 
Could it be missing execute files rights?
but I don't see where.

I've tested by removing environment variables (found comments that this isn't/no longer needed).

# export LD_LIBRARY_PATH=/opt/oracle/instantclient_19_14
# echo "export LD_LIBRARY_PATH=/opt/oracle/instantclient_19_14" >> /etc/apache2/envvars
# echo "export ORACLE_HOME=/opt/oracle/instantclient_19_14" >> /etc/apache2/envvars
# echo "LD_LIBRARY_PATH=/opt/oracle/instantclient_19_14:$LD_LIBRARY_PATH" >> /etc/environment

i've comment in /etc/apache2/envvars and /etc/environment.

they have disappeared from the phpinfo() that I call by a page.
But no change, the extension is still not visible on the web.
 
Here are my steps with success in phpinfo():

# mkdir /opt/oracle
# cd /opt/oracle
# wget https://download.oracle.com/otn_sof...tantclient-basic-linux.x64-21.6.0.0.0dbru.zip
# wget https://download.oracle.com/otn_sof...tantclient-basic-linux.x64-21.6.0.0.0dbru.zip
# unzip instantclient-basic-linux.x64-21.6.0.0.0dbru.zip
# unzip instantclient-sdk-linux.x64-21.6.0.0.0dbru.zip
# echo /opt/oracle/instantclient_21_6 > /etc/ld.so.conf.d/oracle-instantclient
# ldconfig
# /opt/plesk/php/7.4/bin/pecl install oci8-2.2.0 with (Please provide the path to the ORACLE_HOME directory. Use 'instantclient,/path/to/instant/client/lib' if you're compiling with Oracle Instant Client [autodetect] : instantclient,/opt/oracle/instantclient_21_6 )
# echo "extension=oci8.so" > /opt/plesk/php/7.4/etc/php.d/oci.ini
# cp instantclient_21_6/libnnz21.so /usr/lib/
# cp instantclient_21_6/libclntshcore.so.21.1 /usr/lib/
# ldconfig
# plesk bin php_handler --reread
# systemctl restart plesk-php74-fpm

After that:

Screenshot 17.png
 
On my side I did not have:
# cp instantclient_21_6/libnnz21.so /usr/lib/
# cp instantclient_21_6/libclntshcore.so.21.1 /usr/lib/

All works fine after that.

Great thank you Igor.
 
Hello,

I was a little too fast...
I encountered a new problem after the installation: when connecting to the database, there is this message:

oci_connect(): OCIEnvNlsCreate() failed. There is something wrong with your system - please check that LD_LIBRARY_PATH includes the directory with Oracle Instant Client libraries

The messages about this error are not clear: sometimes it is necessary to indicate them, sometimes precisely not to do so.
One way or the other, it doesn't matter. Always this error. the roads are good.

Note: we use instantclient_19_14:
# export LD_LIBRARY_PATH=/opt/oracle/instantclient_19_14
# echo "export LD_LIBRARY_PATH=/opt/oracle/instantclient_19_14" >> /etc/apache2/envvars
# echo "export ORACLE_HOME=/opt/oracle/instantclient_19_14" >> /etc/apache2/envvars
# echo "LD_LIBRARY_PATH=/opt/oracle/instantclient_19_14:$LD_LIBRARY_PATH" >> /etc/environment

If someone has an idea ? Thank you.
 
A quick search on the error message gives that you should not set ORACLE_HOME:


 
It is not so clear depending on the versions and environments.
I tested without any variables, only with LD_LIBRARY_PATH. I always have the error.

Since, i've (a little) advanced.

Initial situation: no variable
== command line
# /opt/plesk/php/7.4/bin/php mytest_connexion.php
==> error

== domain
=> error

If I set the following variable:
# export LD_LIBRARY_PATH=/opt/oracle/instantclient_19_14

An load the test with the command line, it works fine:
# /opt/plesk/php/7.4/bin/php test_oracle.php
==> ok

if I add the variable LD_LIBRARY_PATH in "/etc/apache2/envvars" and "/etc/environment", it is not retrieved in the test launched via the domain.
# echo "export LD_LIBRARY_PATH=/opt/oracle/instantclient_19_14" >> /etc/apache2/envvars
# echo "LD_LIBRARY_PATH=/opt/oracle/instantclient_19_14:$LD_LIBRARY_PATH" >> /etc/environment

=> error

I try to load Additionnel directives in Plesk PHP Settings:
[php-fpm-pool-settings]
env[LD_LIBRARY_PATH] = /opt/oracle/instantclient_19_14

=> error

:(
 
[php-fpm-pool-settings]
env[LD_LIBRARY_PATH] = /opt/oracle/instantclient_19_14

echo getEnv("LD_LIBRARY_PATH"); => /opt/oracle/instantclient_19_14

But always:
oci_connect(): OCIEnvNlsCreate() failed. There is something wrong with your system - please check that LD_LIBRARY_PATH includes the directory with Oracle Instant Client libraries

Is there another assignment to do for Apache?
 
Back
Top