skip to Main Content

Im currently trying to install the IBM Data Server Runtime Client and some extensions, pdo_ibm and ibm_db2, to use in a PHP / Laravel project.

For now, I have installed WSL 2, to have a Ubuntu environment on Windows. I have also installed the latest PHP version possible and Composer, but before I go ahead, I wanted to see if its even possible. Since there is no Graphical Interface, is there any way to get such files for Ubuntu and to install the Client as well? I can easily move stuff from my "computer" to the Ubuntu system, but i am unable to find anything related, and I dont know where to start.

I do have the extensions but as DLLs, for Windows, not for Ubuntu.

2

Answers


  1. Chosen as BEST ANSWER

    Thank you for your answers. I ended up using a Ubuntu 20.04 in WSL2, installed xdebug and ibm_db2 and pdo_ibm with PECL, all within the CLI.


  2. For some reason, you want to try PHP + php_ibm_db2 + a Db2 client working on ubuntu-in-WSL2, as distinct from native ubuntu x64, or native Windows x64 . PHP can work with Db2 in all three of those. So, the simplest answer is "yes, of course it is possible with ubuntu-in-wsl2, you just have to know how".

    As you have seen, there are pre-built binary copies of the php_ibm_db2 wrapper for native MS-Windows available via a github repository. This wrapper is a thin layer that uses an underlying separately installed Db2 driver. Pre-built versions of this wrapper exist only for the Microsoft-Windows environment (x64 and x32 only).

    For linux/unix , it is necessary to build the php_ibm_db2 wrapper from source code by yourself. There is no pre-built repository for Linux, because Linux runs on many cpu-architectures not only x64. This build activity is described at https://github.com/php/pecl-database-ibm_db2 . This activity requires some competence with development, as pre-requisites must first be installed (such as the gcc compiler, and the Db2 include files and link-time-libraries for Db2 etc, and some environmental configuration etc, along with make, tar etc.). If you lack those skills, it may be wise to get an experienced developer to do the build for you.

    Just as with the native Microsoft-Windows version of php_ibm_db2.dll, the linux equivalent shared library needs to use a separately installed underlying Db2-driver to do the real work. The simplest amd most effective method is to use IBM’s tiny footprint (zero GUI, zero install) clidriver available from https://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/ (taking care to match the bitness and platform of your PHP binary). After downloading, You must unpack it (unzip/gunzip etc) into a directory and it is ready to use only for Linux/Unix/Windows/Cloud platforms of Db2-server. For Z/OS target-database-server platforms additional configuration and licensing is necessary, not covered here, refer to the Db2 Knowledge Centre for details.

    Your question mentions the Db2 runtime-client, but that is not the correct tool for build activities, lacking the necessary files. Instead the runtime client is for post-build, configuration and run time activities. This is the reason I advise getting competent with clidriver which includes the necessary files for building and running in the smallest possible footprint. Apart from being the wrong tool for your immediate needs, the Db2 runtime client has a silent install method (i.e. no GUI) for command-line only installation as described on the Db2 Knowledge Centre, so refer to that for more details.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search