Forum Stats

  • 3,851,525 Users
  • 2,263,993 Discussions


SIGSEGV on Instantclient 12.2+ (18.5, 19.6) with OCI8-2.2.0



  • Stanislav Studený
    Stanislav Studený Member Posts: 60 Bronze Badge


    • It doesn't matter, if i set env vars before PHP or inside php script - result is always the same - sigsegv.
    • LD_LIBRARY_PATH is ok and this is also managed by ld config files (/etc/ Also ldd is correct on
    • Yes, that's expected and mentioned SQL is intentionally wrong (since X doesn't exists in dual)
    • Do you use the same exact script? (foreach ($bax as $param => &$value) <-- note & before $value

    I know, that DB OCI programmable interface have not so much controls due to the nature of this interface, but i would definitely not expect crash of the client - in any way.



  • Stanislav Studený
    Stanislav Studený Member Posts: 60 Bronze Badge

    The same exact script doesn't sigsegv on 12.1 and older client. And yes, it returns ORA-00904.



  • Stanislav Studený
    Stanislav Studený Member Posts: 60 Bronze Badge
    edited Feb 18, 2021 10:54AM

    If you want, you can edit and use :

    SELECT count(*) FROM dual WHERE (:p_per_id IS NULL OR :p_per_id = :p_per_id) AND :p_right_level_code = 'RA'

    this will trigger SIGSEGV and is correct SQL.

  • Stanislav Studený
    Stanislav Studený Member Posts: 60 Bronze Badge

    I can also reproduce using php-cli with in-line env vars :

    bash-4.4# ORACLE_HOME=/u01/app/oracle/client ORACLE_BASE=/u01/app/oracle NLS_LANG=AMERICAN_AMERICA.AL32UTF8 TNS_ADMIN=/u01/app/oracle/client/network/admin LD_LIBRARY_PATH=/u01/app/oracle/client/lib:/usr/lib:/lib php /www_base/testcase.php

    Aborted (core dumped)

    (putenv in php testcase script fully commented)

  • Christopher Jones-Oracle
    Christopher Jones-Oracle Member Posts: 1,654 Employee

    I tried on OL8.

    dnf install -y php-xml php-devel php-cli php php-mbstring php-gd php-common php-pear php-json php-process

    dnf install -y oracle-instantclient-release-el8

    dnf install -y oracle-instantclient-basic oracle-instantclient-devel

    echo "instantclient,/usr/lib/oracle/21/client64/lib" | pecl install oci8-2.2.0

    Created the oci8 config file, as shown:

    # cat /etc/php.d/99-oci8.ini



    oci8.statement_cache_size = 250

    oci8.persistent_timeout = 3600

    oci8.ping_interval = 10


    I used the script:



    ini_set('display_errors', 'On');

    $connection = oci_connect('cj', 'cj', 'mdt/orclpdb1:pooled', 'AL32UTF8');

    $per_id = null;

    $sql = "SELECT count(*) FROM dual WHERE (:p_per_id IS NULL OR :p_per_id = :p_per_id) AND :p_right_level_code = 'RA'";

    $bax = array(

      'p_per_id' => $per_id

      ,'p_right_level_code' => 'RA'


    if ($connection === false) {

      $m = oci_error($connection);

      trigger_error('Could not connect to database: '. $m['message'], E_USER_ERROR);


    $ociStatement = oci_parse($connection, $sql);

    if ($ociStatement === false) {

      $m = oci_error($connection);

      trigger_error('Could not parse statement: '. $m['message'], E_USER_ERROR);


    foreach ($bax as $param => &$value) {

      if (!oci_bind_by_name($ociStatement, $param, $value, -1, SQLT_CHR )) {

        $m = oci_error($ociStatement);

        trigger_error('Could not bind a parameter: '. $m['message'], E_USER_ERROR);



    if (!oci_execute($ociStatement, OCI_NO_AUTO_COMMIT)) {

      $m = oci_error($ociStatement);

      trigger_error('Could not execute statement: '. $m['message'], E_USER_ERROR);


    oci_fetch_all($ociStatement, $r);





    Ran the script:

    php t.php

    array(1) {


     array(1) {


      string(1) "1"




    I tried both a 19.3 DB and a 21c DB.

    At this stage, you need to continue working on it. You need to share enough info about your environment so I can spot what is going on. (E.g. to check that you don't have ORACLE_HOME set when you are using Instant Client). You have to 'prove' it to me by showing me.

    At the same time, work on the test script and triple-check any possible weak point even if you 'know' it is not a problem: eliminate DRCP. Unroll the bind loop to eliminate the reference use; change the bind to let the type default; see if it is an issue with repeated use of the bind name, etc. etc.