pecl instal ibm_db2 fails

2019-07-05 05:32发布

问题:

I need to install ibm_db2 extension for making php connection with db2. So I have used pecl. But it produces error.

$ pecl install ibm_db2

When I run this, the below error occurs.

.....
checking      in /home/db2inst1/sqllib/lib64...
checking      in /home/db2inst1/sqllib/lib32... found
checking for DB2 CLI include files in default path... checking in /home/db2inst1/sqllib... not found
configure: error: Please reinstall the DB2 CLI distribution
ERROR: `/tmp/pear/temp/ibm_db2/configure --with-IBM_DB2=/home/db2inst1/sqllib' failed

Please help.

回答1:

  1. download ibm_data_server_driver_for_odbc_cli_linuxx64_v97.tar.gz from ibm.com
  2. untar the file into: /opt/ibm/
  3. enter command > pecl install ibm_db2

    When prompted for DB2 Installation Directory, use: /opt/ibm/odbc_cli/clidriver/


回答2:

You need the DB2 headers to build the ibm_db2 PHP extension. They are included in the IBM Data Server Driver for ODBC and CLI.



回答3:

before install ibm_db2, you have install expc, in the folder uncompress execute the script db2_install with root user: # ./db2_install

It asks for the installation path (e /opt/ibm/db2)

then install ibm_db2



回答4:

Install a DB2 instance (On Ubuntu due to following instructions: http://www.db2teamblog.com/2010/09/db2-express-c-packages-for-ubuntu-1004.html) This will work also on newer systems.

After that run the following command:

pecl install ibm_db2

When prompted type:

/opt/ibm/dbs/V9.7/

and confirm the installation directory



回答5:

You need the APPLICATION DEVELOPMENT TOOLS when you install the client you should have the option to install them.

Check your /home/db2inst1/sqllib/include folder you'll see that you only have asn.h, a boatload of files is missing when you don't have the development tools installed.

Then use /home/db2inst1/sqllib as your install directory.



回答6:

I lacked the APPLICATION_DEVELOPMENT_TOOLS in my DB2 installation (confirmed by only having asn.h in my includes folder)

To install the APPLICATION_DEVELOPMENT_TOOLS into an existing DB2 installation, follow these instructions

  1. Check your product information. You will need this information later.
    db2ls -p -q -b /opt/ibm/db2/V10.5

  2. Download the appropriate Universal Fix Pack from IBM:
    https://www-945.ibm.com/support/fixcentral/swg/selectFixes?parent=ibm~Information%2BManagement&product=ibm/Information+Management/DB2&release=All&platform=Linux+64-bit,x86_64&function=textSearch&text=universal

    • Be sure to find the matching FixPack version (from the step above) and the correct architecture.
    • Save the file to /opt/ibm/fixpack
  3. Gunzip/Tar the file
    cd /opt/ibm/fixpack
    gunzip /opt/ibm/fixpack/downloaded_pack.tar.gz
    tar xvf /top/ibm/fixpack/downloaded_pack.tar

  4. Create a response file /opt/ibm/fixpack/devtools.resp like this.
    Replace the PROD value with the Product Response File ID
    Replace the FILE value with the DB2 installation folder
    PROD = DB2_SERVER_EDITION FILE = /opt/ibm/db2/V10.5 LIC_AGREEMENT = ACCEPT INSTALL_TYPE = CUSTOM COMP = APPLICATION_DEVELOPMENT_TOOLS

  5. Stop DB2 with db2stop or db2stop force
  6. Run db2setup with the response code
    cd /opt/ibm/fixpack/universal/
    ./db2setup -r /opt/ibm/fixpack/devtools.resp

  7. Start DB2 with dbstart

  8. When you are done, run
    pecl install ibm_db2
    Use /home/db2inst1/sqllib as your install directory.


Original instructions were found here to install them into an existing DB2 installation (I used the 3rd option):
http://db2commerce.com/2014/02/11/installing-a-db2-component-after-the-rest-of-db2-is-installed/



回答7:

The error is because in the path /home/db2inst1/sqllib not found the include folder.

you must download db2exc_974_LNX_x86_64.tar.gz, uncompress it (e. /otp/ibm/db2)

then install pecl install ibm_db2

DB2 Installation Directory? use this : /opt/ibm/db2



回答8:

Check also the first comment on PHP manual by Jean Ferreira.

link



回答9:

I got solution for the above issue.

Need to select Custom Install while installing db2. So I just uninstalled and reinstalled DB2.

After that It works fine for me. Thanks everyone :)