Módulo SAP NW RFC 7.50 ou SAP NW RFC 7.20 no PHP 7.2 em um RedHat 7.7

Fontes:

Support SAP:

Download:

Instalação:

SAPNWRFC 7.20

# cd /tmp

# chmod +x SAPCAR_1211-80000935.EXE

# ./SAPCAR_1211-80000935.EXE -xvf NWRFC_52-20004565.SAR

# mkdir /usr/sap/

# mv nwrfcsdk /usr/sap/

OU

SAPNWRFC 7.50

# cd /tmp

# unzip nwrfc750P_5-70002752.zip

# mkdir /usr/sap/

# mv nwrfcsdk /usr/sap/

Obs.: Tive um warning no php quando usado o SDK 7.50, mas o módulo funcionou. Já no SDK 7.20 não deu mensagem e também funcionou.

Mensagem:

PHP Warning: PHP Startup: Unable to load dynamic library 'intl' (tried: /opt/rh/rh-php72/root/usr/lib64/php/modules/intl (/opt/rh/rh-php72/root/usr/lib64/php/modules/intl: cannot open shared object file: No such file or directory), /opt/rh/rh-php72/root/usr/lib64/php/modules/intl.so (/lib64/libicuio.so.50: undefined symbol: _ZN6icu_5013UnicodeString9doReplaceEiiPKtii)) in Unknown on line 0

# vim /etc/ld.so.conf.d/nwrfcsdk.conf

/usr/sap/nwrfcsdk/lib

# ldconfig

Instalar o módulo PHP

# cd /tmp

# git clone https://github.com/gkralik/php7-sapnwrfc.git

# cd php7-sapnwrfc

# phpize

# ./configure

# make

# make test

# make install

Installing shared extensions: /opt/rh/rh-php72/root/usr/lib64/php/modules/

sapnwrfc.so

# php -r 'phpinfo();' | grep 'Scan this dir'

/etc/opt/rh/rh-php72/php.d

# vim /etc/opt/rh/rh-php72/php.d/sapnwrfc.ini

extension=sapnwrfc.so

# service httpd restart

# php -m | grep sap

# php -r 'phpinfo();' | grep 'sap'

# yum install uuidd

# systemctl start uuidd.service

# systemctl enable uuidd.service

Testar sap.php

<?php

use SAPNWRFC\Connection as SapConnection;

use SAPNWRFC\Exception as SapException;

$config = [

'ashost' => 'sapprd.silviogarbes.com.br',

'sysnr' => '00',

'client' => '200',

'user' => 'rfc_os',

'passwd' => '******',

'trace' => SapConnection::TRACE_LEVEL_OFF,

];

try {

$c = new SapConnection($config);

$f = $c->getFunction('RFC_PING');

$result = $f->invoke([]);

var_dump($result);

} catch(SapException $ex) {

echo 'Exception: ' . $ex->getMessage() . PHP_EOL;

}