Topic: Issue with Apache/PHP5.6 and PHP PECL pdo ibm

Hi

I've got a problem with Apache/Php with PHP PECL pdo ibm 1.3.5
- CentOS 7.4.1708
- Apache 2.4.29 from codeit
- PHP 5.6 from Remi installed in /opt/remi/php56/ (Great stuff by the way - Many thanks for all your work!)
- Note: One of the reason for using PHP 5.6 is the PHP PECL pdo ibm doesn't work with PHP 7+... It compiles but doesn't work so I'm stuck on 5.6 for the time being.
- DB2 Express-c v11.1 installed as per default options in /opt/ibm/db2/V11.1/ and /home/db2inst1/

# su - db2inst1
$ db2
(c) Copyright IBM Corporation 1993,2007
Command Line Processor for DB2 Client 11.1.2.2

I've catalogued the DB:

$ db2 "list node directory"

 Node Directory

 Number of entries in the directory = 1

Node 1 entry:

 Node name                      = R_10_26
 Comment                        =
 Directory entry type           = LOCAL
 Protocol                       = TCPIP
 Hostname                       = 10.xx.xx.xx
 Service name                   = 50000

 $ db2 "list database directory"

  System Database Directory

  Number of entries in the directory = 1

 Database 1 entry:

  Database alias                       = MGEN1
  Database name                        = GEN1
  Node name                            = R_10_26
  Database release level               = 14.00
  Comment                              =
  Directory entry type                 = Remote
  Authentication                       = SERVER_ENCRYPT
  Catalog database partition number    = -1
  Alternate server hostname            =
  Alternate server port number         =


 # cat /etc/profile.d/php56.sh
 # Enabling Remi PHP 5.6
 source /opt/remi/php56/enable
 

