Luis
Luis

Reputation: 1060

REDHAT 8 Apache PHP SAPNWRFC gkralik / php7-sapnwrfc only works from CLI - SAP

I'm using this repo to connect to SAP software:

https://github.com/gkralik/php7-sapnwrfc

but I don't know why my script connect and return data successfully from my zfunctions on SAP server only under Command Line Interface CLI

php /path/tomy/script.php

but errors under web browser always return:

Fatal error: Uncaught SAPNWRFC\ConnectionException: Failed to set trace directory in /var/www/html/sap/test.php

or

Exception: Could not open connection
Exception INFO:
Array
(
[code] => 1
[key] => RFC_COMMUNICATION_FAILURE
[message] =>
LOCATION CPIC (TCP/IP) on local host with Unicode
ERROR partner 123.4.5.6:3300 not reached
TIME Sat Feb 4 23:42:27 2023
RELEASE 753
COMPONENT NI (network interface)
VERSION 40
RC -10
MODULE /bas/753_REL/src/base/ni/nixxi.cpp
LINE 3067
DETAIL NiPConnect: 123.4.5.6:3300
SYSTEM CALL connect
ERRNO 13
ERRNO TEXT Permission denied
COUNTER 6
)

with any user, and I have checked file permissions too.

Thank you very much for your help

Upvotes: 0

Views: 155

Answers (1)

Luis
Luis

Reputation: 1060

By default, SELinux forbids Apache to make outgoing network connections. If Apache needs to make requests to an outside network service, then run the following command to allow this action.

setsebool -P httpd_can_network_connect on

Upvotes: 1

Related Questions