Connect PHP with SAP Database - php

So, I already followed all the steps below for saprfc windows installation.
1) Extract zip file saprfc-$VERSION$-$PHP_VERSION$.zip
2) Copy php-saprfc.dll to your extensions directory (e.g. C:\PHP\extensions)
3) Edit php.ini file (in windows system dircetory, e.g. C:\WINNT, C:\WINDOWS)
and add line: 'extension=php_saprfc.dll'
4) Copy librfc32.dll (from SAPGUI install CD) to the windows system
directory or simple install SAPGUI on your machine.
Another source said we will we need SAP SDK. Is it really needed for Windows?
Also, will it be possible to code PHP connect to SAP in a computer that doesn't have SAP program? Or we only can do those installations in computer that has SAP application?
Then after the installation, what do I have to do next? I am trying to do steps below, yet still confused....
1) Extract php sources to C:\PHP-x.y.z
2) Extract php win support files to C:\PHP-x.y.z\win32
3) Install RFCSDK to C:\PHP-x.y.z\rfcsdk
4) Copy SAPRFC sources to C:\PHP-x.y.z\ext\saprfc
5) Copy php4ts.lib or php5ts.lib (from PHP binaries) to C:\PHP-x.y.z\win32
6) For PHP5 copy saprfc.dsp5 to saprfc.dsp
6) Open project C:\PHP-x.y.z\ext\saprfc\saprfc.dsp in Microsoft Visual C++ 6.0
7) Under Tools|Option|Directory set path for Include files and for Library files
(C:\PHP-x.y.z\win32\include; C:\PHP-x.y.z\rfcsdk\include;
C:\PHP-x.y.z\win32\lib; C:\PHP-x.y.z\rfcsdk\lib)
8) Set active configuration to "saprfc - Windows_TS" (under Build menu)
9) Build php_saprfc.dll.
10) Compiled DLL you find in C:\PHP-x.y.z\Release_TS directory
Where to get PHP sources, PHP win support, and how to compile the program?
Sorry, I am totally new to this. Looking for the answers. Thank you very much!

Building "windows extensions" is explained in general here:
https://wiki.php.net/internals/windows/stepbystepbuild
There is also explained which version of VS you need for which PHP version.
I also tried to build the sapnwrfc extension for PHP 5.5 on windows, but failed at some part...my progress/documentation is here:
https://github.com/piersharding/php-sapnwrfc/issues/6
Maybe you can progress further :-)

Related

Cannot make Imagick detect supported format on Windows + PHP 5.6 (Xampp)

its been 3 days of research, google and frustration to make imagick work on my XAMPP box. I can get as far on making it as php module. But it cannot detect supported formats.
As you can see, I currently have 3.1.2 installed, but I actually worked all the way from the most recent 3.4.1 and jumping from those releases tagged with stable but I just can't make it work.
When I try to run:
<?php
$handle = fopen('http://xxxxx.png', 'rb');
$img = new Imagick();
$img->readImageFile($handle);
$img->thumbnailImage(100, 0);
echo $image;
I am getting:
Uncaught exception 'ImagickException' with message 'Unable to read image from the filehandle' in xxxxx:5 Stack trace: #0 xxxxx\index.php(5): Imagick->readimagefile(Resource id #3) #1 {main} thrown in xxxxx\index.php on line 5
What I have is:
Windows 8.1 64-bit
PHP 5.6.12, x86, TS
(http://i.imgur.com/2pnneqO.png)
This is what I actually have done so far, in terms of installing it:
Download any -Thread Safe (TS) x86 package from
https://pecl.php.net/package/imagick
Extract the .zip (1) php_imagick.dll to C:\_XAMPP\php\ext (2)
Extract CORE_RL_* files to C:\_xampp\apache\bin
Download ImageMagick-7.0.1-1-Q16-x86-dll.exe from
Link
Installed it at C:\ImageMagick
Add MAGICK_HOME to environment PATH. http://i.imgur.com/jQAWl3W.png
All *_.dll file in C:\ImageMagick\modules\coders copy to
C:\_Xampp\apache\bin
All *_.dll file in C:\ImageMagick\modules\coders copy to
C:\ImageMagick\
Restart Apache via Xampp
And still can't make my PHP detect Imagick supported file formats even though they should be http://prntscr.com/b1l54u :((
Can somebody tell me what did I miss? Please?
You seem to be going a bit of a convoluted route.
The method I used to install it when I had it running was:
Download and install Ghostscript with an exe file
Download and install imagemagick with an exe file - make sure you let it add the path to the environmental variables. You may not need this step but I wanted to use Imagemagick I'm my website and on my computer anyway.
Download the Imagick dll file and put it in the recommended folder - I can not remember which now.
Uncomment the Imagick option in the php.ini file. I had
two or three php.ini files on my system and I did it in each one.
Turned off the computer and restarted. Started XAMPP and it worked.
This only worked for a couple of installs and when I upgraded the operating system I could not get it to work due to incompatible versions of php and the Imagick.dll. If I should ever want to use Imagick I would do it on my server as the hosts installed it there for me.
You can still write your code locally and test it on your production server. It is a bit of a pain but would probably be quicker/easier than trying to get Imagick working on your PC.
Out of interest I gave up with it and use Imagemagick with exec() and the command line.

Debugging PHP codes

I am following this tutorial
STEPS
Downloaded Xdebug - PHP VC 11 64 bit [Didn't download TS version - ]
My php is 5.6.11 vc 11
Added zend extensions with right dll path
Started server. Zend extension is added. Checked with phpinfo()
Downloaded Eclipse PDT
Opened Eclipse and created new project and given path to my files
Localhost server so didn't change PHP->Servers
Debug configurations
Changed server to XDebug
Added a file to debug
Started the server. It opens in mozilla [I changed default web browser to mozilla in eclipse]
But it didn't stop at my breakpoints
<?php
$x = 2;
$y = 5;
$z = $x + $y;
echo $z;
?>
Did I miss any step? Or is there any other way to achieve debugging PHP?
Any Suggestions?
Make sure you have the correct version of the XDEBUG dll to match your Apache/PHP installation.
If you have PHP installed as an Apache module you need the Thread Safe XDEBUG dll. If you have PHP installed as CGI/FastCGI then you want the Non Thread Safe XDEBUG dll.
Its a good idea to use the XDEBUG Wizard
That will tell you exactly what to modify in your php.ini and which dll you should download.
Beware of old tutorials, they may suggest using the old and now defunct zend_extension_ts= when you should use zend_extension=
Also on windows systems use the unix forward slash and not the dos backslash in the path to the XDEBUG dll like so :-
zend_extension="C:/server/php/ext/php_xdebug-2.3.3-5.6-vc11-x86_64.dll"

Using Cassandra PDO Driver on Windows

Is there any way to have Cassandra PDO at Windows with Wamp?
This is for development purposes I don't want to install Linux and change all the environment.
https://code.google.com/a/apache-extras.org/p/cassandra-pdo/
I'm using Windows 7 (64 Bit), Wamp 2.5, PHP 5.5.
OK, here's what I found out:
1) It's totally possible
2) The docs that appear in the first google search results are a bit obsolete
Start by downloading the latest Datastax Community Cassandra here:
http://planetcassandra.org/cassandra/
Install & setup properly. In fact, most of the configuration is done by the installer, you just have to edit the apache-cassandra/conf/cassandra.yaml file to find all paths to /var/lib... and change those into something like d:/cassandra/... That includes "commitlog", "data", "saved_caches". Restart the Cassandra service, examine the logs. Mine shown no problem. The OpsCenter at ...:8888/opscenter/index.html was working fine, showing one node online.
Now, the PHP part.
There's a sneaky thing called Thrift. From what I've learned today (I first heard about Cassandra and Thrift yesterday), it's a way describe a binary protocol of connecting to some online service, in this case, to Cassandra. It will basically generate PHP files that will provide all the connectivity you need from PHP itself (no extensions needed).
You will need:
1) The Thrift PHP libs
2) The .exe Thrift compiler
Both can be downloaded here:
https://thrift.apache.org/download
Then use the following command to compile PHP files that will act as a "driver" to connect your PHP applications to Cassandra:
thrift --gen php D:\DataStaxCommunity\apache-cassandra\interface\cassandra.thrift
Put the result in some PHP include_path folder.
Also, find the PHP Thrift libs (in the libs archive from the same download page) and put those in a folder accessible to your script (e.g. include_path or the project folder).
Refer this page:
thrift.apache.org/lib/php
I guess that should help!
I have same problem as you, but when i tried this method, it works correctly for me.
Reference link
Here is a code example, very easy to understand :
<?php
require_once 'Cassandra/Cassandra.php';
$o_cassandra = new Cassandra();
$s_server_host = '127.0.0.1'; // Localhost
$i_server_port = 9042;
$s_server_username = ''; // We don't use username
$s_server_password = ''; // We don't use password
$s_server_keyspace = 'cassandra_tests';
$o_cassandra->connect($s_server_host, $s_server_username, $s_server_password, $s_server_keyspace, $i_server_port);
$s_cql = "CREATE TABLE carles_test_table (s_thekey text, s_column1 text, s_column2 text,PRIMARY KEY (s_thekey));";
$st_results = $o_cassandra->query($s_cql);

How to install eclipse for php on windows7