# ls -la /opt/remi/php56/root/usr/lib64/php/modules/
total 7.7M
drwxr-xr-x. 2 root root 4.0K Dec 14 14:53 ./
drwxr-xr-x. 3 root root   20 Oct 25 05:18 ../
-rwxr-xr-x. 1 root root 151K Oct 19 16:34 amqp.so*
-rwxr-xr-x. 1 root root 105K Apr 20  2016 apcu.so*
-rwxr-xr-x. 1 root root  25K Oct 25 05:19 bz2.so*
-rwxr-xr-x. 1 root root  33K Oct 25 05:19 calendar.so*
-rwxr-xr-x. 1 root root  16K Oct 25 05:19 ctype.so*
-rwxr-xr-x. 1 root root  85K Oct 25 05:19 curl.so*
-rwxr-xr-x. 1 root root 177K Oct 25 05:19 dom.so*
-rwxr-xr-x. 1 root root  64K Oct 25 05:19 exif.so*
-rwxr-xr-x. 1 root root 2.8M Oct 25 05:19 fileinfo.so*
-rwxr-xr-x. 1 root root  57K Oct 25 05:19 [url=ftp://ftp.so]ftp.so[/url]*
-rwxr-xr-x. 1 root root  16K Oct 25 05:19 gettext.so*
-rwxr-xr-x. 1 root root  45K Oct 25 05:19 iconv.so*
-rwxr-xr-x. 1 root root  56K Nov  5 18:28 igbinary.so*
-rwxr-xr-x. 1 root root  78K Jun 15  2016 json.so*
-rwxr-xr-x. 1 root root 1.4M Oct 25 05:19 mbstring.so*
-rwxr-xr-x. 1 root root  49K Oct 25 05:19 mcrypt.so*
-rwxr-xr-x. 1 root root 151K Oct 25 05:19 opcache.so*
-rwxr-xr-x. 1 root root  41K Dec 14 14:52 pdo_ibm.so*
-rwxr-xr-x. 1 root root  45K Oct 25 05:19 pdo_pgsql.so*
-rwxr-xr-x. 1 root root 118K Oct 25 05:19 pdo.so*
-rwxr-xr-x. 1 root root  29K Oct 25 05:19 pdo_sqlite.so*
-rwxr-xr-x. 1 root root 143K Oct 25 05:19 pgsql.so*
-rwxr-xr-x. 1 root root 266K Oct 25 05:19 phar.so*
-rwxr-xr-x. 1 root root  33K Oct 25 05:19 posix.so*
-rwxr-xr-x. 1 root root 463K Nov  5 19:03 redis.so*
-rwxr-xr-x. 1 root root  16K Oct 25 05:19 shmop.so*
-rwxr-xr-x. 1 root root  53K Oct 25 05:19 simplexml.so*
-rwxr-xr-x. 1 root root 360K Oct 25 05:19 soap.so*
-rwxr-xr-x. 1 root root  90K Oct 25 05:19 sockets.so*
-rwxr-xr-x. 1 root root  51K Oct 25 05:19 sqlite3.so*
-rwxr-xr-x. 1 root root  79K Nov 10  2016 ssh2.so*
-rwxr-xr-x. 1 root root  20K Oct 25 05:19 sysvmsg.so*
-rwxr-xr-x. 1 root root  12K Oct 25 05:19 sysvsem.so*
-rwxr-xr-x. 1 root root  16K Oct 25 05:19 sysvshm.so*
-rwxr-xr-x. 1 root root  20K Oct 25 05:19 tokenizer.so*
-rwxr-xr-x. 1 root root  40K Oct 25 05:19 wddx.so*
-rwxr-xr-x. 1 root root 248K Jun 21 16:59 xdebug.so*
-rwxr-xr-x. 1 root root  29K Aug 25  2014 xhprof.so*
-rwxr-xr-x. 1 root root  33K Oct 25 05:19 xmlreader.so*
-rwxr-xr-x. 1 root root  53K Oct 25 05:19 xml.so*
-rwxr-xr-x. 1 root root  49K Oct 25 05:19 xmlwriter.so*
-rwxr-xr-x. 1 root root  37K Oct 25 05:19 xsl.so*
-rwxr-xr-x. 1 root root  66K Jul 11 10:29 zip.so*

# ls -la /opt/remi/php56/root/etc/php.d/
total 224K
drwxr-xr-x.  2 root root 4.0K Dec 14 17:36 ./
drwxr-xr-x. 13 root root 4.0K Dec 14 17:54 ../
-rw-r--r--.  1 root root 3.8K Oct 25 05:15 10-opcache.ini
-rw-r--r--.  1 root root  37K Jun 21 16:59 15-xdebug.ini
-rw-r--r--.  1 root root   47 Oct 25 05:18 20-bz2.ini
-rw-r--r--.  1 root root   57 Oct 25 05:18 20-calendar.ini
-rw-r--r--.  1 root root   51 Oct 25 05:18 20-ctype.ini
-rw-r--r--.  1 root root   49 Oct 25 05:18 20-curl.ini
-rw-r--r--.  1 root root   47 Oct 25 05:18 20-dom.ini
-rw-r--r--.  1 root root   49 Oct 25 05:18 20-exif.ini
-rw-r--r--.  1 root root   57 Oct 25 05:18 20-fileinfo.ini
-rw-r--r--.  1 root root   47 Oct 25 05:18 20-ftp.ini
-rw-r--r--.  1 root root   55 Oct 25 05:18 20-gettext.ini
-rw-r--r--.  1 root root   51 Oct 25 05:18 20-iconv.ini
-rw-r--r--.  1 root root   57 Oct 25 05:18 20-mbstring.ini
-rw-r--r--.  1 root root   53 Oct 25 05:18 20-mcrypt.ini
-rw-r--r--.  1 root root   47 Oct 25 05:18 20-pdo.ini
-rw-r--r--.  1 root root   51 Oct 25 05:18 20-pgsql.ini
-rw-r--r--.  1 root root   49 Oct 25 05:18 20-phar.ini
-rw-r--r--.  1 root root   51 Oct 25 05:18 20-posix.ini
-rw-r--r--.  1 root root   51 Oct 25 05:18 20-shmop.ini
-rw-r--r--.  1 root root   59 Oct 25 05:18 20-simplexml.ini
-rw-r--r--.  1 root root   49 Oct 25 05:18 20-soap.ini
-rw-r--r--.  1 root root   55 Oct 25 05:18 20-sockets.ini
-rw-r--r--.  1 root root   55 Oct 25 05:18 20-sqlite3.ini
-rw-r--r--.  1 root root   55 Oct 25 05:18 20-sysvmsg.ini
-rw-r--r--.  1 root root   55 Oct 25 05:18 20-sysvsem.ini
-rw-r--r--.  1 root root   55 Oct 25 05:18 20-sysvshm.ini
-rw-r--r--.  1 root root   59 Oct 25 05:18 20-tokenizer.ini
-rw-r--r--.  1 root root   47 Oct 25 05:18 20-xml.ini
-rw-r--r--.  1 root root   59 Oct 25 05:18 20-xmlwriter.ini
-rw-r--r--.  1 root root   47 Oct 25 05:18 20-xsl.ini
-rw-r--r--.  1 root root   57 Dec 14 17:36 30-pdo_ibm.ini
-rw-r--r--.  1 root root   59 Oct 25 05:18 30-pdo_pgsql.ini
-rw-r--r--.  1 root root   61 Oct 25 05:18 30-pdo_sqlite.ini
-rw-r--r--.  1 root root   49 Oct 25 05:18 30-wddx.ini
-rw-r--r--.  1 root root   59 Oct 25 05:18 30-xmlreader.ini
-rw-r--r--.  1 root root 1.1K Oct 19 16:34 40-amqp.ini
-rw-r--r--.  1 root root 2.4K Apr 20  2016 40-apcu.ini
-rw-r--r--.  1 root root  293 Nov  5 18:28 40-igbinary.ini
-rw-r--r--.  1 root root   51 Jun 15  2016 40-json.ini
-rw-r--r--.  1 root root   58 Dec 14 12:04 40-pdo_ibm.ini-BAK
-rw-r--r--.  1 root root   49 Nov 10  2016 40-ssh2.ini
-rw-r--r--.  1 root root  223 Aug 25  2014 40-xhprof.ini
-rw-r--r--.  1 root root   47 Jul 11 10:29 40-zip.ini
-rw-r--r--.  1 root root  717 Nov  5 19:03 50-redis.ini
-rw-r--r--.  1 root root  645 Oct 25 05:18 opcache-default.blacklist

# cat /opt/remi/php56/root/etc/php.d/30-pdo_ibm.ini
; Enable pdo_ibm extension module
extension = pdo_ibm.so

I've got a .php script which I can run from the cli.
# cat DB2-Test.php

<?php

try
{
    echo "Attempting to obtain MGEN1 connection...\n";

    //$db1= new PDO("ibm:DATABASE=GEN1;HOSTNAME=10.xx.xx.xx;PORT=50000;", "something", "password", array(
    //    PDO::ATTR_CASE=> PDO::CASE_NATURAL,
    //    PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
    //);

    //$db1= new PDO("ibm:DATABASE=GEN1;HOSTNAME=10.xx.xx.xx;PORT=50000;", "something", "password", array(
    //    PDO::ATTR_CASE=> PDO::CASE_NATURAL)
    //);

    $db1= new PDO("ibm:DSN=MGEN1", "something", "password", array(
        PDO::ATTR_CASE=> PDO::CASE_NATURAL)
    );

    echo "Got MGEN1 connection.\n\n";
}
catch(PDOException $e)
{
    var_dump($e->getTrace());
    die("Connection error: ".$e->getMessage());
}

$supported_attributes = array(
    "AUTOCOMMIT", "ERRMODE", "CASE", "CLIENT_VERSION", "ORACLE_NULLS", "PERSISTENT", "SERVER_INFO"
);

$unsupported_attributes = array(
    "CONNECTION_STATUS", "PREFETCH", "SERVER_VERSION", "TIMEOUT"
);

echo "MGEN1: Test _SUPPORTED_ attributes:\n";
foreach ($supported_attributes as $val) {
    echo "PDO::ATTR_$val: ";
    echo $db1->getAttribute(constant("PDO::ATTR_$val")) . "\n";
}

echo "\n";
echo "MGEN1: Test _UNSUPPORTED_ attributes:\n";
foreach ($unsupported_attributes as $val) {
    echo "PDO::ATTR_$val: ";
    echo $db1->getAttribute(constant("PDO::ATTR_$val")) . "\n";
}
?>


Initially running:
$ php DB2-Test.php
would output:
Connection error: SQLSTATE=, SQLAllocHandle: 0

I fixed this by adding:

# cat /etc/profile.d/db2.sh
# To set up the env for DB2 Express v11.1
source /home/db2inst1/sqllib/db2profile

Now it connects correctly:

$ php DB2-Test.php
Attempting to obtain MGEN1 connection...
Got MGEN1 connection.

MGEN1: Test _SUPPORTED_ attributes:
PDO::ATTR_AUTOCOMMIT: 1
PDO::ATTR_ERRMODE: 0
PDO::ATTR_CASE: 0
PDO::ATTR_CLIENT_VERSION: 1.3.5
PDO::ATTR_ORACLE_NULLS: 0
PDO::ATTR_PERSISTENT:
PDO::ATTR_SERVER_INFO: DB2/NT64

MGEN1: Test _UNSUPPORTED_ attributes:
PDO::ATTR_CONNECTION_STATUS: PHP Warning:  PDO::getAttribute(): SQLSTATE[IM001]: Driver does not support this function: driver does not support that attribute in /home/sammy/Downloads/DB2-Test.php on line 73
PHP Stack trace:
PHP   1. {main}() /home/sammy/Downloads/DB2-Test.php:0
PHP   2. PDO->getAttribute() /home/sammy/Downloads/DB2-Test.php:73

Warning: PDO::getAttribute(): SQLSTATE[IM001]: Driver does not support this function: driver does not support that attribute in /home/sammy/Downloads/DB2-Test.php on line 73

Call Stack:
    0.0003     237544   1. {main}() /home/sammy/Downloads/DB2-Test.php:0
    1.4856     245288   2. PDO->getAttribute() /home/sammy/Downloads/DB2-Test.php:73


PDO::ATTR_PREFETCH: PHP Warning:  PDO::getAttribute(): SQLSTATE[IM001]: Driver does not support this function: driver does not support that attribute in /home/sammy/Downloads/DB2-Test.php on line 73
PHP Stack trace:
PHP   1. {main}() /home/sammy/Downloads/DB2-Test.php:0
PHP   2. PDO->getAttribute() /home/sammy/Downloads/DB2-Test.php:73

Warning: PDO::getAttribute(): SQLSTATE[IM001]: Driver does not support this function: driver does not support that attribute in /home/sammy/Downloads/DB2-Test.php on line 73

Call Stack:
    0.0003     237544   1. {main}() /home/sammy/Downloads/DB2-Test.php:0
    1.4857     245288   2. PDO->getAttribute() /home/sammy/Downloads/DB2-Test.php:73


PDO::ATTR_SERVER_VERSION: PHP Warning:  PDO::getAttribute(): SQLSTATE[IM001]: Driver does not support this function: driver does not support that attribute in /home/sammy/Downloads/DB2-Test.php on line 73
PHP Stack trace:
PHP   1. {main}() /home/sammy/Downloads/DB2-Test.php:0
PHP   2. PDO->getAttribute() /home/sammy/Downloads/DB2-Test.php:73

Warning: PDO::getAttribute(): SQLSTATE[IM001]: Driver does not support this function: driver does not support that attribute in /home/sammy/Downloads/DB2-Test.php on line 73

Call Stack:
    0.0003     237544   1. {main}() /home/sammy/Downloads/DB2-Test.php:0
    1.4858     245288   2. PDO->getAttribute() /home/sammy/Downloads/DB2-Test.php:73


PDO::ATTR_TIMEOUT: PHP Warning:  PDO::getAttribute(): SQLSTATE[IM001]: Driver does not support this function: driver does not support that attribute in /home/sammy/Downloads/DB2-Test.php on line 73
PHP Stack trace:
PHP   1. {main}() /home/sammy/Downloads/DB2-Test.php:0
PHP   2. PDO->getAttribute() /home/sammy/Downloads/DB2-Test.php:73

Warning: PDO::getAttribute(): SQLSTATE[IM001]: Driver does not support this function: driver does not support that attribute in /home/sammy/Downloads/DB2-Test.php on line 73

Call Stack:
    0.0003     237544   1. {main}() /home/sammy/Downloads/DB2-Test.php:0
    1.4859     245288   2. PDO->getAttribute() /home/sammy/Downloads/DB2-Test.php:73

However when trying to access the same catalogued DB from Apache/Php I get the same connection error I had initially running my script from the cli.
Note other Php extensions work fine. I can access Redis, etc...

I'm at loss to understand what's missing in the Apache/Php env to make it work.

It's probably something dead simple at that stage but it's eluding me...

I've tried to add /etc/httpd/conf.d/db2.conf with:

# cat /etc/httpd/conf.d/db2.conf
SetEnv   DB2INSTANCE       db2inst1
SetEnv   IBM_DB_LIB        /home/db2inst1/sqllib/lib
SetEnv   IBM_DB_DIR        /home/db2inst1/sqllib
SetEnv   LD_LIBRARY_PATH   /opt/remi/php56/root/usr/lib64:/home/db2inst1/sqllib/lib64:/home/db2inst1/sqllib/lib64/gskit:/home/db2inst1/sqllib/lib32
SetEnv   IBM_DB_HOME       /home/db2inst1/sqllib
SetEnv   PATH              /opt/remi/php56/root/usr/bin:/opt/remi/php56/root/usr/sbin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/home/db2inst1/sqllib/bin:/home/db2inst1/sqllib/adm:/home/db2inst1/sqllib/misc:/home/db2inst1/sqllib/db2tss/bin:/root/bin
SetEnv   DB2_HOME          /home/db2inst1/sqllib
SetEnv   IBM_DB_INCLUDE    /home/db2inst1/sqllib/include
SetEnv   CLASSPATH         /home/db2inst1/sqllib/java/db2java.zip:/home/db2inst1/sqllib/java/sqlj.zip:/home/db2inst1/sqllib/function:/home/db2inst1/sqllib/java/db2jcc_license_cu.jar:/home/db2inst1/sqllib/tools/clpplus.jar:/home/db2inst1/sqllib/tools/jline-0.9.93.jar:/home/db2inst1/sqllib/java/db2jcc.jar:.
SetEnv   DB2LIB            /home/db2inst1/sqllib/lib
SetEnv   PDO_IBM.db2_instance_name db2inst1

and I can access these vars from PHP but it still doesn't solve the problem...

Any clue?

Cheers

Re: Issue with Apache/PHP5.6 and PHP PECL pdo ibm

Sorry, but I don't know this extension (one of the rare not available in my repository, because I don't have the client library and any way to test it)

I don't really have any real idea.

Perhaps (like for Oracle), the needed environment need to be defined in the /etc/sysconfig/httpd file (using mod_php) or /opt/remi/php56/root/etc/sysconfig/php-fpm (for php-fpm) to be available during the php startup (especially the LD_LIBRARY_PATH)


P.S. or in systemd unit override file on C7 (using systemctl edit ...)

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: Issue with Apache/PHP5.6 and PHP PECL pdo ibm

Hi Remi
Thanks for your reply. It pointed me in the right direction I think.

Created /etc/systemd/system/httpd.service.d/override.conf with:

[Service]
Environment=OPTIONS=-DLD_LIBRARY_PATH=/opt/remi/php56/root/usr/lib64:/home/db2inst1/sqllib/lib64:/home/db2inst1/sqllib/lib64/gskit:/home/db2inst1/sqllib/lib32

# systemctl daemon-reload
# systemctl restart httpd

Still not working...

However starting httpd with:

# /usr/sbin/httpd -DLD_LIBRARY_PATH=/opt/remi/php56/root/usr/lib64:/home/db2inst1/sqllib/lib64:/home/db2inst1/sqllib/lib64/gskit:/home/db2inst1/sqllib/lib32 -DFOREGROUND
works and can access DB2 with pdo_ibm.so from Apache/PHP5.6

