We have an AS/400 system. I am asked to look for a way to call RPG programs from PHP on our Apacher server. The only solution i found was installing zend server to AS/400 and using i5 PHP API Toolkit. Since I don't know how to use AS/400 and don't have access i haven't tried it yet.
We can connect to database and read, write from php. I am asking if there is any way to call a rpg program on our system from php code and send parameters, retrieve output.
I found there is JTOpen for Java. Maybe same thing for Php would work.
You can execute host programs as if they were stored procedures.
For more information:
iSeries Access ODBC: Stored Procedures
Today the easiest answer is the open-source PHP Toolkit for IBM i that is shipped with Zend Server and also is available for free download.
I'm not an iSeries developer so I can't give detailed instructions but it should be possible to use the CGIDEV2 library (http://en.wikipedia.org/wiki/Cgidev2) to expose RPG functionality over HTTP. This would make your RPG functionality easily accessible to PHP and any other environment which can act as a web client. The caveat is that you need to make source level modifications to the RPG in question which may not suit your working arrangements.
Edit: Sorry, I just noticed that you said you didn't have access to the iSeries directly so this won't be a solution for you,
Related
Me and a friend are working on a C# windows application. He's in charge of designing the application, while I am in charge of the API.
I have created a DLL which will be used by the application for a majority of MySQL queries. I am also making a website to go along with the application and would like to make a smaller version of the app on the server (which is Linux, I should add) and have it run on the webpage.
So I am wondering if there is a way to call the methods from my DLL in a PHP page, or if I am better off just querying the database with PHP script or something of that nature.
You cannot use a Windows DLL on a Linux server. Maybe there's some way to hack stuff in with Wine... I'm not sure, but it's undoubtedly more hassle than it is worth.
You can use COM DLLs and .NET assemblies from within PHP. See the documentation: http://php.net/manual/en/book.com.php
If all you are doing is making MySQL queries, you are most certainly better off using PDO or MySQLi. This will simplify things greatly.
I would recommend having the DLL (I'd assume its a managed assembly) expose out REST or SOAP web services and consume those services via PHP.
I want to develop a desktop application using Adobe Flash remember a desktop not a web application. I want to connect Database (MySQL) to it for which I think I should use Php.
Can I send and receive data from Php files silently means without running the Php file itself.
Is there some method to achieve something like this?
Honestly it sounds like your best bet is going to be to use Adobe AIR. You can use the NativeProcess API to call PHP on the host computer, but you also have the option to use a SQLLite database directly from AIR with no need to mess with PHP.
Here's a link to a sample project with source code provided, this may help. Good luck!
http://www.peterelst.com/blog/2008/04/07/introduction-to-sqlite-in-adobe-air/
Is there some method to achieve something like this?
There are ways to package an Apache/PHP/mySQL environment into an executable, but they are terribly complex to set up and not especially light-weight.
You are probably much better off doing this on a native platform for desktop applications. Every major programming platform has the means to connect to a mySQL database - if that really is the database of choice for a desktop app.
What is the best way to build a non web browser stand alone php app that works with some sort of database without requiring the user to install a database server. Or am i just asking too much?
If you're targeting Windows, try WinBinder. It allows you to develop native Windows applications using PHP.
It also supports SQLite, so you don't need a database server.
Embed the SQLite database in your app, then configure PHP to talk to the SQLite database:
http://us.php.net/sqlite
Have a look at php compilers, you'll end up with a binary for people to run. It could be a desktop GUI application, or a "web server in a box" type of thing.
bamcompile
phc
roadsend
I'd suggest you try miniPHP. It is basically an IDE around Winbinder; it lets you concentrate on writing PHP while it takes care of details like compiling the application. You can create either GUI or command-line apps and it works just fine with both SQLite and MySQL. It has a preview mode and some debugging capabilities too.
Here is an idea: information can be stored in XML and thus usage of database can be avoided. That will work only for certain kind of purposes of course.
As Oakcool has mentioned, check out PHP-GTK. It is a GUI development tool on the similar lines of MFC for C/C++.
PHP-GTK alongwith SQLite or a text file as others mentioned above should do the trick.
Take a look at this 3 links
PHP GTKenter code here
http://gtk.php.net/
FLEX
http://www.adobe.com/products/flex/?promoid=BPDEQ
AIR
http://www.adobe.com/products/air/
I think any those will help you, check it out.
I don't have any experience with it but there's a portable version of XAMPP.
You wouldn't necessarily have to use the Apache portion. The app could just run from the command-line, depending on what you're trying to do.
I dont know how to use PHP as standalone programming language, I mean without using a web server and a browser.i can answer your other question.
SQLite is a database system(to be more specific: a library!) which provides you all the basic capabilities of SQL database without needing to install any specific database servers.But you do need to copy a small .dll file(sqlite3.dll i suppose) into your working dirctory.The file is only a very small one,but you get all of the basic capabilities of a database such as INSERT DELETE UPDATE SELECT etc..Its a great light weight database..i mean it..really lightweight.
also PHP has inbuilt support for SQLite database.so compatibility will never be a problem
Have a look at their home page https://sqlite.org/
This is what they describe themselves:SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. SQLite is the most widely deployed SQL database engine in the world.
Checkout phpdesktop that gives you:
Embedded web browser based on Chromium framework let you benefits from HTML5, javascript and jQuery.
Embedded web server with mongoose let you use php.
embedded database engine with SQLite.
I've got an upcoming project wherein I will need to connect our website (PHP5/Apache 1.3/OpenBSD 4.1) to our back-end system running on an iSeries with OS400 V5R3 so that I can access some tables stored there. I've done some checking around but am running into some roadblocks.
From what I've seen the DB2 extensions and DB2 software from IBM only run under Linux. I've tried compiling the extensions with all the software from IBM and even tried their precompiled ibm_db2 extension with no luck. IBM only supports Linux so I turned on the Linux emulation in the kernel but that didn't seem to help anything.
If anyone has run across getting everything to run natively under OpenBSD that would be great, but what I think I may have to do is setting up a second server running CentOS with DB2 installed (most likely via ZendCore for IBM since it seems to do all this for me) and the driver so that I can set up a small transaction server that I can post against and get a JSON representation of the DB2 data that I need.
Does the second option seem overkill or does anyone else have any better ideas?
Have you looked at connecting to the server using unixODBC? If I remember correctly it has support for IBM DB2 and compiles on OpenBSD. Check out http://www.php.net/odbc for more information regarding the PHP side.
If you can't get that to work, the option to setup a web service on a Linux server may be all you can do.
Rather than setup a 2nd box, why don't you look into the PHP Connector for iSeries? My mainframe guys said it was very easy to setup on our iSeries here.
We wrote a simple server in PHP that loads data models from DB2 data, serializes them, and returns them to the caller. This approach means that only another PHP app can consume the service but it's just so much quicker on both ends to just serialize the object and send it down the pipe.
Here is a PDF from IBM on the subject: http://i-seriesusergroup.org/wp-content/uploads/2006/09/PHP%20for%20i5OS%20NESDND.pdf
To second #John Downey, I've gotten connectivity to work with PHP on an AS/400 with unixODBC.
Check your phpinfo() to see if unixODBC is available in it. I didn't have to compile it in on SLES 10.
Looks like a web service is going to be the answer for me. On a production box I'd rather not have to go through compiling and maintaining my own special installation of PHP since ODBC support needs to be compiled in, according to the PHP documentation.
A web service is almost certainly the way to go. I'm sure you've already thought of this, but since you're doing PHP on both sides, you can shortcut things a little bit by using serialize() to build your response data instead of building a proper XML document. It's less flexible over the long run, but it will probably get you up and running more quickly.
Indeed, a webservice seems like a great way to solve the problem. One way to avoid having a completely separate OS for it would be to write the webservice in Java on top of the AS400 tools for Java (which are quite nice, btw). That should at least let you run your service layer on the OpenBSD box as well.
You can connect directly using a standard ODBC driver as well. The IBM version usually gives you more features like being able to call programs and things like that. If you only need SQL and stored procedures, ODBC should work.
Why not use PDO from PHP? I have to guess here since I could not find a public list of all ports available for OpenBSD, but since there is a port for FreeBSD, NetBSD etc. maybe you get lucky as well.
(I guess that even though OpenBSD links to FreeBSD's porter's handbook, Freshports is not applicable for your system?)
If PDO is not available and since I am hoping you use ports and according to the following link there is php5-ODBC available:
http://www.openbsd.org/pkg-stable40.html
So assuming you manage your system through ports, there are your pointers.
Hope that helps!
I'm writing a CMS application in PHP and one of the requirements is that it must be able to interface with the customer's Exchange server. I've written up this functionality a few times before and have always used WebDAV to do it, but now I'm leaning away from that.
I will be running the site on IIS OR Apache (no preference) on Windows server 2008. A few things I would need to do include adding contacts to a given user's address book, sending emails as a given user and running reports on contacts for a user.
All of this is pretty easy to do with WebDAV, but if there is a better way that doesn't require any functionality that is likely to be deprecated any time soon.
Any ideas?
Update:
Justin, I love the idea of using com objects, I just worry about maintaining a 3rd product to make everything work...
John, I can write a web service in C# to interface with for these functions and access it with my PHP app, but it's also a little bit out of the way.
So far, I'm not 100% convinced that either of these is better than WebDAV...
Can anyone show me where I'm being silly?
Update as of 2020:
Over a decade since this question and things have moved on. Microsft now has a Rest API that will allow you to easily access this data.
Original Answer
I have not used PHP to do this but have experience in using C# to achieve the same thing.
The Outlook API is a way of automating Outlook rather than connecting to Exchange directly. I have previously taken this approach in a C# application and it does work although can be buggy.
If you wish to connect directly to the Exchange server you will need to research extended MAPI.
In the past I used this wrapper MAPIEx: Extended MAPI Wrapper.
It is a C# project but I believe you can use some .NET code on a PHP5 Windows server. Alternatively it has a C++ core DLL that you may be a able to use. I have found it to be very good and there are some good example applications.
Sorry for the delay no current way to keep track of posts yet.
I do agree adding more layer on to your application and relying on 3rd party code can be scary (and rightfully so.)
Today I read another interesting post tagged up as MAPI that is on a different subject. The key thing here though is that it has linked to this important MS article. I have been unaware of the issues until now on using managed code to interface to MAPI although the C++ code in the component should be unaffected by this error as it is unmanaged.
This blog entry also suggests other ways to connect to MAPI/Exchange server. In this case due to these new facts http://us3.php.net/imap may be the answer as suggested by the other user.
Is your customer using Exchange 2007? If so, I'd have a look at Exchange Web Services. If not, as hairy as it can be, I think WebDAV is your best bet.
Personally I don't like using the Outlook.Application COM object route, as its security prompts ("An application is attempting to access your contacts. Allow this?", etc.) can cause problems on a server. I also think it would be difficult to accomplish your impersonation-like tasks using Outlook, such as sending mail as a given user.
I have released an open-source MIT licensed library that allows you to do some basic operations in PHP using Exchange Web Services.
Exchange Web Services for PHP
I have only tested it on Linux but I don't see any reason why it wouldn't work on a Windows installation of PHP as well.
I can't recommend Dmitry Streblechenko's Redemption Data Objects library highly enough. It's a COM component that provides a sane API to Extended MAPI and is a joy to use. The Exchange API goalposts move from one release to the next: “Use the M: drive! No, use WebDAV! No, use ExOLEDB!… No, use Web Services!” with the only constant being good old MAPI.
I'm not a PHP dev but Google says that PHP 5+ can instantiate COM components. If you can install Outlook on a box you could write a PHP web service around the COM component to handle the requests you need.
$outlook = COM("Outlook.Application")
Outlook API referance
I would recommend using "PHP Exchange Web Services" or short php-ews.
Fair amount of documentation under the wiki, helped me a lot.
This Zarafa PHP MAPI extension looks like it could work.
I would look into IMAP
IMAP, POP3 and NNTP
https://github.com/Garethp/php-ews
It was last updated 3 months ago so it is maintained