I want to install Eclipse for PHP.
I download Eclipse "PDT 3.0.2 w/Eclipse indigo" to my folder "c:\eclipse" and extract the zip file.
I am also download "jre-6u37-windows-94.exe" and install it successfully.
The problem is when I try to run the file eclipse.exe I get error.
A Java Runtime Environment (JRE) or Java Development Kit (JDK) must be available in order to run Eclipse. No Java virtual machine was found after searching the following locations:
c:\eclipse\jre\bin\javaw.exe
javaw.exe in your current PATH
The jre installed in directory.
c:\Program Files (x86)\java\jre7\bin
What should I do for running successfully the eclipse.
this is my confog.ini
#This configuration file was written by: org.eclipse.equinox.internal.frameworkadmin.equinox.EquinoxFwConfigFileParser
#Mon Jun 11 14:17:27 IDT 2012
org.eclipse.update.reconcile=false
eclipse.p2.profile=pdtProfile
osgi.framework=file\:plugins/org.eclipse.osgi_3.7.2.v20120110-1415.jar
equinox.use.ds=true
osgi.bundles=reference\:file\:org.eclipse.equinox.simpleconfigurator_1.0.200.v20110815-1438.jar#1\:start
org.eclipse.equinox.simpleconfigurator.configUrl=file\:org.eclipse.equinox.simpleconfigurator/bundles.info
eclipse.product=org.zend.php.product
osgi.splashPath=vplatform\:/base/plugins/org.zend.php
osgi.framework.extensions=
osgi.bundles.defaultStartLevel=4
eclipse.p2.data.area=#config.dir/../p2
eclipse.application=org.eclipse.ui.ide.workbench
org.zend.php.customization.site.url=http\://downloads.zend.com/studio-eclipse/updates-extra/9_0,http\://downloads.zend.com/studio-eclipse/updates/9_0
should I add the line -vm Path=c:\Program Files(86)\Java\jre7\bin to top file ?
Because it is not working
As "PDT 3.0.2 w/Eclipse indigo" for Windows is only available for 32bit platform, you need to download a 32bit JRE as well to make it run on 64bit Windows platform. Don't forget to make JRE visible for Eclipse by either editing eclipse-php.ini or adding "-vm " as argument to a shortcut pointing to eclipse-php.exe.
More details here:
http://blog.lopau.com/eclipse-pdt-32-bit-on-windows-7/
I bet you that this conflict is due to installation of conflicted java setupYou just need to confirm that you are using 32-bit or 64-bit Windows and then install java according to your OS requirement.32-bit java for 32-bit OS and 64-bit java for 64-bit OS.You will surely get rid from this problem :)Another alternative is to re-run the JRE setup. It typically installs a default JRE by placing java.exe, javaw.exe, etc. in your system folder. That would place the executables in your path, which should be sufficient, based on the note in the error message that it searched your path for javaw.exeif you are still sure that you have installed the right setup then try to set the path by using this commandset PATH=C:\Program Files\Java\jre1.6.0_03\bin ;%PATH%
Eclipse can't find your java installation.
Follow this steps:
control panel -> view advanced system settings
On tab advanced -> environment variables -> system variables -> click new button
in the dialog that appears -> variable name -> enter JAVA_HOME
in the same dialog -> variable value -> enter c:\Program Files (x86)\java\jre7
and click ok to close dialog.
In system variables search for variable named Path. If it doesn't
exist create it with new button.
If there was a Path variable append ;%JAVA_HOME%\bin at the end of
the content in the variable value field.
If you have to create the Path variable enter %JAVA_HOME%\bin
Click OK to close edit system variable dialog
Click OK to close enviroment variables
Open windows command prompt and type echo %JAVA_HOME%. The answer
should be c:\Program Files (x86)\java\jre7 If this is not the case
check previous steps.
Start eclipse.

php custom c extension with external shared lib

I would like to develop an extension which depends on an external shared library. My current problem is that I am not being able to link this shared library to my extension.
My development environment is Fedora Linux x64 + PHP 5.4. This external shared library is a proprietary one, I just have its headers (.h) and .so files (for 32 and 64 bits).
The project's current config.m4 file is as follows:
PHP_ARG_WITH(projectname,
[Whether to enable ProjectName support],
[ --with-projectname enable ProjectName support])
if test "$PHP_PROJECTNAME" != "no"; then
PHP_ADD_LIBRARY_WITH_PATH(externallib, lib64, PROJECTNAME_SHARED_LIBADD)
AC_DEFINE(HAVE_PROJECTNAME, 1, [Whether you have ProjectName])
PHP_NEW_EXTENSION(projectname, projectname.c, $ext_shared)
fi
The problem here is every time I run ./configure --with-projectname the generated makefile does not have any reference to the library, plus the compiled .so file fails (obviously).
It would also be useful if I had a way to determine the right lib directory according to the architecture.
You've included the library, but looks you're missing the actual link option. I haven't done this in the longest time, but I think something like the following should work.
EXTERNAL_LIB="blahLibName"
LIB_LINK_CMD="-L/usr/local/lib -l$EXTERNAL_LIB"
PHP_ADD_LIBRARY_WITH_PATH(externallib, lib64, PROJECTNAME_SHARED_LIBADD)
PHP_EVAL_LIBLINE($LIB_LINK_CMD, PROJECTNAME_SHARED_LIBADD)
The syntax here might not be right at all, but you definitely need the PHP_EVAL_LIBLINE.

Categories