So at least the pdo_ibm.so works. One least question marks.

In /etc/systemd/system/multi-user.target.wants
httpd.service -> /usr/lib/systemd/system/httpd.service

# cat httpd.service
# See httpd.service(8) for more information on using the httpd service.

# Modifying this file in-place is not recommended, because changes
# will be overwritten during package upgrades.  To customize the
# behaviour, run "systemctl edit httpd" to create an override unit.

# For example, to pass additional options (such as -D definitions) to
# the httpd binary at startup, create an override unit (as is done by
# systemctl edit) and enter the following:

#    [Service]
#    Environment=OPTIONS=-DMY_DEFINE

[Unit]
Description=The Apache HTTP Server
Wants=httpd-init.service
After=network.target remote-fs.target nss-lookup.target httpd-init.service
Documentation=man:httpd.service(8)

[Service]
Type=notify
Environment=LANG=C

ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND
ExecReload=/usr/sbin/httpd $OPTIONS -k graceful
# Send SIGWINCH for graceful stop
KillSignal=SIGWINCH
KillMode=mixed
PrivateTmp=true

[Install]
WantedBy=multi-user.target


Starting with systemctl
13864 ?        Ss     0:00 /usr/sbin/httpd -DLD_LIBRARY_PATH=/opt/remi/php56/root/usr/lib64:/home/db2inst1/sqllib/lib64:/home/db2inst1/sqllib/lib64/gskit:/home/db2inst1/sqllib/lib32 -DFOREGROUND
13865 ?        Sl     0:00  \_ /usr/sbin/httpd -DLD_LIBRARY_PATH=/opt/remi/php56/root/usr/lib64:/home/db2inst1/sqllib/lib64:/home/db2inst1/sqllib/lib64/gskit:/home/db2inst1/sqllib/lib32 -DFOREGROUND
13866 ?        Sl     0:00  \_ /usr/sbin/httpd -DLD_LIBRARY_PATH=/opt/remi/php56/root/usr/lib64:/home/db2inst1/sqllib/lib64:/home/db2inst1/sqllib/lib64/gskit:/home/db2inst1/sqllib/lib32 -DFOREGROUND
13867 ?        Sl     0:00  \_ /usr/sbin/httpd -DLD_LIBRARY_PATH=/opt/remi/php56/root/usr/lib64:/home/db2inst1/sqllib/lib64:/home/db2inst1/sqllib/lib64/gskit:/home/db2inst1/sqllib/lib32 -DFOREGROUND
13868 ?        Sl     0:00  \_ /usr/sbin/httpd -DLD_LIBRARY_PATH=/opt/remi/php56/root/usr/lib64:/home/db2inst1/sqllib/lib64:/home/db2inst1/sqllib/lib64/gskit:/home/db2inst1/sqllib/lib32 -DFOREGROUND
13873 ?        Sl     0:00  \_ /usr/sbin/httpd -DLD_LIBRARY_PATH=/opt/remi/php56/root/usr/lib64:/home/db2inst1/sqllib/lib64:/home/db2inst1/sqllib/lib64/gskit:/home/db2inst1/sqllib/lib32 -DFOREGROUND
pdo_ibm.so not happy. Can't access DB...

Starting with /usr/sbin/httpd -DLD_LIBRARY_PATH=/opt/remi/php56/root/usr/lib64:/home/db2inst1/sqllib/lib64:/home/db2inst1/sqllib/lib64/gskit:/home/db2inst1/sqllib/lib32 -DFOREGROUND
Process stays in foreground. Can access DB!
25016 pts/0    S      0:00  |                   \_ -bash
14628 pts/0    S+     0:00  |                       \_ /usr/sbin/httpd -DLD_LIBRARY_PATH=/opt/remi/php56/root/usr/lib64:/home/db2inst1/sqllib/lib64:/home/db2inst1/sqllib/lib64/gskit:/home/db2inst1/sqllib/lib32 -DFOREGROUND
14630 pts/0    Sl+    0:00  |                           \_ /usr/sbin/httpd -DLD_LIBRARY_PATH=/opt/remi/php56/root/usr/lib64:/home/db2inst1/sqllib/lib64:/home/db2inst1/sqllib/lib64/gskit:/home/db2inst1/sqllib/lib32 -DFOREGROUND
14631 pts/0    Sl+    0:00  |                           \_ /usr/sbin/httpd -DLD_LIBRARY_PATH=/opt/remi/php56/root/usr/lib64:/home/db2inst1/sqllib/lib64:/home/db2inst1/sqllib/lib64/gskit:/home/db2inst1/sqllib/lib32 -DFOREGROUND
14636 pts/0    Sl+    0:00  |                           \_ /usr/sbin/httpd -DLD_LIBRARY_PATH=/opt/remi/php56/root/usr/lib64:/home/db2inst1/sqllib/lib64:/home/db2inst1/sqllib/lib64/gskit:/home/db2inst1/sqllib/lib32 -DFOREGROUND
14637 pts/0    Sl+    0:00  |                           \_ /usr/sbin/httpd -DLD_LIBRARY_PATH=/opt/remi/php56/root/usr/lib64:/home/db2inst1/sqllib/lib64:/home/db2inst1/sqllib/lib64/gskit:/home/db2inst1/sqllib/lib32 -DFOREGROUND
14643 pts/0    Sl+    0:00  |                           \_ /usr/sbin/httpd -DLD_LIBRARY_PATH=/opt/remi/php56/root/usr/lib64:/home/db2inst1/sqllib/lib64:/home/db2inst1/sqllib/lib64/gskit:/home/db2inst1/sqllib/lib32 -DFOREGROUND

