Heim  >  Artikel  >  php教程  >  在centos下处理PHP+WebSphere客户端

在centos下处理PHP+WebSphere客户端

WBOY
WBOYOriginal
2016-06-06 20:12:35972Durchsuche

事先申明。我是借鉴了这篇博客:http://blog.phpdeveloper.org/?p=140 当然在其中遇到了不少问题,我在这里一一说明: 1、准备工作 a. pecl mqseries :http://pecl.php.net/package/mqseries b. ibm mq client:http://www-01.ibm.com/software/integration/

 事先申明。我是借鉴了这篇博客:http://blog.phpdeveloper.org/?p=140

当然在其中遇到了不少问题,我在这里一一说明:

1、准备工作

a. pecl mqseries :http://pecl.php.net/package/mqseries

b. ibm mq client: http://www-01.ibm.com/software/integration/wmq/clients/

2、步骤:

1、先安装ibm mq client :下载地址最终是要翻墙的,我这里不教翻墙技术。下载完后,解开压缩,在centos下面,直接rpm -ivh 
   MQSeriesRuntime-7.5.0-3.x86_64.rpm,和rpm -ivh MQSeriesSDK-7.5.0-3.x86_64.rpm ,由于我们只是当成一个client库来连接,因此安装这两个就够了

2、编译mqseries。在这里我吃药了,我下载的是0.14版的,我一看更新时间是2014年。我想这是最新的总没问题吧。结果。。。./configure到最后的时候,说--with-libdir=lib64找不到,让我指定。可是我明明指定了也不能安装。于是google了一下,发现这曾经是一个BUG。在2012年解决掉了。在bug.php.net里。写的是bug fixed。所以我下载了0.13的,然后再安装,果然成功了

3、测试

    <?php ??
    $mq_host_ip?????????='127.0.0.1';??
    $queue_name?????=?'HOST.REMOTE.Q';??
    $mq_server??????=?'WBRK_QM_U49';??
    $mqcno?=?array(??
    ????????'Version'?=>?MQSERIES_MQCNO_VERSION_2,??
    ????????'Options'?=>?MQSERIES_MQCNO_STANDARD_BINDING,??
    ????????'MQCD'?=>?array(??
    ????????????????'ChannelName'???????????????????=>?'CLIENT.CHANNEL',??
    ????????????????'ConnectionName'????????????????=>?$mq_host_ip,??
    ????????????????'TransportType'?????????????????=>?MQSERIES_MQXPT_TCP??
    ????????)??
    );??
    ??
    //?Connect?to?the?MQ?server??
    mqseries_connx($mq_server,$mqcno,$conn,$comp_code,$reason);??
    if?($comp_code?!==?MQSERIES_MQCC_OK)?{??
    ????????trigger_error('Cannot?open?connection?to?server:?'.$mq_server,E_USER_ERROR);??
    }else{??
    ??????echo?'Connection?good!';??
    }??
$mq_server从手册上看得知这应该是:queue_manager,所以应该是manager的名称

如果你访问的mq不是默认的端口号,还要加上端口号。我在这里走了不少弯路。我原来connectionName是写成:127.0.0.1:1234,报错2387,意思是host not avarible。查了下资料,原来端口号应该是 ip(port),也就是说得:127.0.0.1(1234) 这样的形式才OK。于是改好后再测试就通过啦。

----

我是在一台干净的Centos上安装的。所以做了很多准备工作:

1、 yum install php php-devel(devel里面才有phpize)

2、yum install gcc gcc-c++ g++

然后在安装的时候还有提示:you will need re2c ...于是找到这个博客:http://denghai260.blog.163.com/blog/static/726864092012260242533/

里面说道:

    wget?http://sourceforge.net/projects/re2c/files/re2c/0.13.5/re2c-0.13.5.tar.gz/download??
    tar?-zxvf?re2c-0.13.5.tar.gz??
    cd?re2c-0.13.5??
    ./configure?&&?make?&&?make?install??

至此,遇到的所有的问题都解决了。

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn