在AIX7.1上通过Apache连接到DB2和PHP。

时间:2021-07-29 16:54:28

I am trying to understand what do this message mean! I have tried googling it but could not find anything much helpful.

我在试着理解这个信息的含义!我试过用谷歌搜索,但找不到任何有用的东西。

I am trying to include 2 php extensions, db2_ibm.so and pdo_ibm.so, in the php.ini (I have edited that php.ini file which was shown in <?php phpinfo() ?>).

我正在尝试包含两个php扩展,db2_ibm。所以,pdo_ibm。所以,在php。我已经编辑了php。ini文件在 )。

In the PHP cli version, using the command php -m, I can see that the modules are being rightly loaded. I can see the versions ibm_db2 1.9.1 and pdo_ibm 1.3.2

在PHP cli版本中,使用命令PHP -m,我可以看到模块被正确加载。我可以看到版本ibm_db2 1.9.1和pdo_ibm 1.3.2。

However, when I try to do the same via Apache it would not connect. I moved on and looked at the Apache error logs and found the following.

然而,当我试图通过Apache实现相同功能时,它就不会连接。我继续前进,查看了Apache错误日志,并找到了以下内容。

For db2_ibm.so, I got the following error:

db2_ibm。因此,我得到了以下错误:

PHP Warning:  PHP Startup: Unable to load dynamic library 
'/opt/freeware/lib/php/modules/ibm_db2_5.2.1.so'
- rtld: 0712-001 Symbol executor_globals was referenced 
from module /opt/freeware/lib/php/modules/ibm_db2_5.2.1.so(), 
but a runtime definition of the symbol was not found.
in Unknown on line 0

And for pdo_ibm.so:

和pdo_ibm.so:

PHP Warning:  PHP Startup: pdo_ibm: Unable to initialize module
Module compiled with module API=20060613, debug=0, thread-safety=0
PHP    compiled with module API=20060613, debug=0, thread-safety=1
These options need to match in Unknown on line 0

I can understand that there is some problem with defining PATH but not sure how to go about the problem.

我可以理解,定义路径有一些问题,但不知道如何解决这个问题。

Following Versions are installed on my system (AIX 7.1):

在我的系统上安装了以下版本(AIX 7.1):

  • PHP 5.2.17
  • PHP 5.2.17
  • Apache 2.2.16
  • Apache 2.2.16
  • DB2 9.7.4
  • DB2 9.7.4吧

I have installed Apache and PHP them from RPM packages.

我已经从RPM包中安装了Apache和PHP。

[The reason why I was going for the older versions of PHP and Apache is because of the fact that the extension files ibm_db2.so and pdo_ibm.so that were found with DB2 Client were compatible only with the lower versions of PHP.]

我之所以选择PHP和Apache的旧版本是因为扩展文件ibm_db2。所以,pdo_ibm。因此,在DB2客户端中发现的只有较低版本的PHP。

Please do suggest some solution soon as I am stuck here for days now. Thanks a lot!

请尽快提出解决方案,因为我已经在这里呆了好几天了。谢谢!

1 个解决方案

#1


0  

Find the pid for Apache's httpd process:

找到Apache的httpd进程的pid:

ps -ef | grep httpd

You will likely see a set of them. In my case, one has a parent of init (1) and the others have the parent of the first. I would pick the one with the parent of init but for educational purposes you might want to pick all of them. Then do:

你可能会看到一套。在我的例子中,一个有init(1)的父元素,另一个有第一个的父元素。我会选择init的父类,但出于教育目的,你可能会选择所有这些。然后做:

ps eww <pid>

where pid is one of the process ids (2nd column) of the first ps. (The parent process id is the third column.)

其中pid是第一个ps的进程id(第二列)。(父进程id是第三列。)

That command displays the environment for Apache. Then do the same for your shell by doing:

该命令显示了Apache的环境。然后做同样的事情:

ps eww $$

Hopefully you will discover a difference that makes sense. What I would do is muck with the shell's environment and run php -m until you get the error that is happening to Apache. That will give you what specifically is in Apache's environment that is causing the problems. Then use Apache's commands to correct the environment.

希望你能发现一个有意义的区别。我要做的是在shell的环境中运行,并运行php -m,直到您得到Apache正在发生的错误。这将为您提供在Apache环境中导致问题的具体内容。然后使用Apache的命令来纠正环境。

All this is for the simple case where you can see a difference in the environment using ps and track down a difference and are able to correct it. In more stubborn cases, you will need to "wrap" php. In fact, you might find this approach easier.

所有这一切都是为了简单的例子,您可以在环境中看到使用ps的不同,并找到不同的地方,并能够改正它。在更顽固的情况下,您需要“包装”php。实际上,您可能会发现这种方法更简单。

I don't know the details but Apapche is kicking off php somewhere somehow. Lets pretend it is calling /some/specific/path/php with various arguments.

我不知道细节,但Apapche在某处启动了php。让我们假装它是调用/某些/特定/路径/php的各种参数。

Create a directory: /some/specific/path/.orig Move php into .orig Create a shell script (be sure to do chmod +x on it) and in the script do something such as:

创建一个目录:/ /一些/具体路径。orig将php移动到.orig中创建一个shell脚本(一定要在它上面做chmod +x),在脚本中做一些事情,比如:

#!/bin/ksh
date >> /tmp/php.log
env >> /tmp/php.log
echo "args = $@" >> tmp/php.log
exec /some/specific/path/.orig/php "$@"

Put that script as /some/specific/path/php

把这个脚本写为/一些/特定的/路径/php。

You can add more debugging to the script as you need to. You first want to see if you can really execute the same command that Apache is doing from the command line. So dig out the arguments from the log file and execute that same command. You might need to substitute various pieces of the command. This step might be too hard and not worth it but from the error I'm worried that it is not really a difference between Apache and your shell environments but something really isn't set up right. Getting the exact same command to execute from the shell will prove that it is a difference in the shell and Apache environments.

您可以根据需要向脚本添加更多调试。您首先希望看到是否可以真正执行Apache从命令行执行的相同命令。因此,从日志文件中找出参数并执行相同的命令。您可能需要替换命令的各个部分。这一步可能太困难了,不值得,但是从错误中我担心这并不是Apache和shell环境之间的区别,但是确实有些东西是不正确的。从shell中获取完全相同的命令将证明它在shell和Apache环境中是不同的。

Then, as in the first style of debugging, track down what is different in the two environments. The debugging script can even "fix" it before doing the exec as a temporary solution.

然后,就像第一个调试风格一样,跟踪两个环境中不同的地方。调试脚本甚至可以“修复”它,然后执行exec作为临时解决方案。

If you remember, please post back what you find out as a comment. I'm curious what is causing this error.

如果你还记得的话,请把你所发现的评论发回去。我很好奇是什么导致了这个错误。

As usual...

像往常一样…

good luck!

好运!

#1


0  

Find the pid for Apache's httpd process:

找到Apache的httpd进程的pid:

ps -ef | grep httpd

You will likely see a set of them. In my case, one has a parent of init (1) and the others have the parent of the first. I would pick the one with the parent of init but for educational purposes you might want to pick all of them. Then do:

你可能会看到一套。在我的例子中,一个有init(1)的父元素,另一个有第一个的父元素。我会选择init的父类,但出于教育目的,你可能会选择所有这些。然后做:

ps eww <pid>

where pid is one of the process ids (2nd column) of the first ps. (The parent process id is the third column.)

其中pid是第一个ps的进程id(第二列)。(父进程id是第三列。)

That command displays the environment for Apache. Then do the same for your shell by doing:

该命令显示了Apache的环境。然后做同样的事情:

ps eww $$

Hopefully you will discover a difference that makes sense. What I would do is muck with the shell's environment and run php -m until you get the error that is happening to Apache. That will give you what specifically is in Apache's environment that is causing the problems. Then use Apache's commands to correct the environment.

希望你能发现一个有意义的区别。我要做的是在shell的环境中运行,并运行php -m,直到您得到Apache正在发生的错误。这将为您提供在Apache环境中导致问题的具体内容。然后使用Apache的命令来纠正环境。

All this is for the simple case where you can see a difference in the environment using ps and track down a difference and are able to correct it. In more stubborn cases, you will need to "wrap" php. In fact, you might find this approach easier.

所有这一切都是为了简单的例子,您可以在环境中看到使用ps的不同,并找到不同的地方,并能够改正它。在更顽固的情况下,您需要“包装”php。实际上,您可能会发现这种方法更简单。

I don't know the details but Apapche is kicking off php somewhere somehow. Lets pretend it is calling /some/specific/path/php with various arguments.

我不知道细节,但Apapche在某处启动了php。让我们假装它是调用/某些/特定/路径/php的各种参数。

Create a directory: /some/specific/path/.orig Move php into .orig Create a shell script (be sure to do chmod +x on it) and in the script do something such as:

创建一个目录:/ /一些/具体路径。orig将php移动到.orig中创建一个shell脚本(一定要在它上面做chmod +x),在脚本中做一些事情,比如:

#!/bin/ksh
date >> /tmp/php.log
env >> /tmp/php.log
echo "args = $@" >> tmp/php.log
exec /some/specific/path/.orig/php "$@"

Put that script as /some/specific/path/php

把这个脚本写为/一些/特定的/路径/php。

You can add more debugging to the script as you need to. You first want to see if you can really execute the same command that Apache is doing from the command line. So dig out the arguments from the log file and execute that same command. You might need to substitute various pieces of the command. This step might be too hard and not worth it but from the error I'm worried that it is not really a difference between Apache and your shell environments but something really isn't set up right. Getting the exact same command to execute from the shell will prove that it is a difference in the shell and Apache environments.

您可以根据需要向脚本添加更多调试。您首先希望看到是否可以真正执行Apache从命令行执行的相同命令。因此,从日志文件中找出参数并执行相同的命令。您可能需要替换命令的各个部分。这一步可能太困难了,不值得,但是从错误中我担心这并不是Apache和shell环境之间的区别,但是确实有些东西是不正确的。从shell中获取完全相同的命令将证明它在shell和Apache环境中是不同的。

Then, as in the first style of debugging, track down what is different in the two environments. The debugging script can even "fix" it before doing the exec as a temporary solution.

然后,就像第一个调试风格一样,跟踪两个环境中不同的地方。调试脚本甚至可以“修复”它,然后执行exec作为临时解决方案。

If you remember, please post back what you find out as a comment. I'm curious what is causing this error.

如果你还记得的话,请把你所发现的评论发回去。我很好奇是什么导致了这个错误。

As usual...

像往常一样…

good luck!

好运!