Ad Widget

Collapse

6.0 Frontend Cannot connect to Oracle database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Axxin
    Junior Member
    • Mar 2022
    • 4

    #1

    6.0 Frontend Cannot connect to Oracle database

    Hi all,

    I've been working on installing Zabbix and have run into an issue when trying to configure the frontend. When entering the database connection info from the setup page or when directly modifying the zabbix.conf.php I am getting a error:

    Cannot connect to the database.
    • Error connecting to database:

    A direct connection from sqlplus and the Zabbix server itself is able to connect to the DB with no issues so I imagine it is some issue with the Apache/PHP setup.

    I am using Zabbix 6.0 with an Oracle database and a full Oracle client installed on the server using the tnsnames file.
  • tim.mooney
    Senior Member
    • Dec 2012
    • 1427

    #2
    Hey Axxin-

    PHP comes with a couple of database-related extensions that allow it to talk to the more common open source databases, but most Linux distributions do not include a PHP extension to let it talk to Oracle. Such an extension exists, it's just not packaged by default with most distros.

    What you probably need to do is download the source code for the OCI8 extension for PHP: https://pecl.php.net/package/oci8

    You will need to extract the source code from the bundle and the configure and compile the extension for your particular version of PHP on your OS distro & version. That probably requires that you have one of your distros "php-devel" packages installed, to give you the "phpize" command, which is usually used to help configure an extension you want to build for PHP.

    Once you have the 'oci8.so' extension (or whatever it's called), you'll need to install that in your PHP's extension directory (where the other extensions with .so are) and make sure that there's a php file that causes the extension to be loaded.

    The oci8 extension is frequently linked against the Oracle "InstantClient" package, but if you have a full client installed, the necessary shared libraries are probably present on your system.

    If you get stuck on any of these steps, follow up on this thread. If I see the question, I'll try help, though it's been a few years since we've used PHP with Oracle so I may not have all the answers for you.
    Last edited by tim.mooney; 22-03-2022, 22:50.

    Comment

    • Axxin
      Junior Member
      • Mar 2022
      • 4

      #3
      Thanks for the reply but unfortunately I have already done this. The oci8 module was compiled and it shows as enabled in the php info with the correct ORACLE_HOME:
      OCI8 Support enabled
      OCI8 DTrace Support disabled
      OCI8 Version 2.2.0
      Oracle Run-time Client Library Version 19.3.0.0.0
      Oracle Compile-time Version 19.3
      Compile-time ORACLE_HOME /oracle/u01/client/19.3.0
      Libraries Used -Wl,-rpath,/oracle/u01/client/19.3.0/lib -L/oracle/u01/client/19.3.0/lib -lclntsh

      Comment

      • tim.mooney
        Senior Member
        • Dec 2012
        • 1427

        #4
        Have you enabled PHP logging and have you checked your PHP-FPM worker pool log?

        I would expect that something should be getting logged.

        Comment

        • Axxin
          Junior Member
          • Mar 2022
          • 4

          #5
          I thought there should be too but my regular php log is not writing anything at all and the FPM log is is only showing that the process has started up:

          [23-Mar-2022 15:38:43] NOTICE: fpm is running, pid 17847
          [23-Mar-2022 15:38:43] NOTICE: ready to handle connections
          [23-Mar-2022 15:38:43] NOTICE: systemd monitor interval set to 10000ms
          [23-Mar-2022 15:56:13] NOTICE: Terminating ...
          [23-Mar-2022 15:56:13] NOTICE: exiting, bye-bye!
          [23-Mar-2022 15:57:42] NOTICE: fpm is running, pid 18379
          [23-Mar-2022 15:57:42] NOTICE: ready to handle connections
          [23-Mar-2022 15:57:42] NOTICE: systemd monitor interval set to 10000ms


          changing the log level from notice to debug only adds a whole lot of messages about idle worker pools and nothing else useful.

          Comment

          • tim.mooney
            Senior Member
            • Dec 2012
            • 1427

            #6
            In the pool configuration file for the worker pool (if you called the worker pool 'zabbix', like the example uses, then it's in php-fpm.d/zabbix.conf ), where you set php_admin_value and php_value settings for Zabbix (probably way at the end of the pool configuration), do you have

            Code:
            php_admin_value[error_log] = /var/log/php-fpm/zabbix-error.log
            php_admin_value[log_errors] = on
            ?

            Comment

            • Axxin
              Junior Member
              • Mar 2022
              • 4

              #7
              Yes, we changed the log path but it is enabled along with the catch_workers_output option.

              catch_workers_output = yes
              php_flag[display_errors] = on
              php_admin_value[error_log] = /opt/zabbix/php_logs/www-error.log
              php_admin_flag[log_errors] = on

              Comment

              Working...