首页  >  文章  >  php教程  >  转:MQ+PHP – Linking IBM’s WebSphere MQ to PHP

转:MQ+PHP – Linking IBM’s WebSphere MQ to PHP

WBOY
WBOY原创
2016-06-06 20:12:291269浏览

我在上一篇博客在centos下处理PHP+WebSphere客户端中提到了一个英文网站:http://blog.phpdeveloper.org/?p=140,我也是参考它才完成了最终的配置,为此我也写了中文的说明,但感觉文笔不行,所以我还是贴上原文吧: During a recent project at work I had

 我在上一篇博客在centos下处理PHP+WebSphere客户端中提到了一个英文网站:http://blog.phpdeveloper.org/?p=140,我也是参考它才完成了最终的配置,为此我也写了中文的说明,但感觉文笔不行,所以我还是贴上原文吧:

During a recent project at work I had to get PHP linked with IBM’s WebSPhere MQ software we have running on another internal server. Our goal was to use our existing web service to take the requests from external vendors and push their XML data back into the queue inside our firewall. Thankfully there’s an extension in PECL that does just that.

Here’s the basic steps I took – hopefully it’ll be useful to someone else out there in the same spot I was. This all assumes you’re working on a web server that doesn’t have an MQ server installed already:

  • Get the extension: Head over to the PECL page for mqseries and download the latest version. Unpack it into a directory on your local server
  • Get the MQ client libs: You’ll need to go to IBM’s website to download the latest client/libraries for your install (you’ll need an IBM ID to get to the downloads):
    • Go to the IBM page for the MQ client listing
    • Look for the “WebSphere MQ Clients” link under the “Related products and technologies” section and click on it
    • Scroll down to the “Download Package” section and choose from one of the mirror locations
    • Select your package from the list (I went with “Linux for System x86″ for our setup)
    • Click on the download link and fill out some required information (you didn’t think you were getting off that easy, did you?)
    • Agree to the terms and conditions and you’ll get a “Download Now” link
    • Drop the archive file (tar, tar.gz, etc) into your server and unpack into a temporary directory (mine had an issue unpacking into the local directory, not a subdirectory)
  • Install the package(s): Once you have the IBM software extracted, you should have a series of packages. You’ll need to install the “MQSeriesSDK” to get the right libraries in place to compile the PHP extension
  • Build the mqseries extension: Go into the mqseries directory and run “phpize”, “./configure” and “make” to create the .so file. The process should drop it into the default extensions directory.
  • If needed, move it: Be sure that the shared module for the extension is in the right directory for the PHP install to find it. (You can make a phpinfo() page if you’re not sure where that is.)
  • Update your php.ini: Add in a line to include the extension in your current setup. Remember, after any changes to the php.ini, you need to restart the web server.

Now for the fun part – if everything’s working and the extension shows up in your phpinfo() as active, give this script a shot and see if you can connect to your MQ server:

1 $mq_host_ip         ='127.0.0.1';

2 $queue_name     'HOST.REMOTE.Q';

3 $mq_server      'WBRK_QM_U49';

4 $mqcno array(

5 'Version' => MQSERIES_MQCNO_VERSION_2,

6 'Options' => MQSERIES_MQCNO_STANDARD_BINDING,

7 'MQCD' => array(

8 'ChannelName'                   => 'CLIENT.CHANNEL',

9 'ConnectionName'                => $mq_host_ip
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn