Skip to Content
Sep 21, 2020 at 11:31 AM

Connection with SAPRFC using PHP


I want to do a connection with SAP-RFC using PHP. I have installed 'Wamp' server with PHP 5.2.8, Apache 2.0.54 and SAP-RFC 1.4.1. I am using old version of PHP because I could not find much of help for PHP version 7.2.

I have done the following steps:

1. Changed in parameters like Host/server IP, System number, R3 name, client, username and password.
2. Put DLL files in the extension folder and mentioned it in the PHP.ini file.
3. Added librfc32.dll file in the system32 directory.

$LOGIN = array ( // Set login data to R/3"ASHOST"=>"", // application server host name
"SYSNR"=>"00", // system number
"CLIENT"=>"130", // client"USER"=>"xxxx", // user
"PASSWD"=>"xxxx", // pasword
"CODEPAGE"=>"1404"); // codepage

$rfc = saprfc_open ($LOGIN);
if (! $rfc )
echo "RFC connection failed with error:".saprfc_error();


include_once ("../sap.php");
$sap = new SAPConnection();
// Params: hostname sysnr $sap->ConnectToApplicationServer (" ", "00");
// Params: client username password language $sap->Open ("130", "xxxx","xxxxx","EN");

// Login credentials have been added in the code.
echo "<BR><PRE>"; print_r ($sap); echo ("</PRE>");


Output - "SAP RFC extension is not installed. Exiting...."

Your help would be highly appreciated.