What is this trickery? Going mad...

Re: Issue with Apache/PHP5.6 and PHP PECL pdo ibm

Running from CLI inherits your env, so is not a good test

Try, in the override.conf

[Service]
Environment=LD_LIBRARY_PATH=/opt/remi/php56/root/usr/lib64:/home/db2inst1/sqllib/lib64:/home/db2inst1/sqllib/lib64/gskit:/home/db2inst1/sqllib/lib32
Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: Issue with Apache/PHP5.6 and PHP PECL pdo ibm

Hi Remi

Already tried in my previous post:
Correct format is:

[Service]
Environment=OPTIONS=-DLD_LIBRARY_PATH=/opt/remi/php56/root/usr/lib64:/home/db2inst1/sqllib/lib64:/home/db2inst1/sqllib/lib64/gskit:/home/db2inst1/sqllib/lib32

Tried in /etc/sysconfig/httpd (because the apachectl script still source this file...)
/etc/sysconfig/httpd
LD_LIBRARY_PATH=/opt/remi/php56/root/usr/lib64:/home/db2inst1/sqllib/lib64:/home/db2inst1/sqllib/lib64/gskit:/home/db2inst1/sqllib/lib32


Starting Apache with systemctl OR apachectl yields negative results...

The only way it works is when starting Apache with:

# /usr/sbin/httpd -DLD_LIBRARY_PATH=/opt/remi/php56/root/usr/lib64:/home/db2inst1/sqllib/lib64:/home/db2inst1/sqllib/lib64/gskit:/home/db2inst1/sqllib/lib32 -DFOREGROUND
OR
# /usr/sbin/httpd -DLD_LIBRARY_PATH=/opt/remi/php56/root/usr/lib64:/home/db2inst1/sqllib/lib64:/home/db2inst1/sqllib/lib64/gskit:/home/db2inst1/sqllib/lib32 -DBACKGROUND

Re: Issue with Apache/PHP5.6 and PHP PECL pdo ibm

> Starting Apache with systemctl OR apachectl yields negative results...

Again, test from CLI have NO VALUE, as it inherits everything defined in your environment.

To understand needed library path

ldd /path/to/pdo_idm.so

(btw, if missing library you should have a error message in the log, about unable to load the extension)

so you probably need more in your env...
again... I have absolutely no way to test, but obviously, issue is in environment used

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: Issue with Apache/PHP5.6 and PHP PECL pdo ibm

Well well well it all came down to this:

# cat /etc/systemd/system/httpd.service.d/override.conf
[Service]
Environment=DB2INSTANCE=db2inst1

Now systemctl (and apachectl which defers to systemctl) work as intended.

I sincerely hope this is useful to someone down the line :-)

@Remi - Yes I know the cli env was giving a false test. The problem was finding what was set up in the cli env that was missing for systemctl.

Now on to using php-fpm rather than prefork.

many thanks for the pointers.

Re: Issue with Apache/PHP5.6 and PHP PECL pdo ibm

smile

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi