gkralik / php7-sapnwrfc

SAP NW RFC SDK extension for PHP 7.3+ & PHP 8
https://gkralik.github.io/php7-sapnwrfc
MIT License
90 stars 35 forks source link

Scripts works only executed on CLI #142

Closed neutronixx closed 1 year ago

neutronixx commented 1 year ago

Question

Hi every body, some body knows why my script connect and return data Successfully from my zfunctions on sap 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

neutronixx commented 1 year ago

I have found a solution, I hope it helps to some one:

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