Connection Setup PHP with SAP on Linux
Introduction
Below I will show what are the steps to create the connection between PHP and SAP. This document seeks to have a guide for implementing the connection between PHP and SAP, for this example implementation is carried out on a linux server openSUSE 11.1, so that you can create a web application to access SAP online.
Installation of the library extension module for PHP SAPRFC
The installation of this extension is performed in the server PHP.
REQUIREMENTS
The installation was performed on a system with opensuse 11.1 of 32 bits. The installation of the library “extension module for PHP SAPRFC” was taking PHP Version 5.2.6 installed, Apache version 2.2.8 and Linux kernel 2.6.25.18-0.2-pae i686.
The installation of the library will be done using the method of construction of the extension SAPRFC as a dynamic module without recompiling PHP.
STEP BY STEP INSTALLATION
To carry out the correct installation of the module require the following programs, except the SAP RFCSDK installing them is by yast:
- Apache and php.
- php-devel package for installation as a dynamic modulus saprfc
- GNU tools (compat, autoconf, automake, flex, libtool, gcc, m4, make)
- Non-Unicode SAP RFCSDK 6.20 for your platform here RFC_43-20000055_SDKLinux_on_IA32_32bit.SAR (this program is downloaded from http://service.sap.com/swdc low <Support Packages and Patches – My Company’s Application Components SAP WEB AS – SAP WEB AS 6.20 – SAP RFC SDK>).
- SAPRFC download the library for PHP, which is in Sourceforge.
- Download the SAP RFCSDK from SAP, http://service.sap.com/swdc low <Support Packages and Patches – My Company’s Application Components SAP WEB AS – SAP WEB AS 6.20 – SAP RFC SDK.
- Download the program from ftp://ftp.sap.com/pub/linuxlab/contrib SAPCAR.
- Login as a superuser.
- Unzip RFCSDK SAP 6.20, with the command:
. /SAPCAR-xf-20000055_SDKLinux_on_IA32_32bit.SAR RFC_43
This will create a folder called rfcsdk in the directory where the command was executed.
- Create the folder /usr/sap and there move the folder rfcsdk, thus being /usr/sap/rfcsdk.
mkdir /usr/sap
mv rfcsdk /usr/sap - Give permissions to the directory created with the command
chmod-R 755 / usr / sap
- Unzip the sources of the library with the command saprfc
tar-xvzf saprfc-1.4.1.tar.gz
- Run the following commands
cd saprfc-1.4.1
phpize
./configure
make
make install
The commands generate dynamic php module called saprfc.so which to make ‘make install’ is copied to the folder where dynamic modules are loaded (/usr/lib/php5/extensions).
- In the folder /etc/php5/conf.d/ where are the configuration files of the modules to create the saprfc.ini with the following line:
extension = saprfc.so
- Restart Apache
rcapache2 restart
Why don't you try OData via SAP NetWeaver Gateway for consuming SAP information in PHP applications? - Here's a how-to: http://wiki.sdn.sap.com/wiki/download/attachments/250646828/PHP+-+How+to+Guide.pdf?version=2&modificationDate=1318254213504
Yes, you can use with SAP NetWeaver Gateway, however, requires licensing, what I want is to show an alternative using only RFC, although in SAP Netweaver can create web services which can be called from PHP and backwards: http://www.sdn.sap.com/irj/sdn/index?rid=/webcontent/uuid/5d9fb155-0b01-0010-8e8a-d8703df8bb9e, but that would be another alternative, maybe I present is not the best choice when you have systems with SAP Netweaver, but it was a great help when the ERP system was 4.7, but I agree with you that there are alternatives.
Agreed, it's an alternative, but please keep in mind that for runtime, a license is required for your solution as well.
Ok, I'll remember that, thanks.
Speaking of Web Services using SOAP and SAP heres a step by step video for setting it up and connecting with PHP http://www.youtube.com/watch?v=GG85rUbhXMg
Thank you, good contribution to the subject.