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!
Related
I'm in the middle of a project that I can't test, so before I get too terribly entrenched in programming everything a certain way, I want to know if anyone is aware of compatibility issues I need to keep an eye out for.
These are the things I've been given, and can't be changed:
- A Windows XP machine (for now; they promise we'll upgrade to Windows 7 "soon") running MS SQL Server 2008
- A Raspberry Pi on the same network as the aforementioned computer, hooked up to a monitor
My task is to build a web page that will display realtime information based on the contents of the database. The best way I've come up with to do this is to make a web page using PHP that uses SQL statements to analyze the data in the database, format it so it makes sense, and then display it in a relatively minimalistic format. I never got a good answer about what browser it'll be displayed in, but I know they're leaving some newer build of Debian on the Pi, so I'm assuming it'll end up being something Chromium-based.
I've downloaded MS SQL Server, XAMPP, and the Microsoft SQL Server PHP drivers (not the MSSQL drivers that come with PHP). I've managed to make something that's successfully pulling information off the server and updating it as necessary, but I'm starting to worry about the drivers, and any other configuration that might have to take place. Should I be considering just scrapping the Microsoft functions and trying to make it work with the usual MSSQL stuff instead, or building something with PDO? Is there anything special about running in a linux environment I should be aware of? I won't really get the chance to test this on anything other than my windows laptop until "go time," so I want to be as prepared as possible. I'd appreciate advice from anybody with any experience in this sort of project
(...) but I know they're leaving some newer build of Debian on the Pi, so
I'm assuming it'll end up being something Chromium-based.
Regarding the browser, make sure your website is as light as possible (try not to use too much Javascript). Due to the device's limitations, browsing is rather slow, even with Midori (the default browser currently being shipped in the latest versions of Raspbian). You can install chromium but it'll be even slower.
As for the server, I agree with Michael Berkowski, go with PDO.
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.
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,
I am looking for a way to access and query my remote databases from my local server.
Something like PhpMyAdmin, but little more versatile.
So that I can feed it with databases I would like to see, store my queries (or better, if it has ways to access simple queries built in itself)
Can someone help me with such a PHP Script (or Class)?
Regards
Nikhil Gupta
I think it would be better to use a MySQL client instead.
I have been using sqlyog's community edition for years. It has a quick startup, and allows you to connect to multiple servers at the same time.
http://code.google.com/p/sqlyog/downloads/list
One of my favorite features is the ability to copy databases from one server to another.
( Yes, you could do this via the CLI, but having a GUI is handy. )
If it's ok to run as windows-programs, here are two suggestions:
Dbvisualizer http://www.dbvis.com/
Visual studio (even express versions) has what they call "database explorer", just install some mysql-connector that VS can handle, like odbc.
PHP has full support for mysql databases. See http://www.php.net/manual/en/ref.msql.php. Just use the address for your remote server when opening the connection.
I'm curious if there are any SubSonic ports for use with php on a unix environment. I'm using SubSonic at work and I love it, and I'd like to create a MySQL database on a FreeBSD server and talk to it using php. I was hoping to use SubSonic again, but I'm not sure if there are any versions of it that work with php.
Are there any versions of this out there, or similar products to subsonic that work in php?
Unfortunately, I'm not aware of any direct ports of SubSonic to Unix. If you're not set on PHP, you could always try .NET running on Mono - that will give you SubSonic as is. Ruby on Rails is a second option - if I remember correctly, it served as inspiration for many of Subsonic's features.
If you're really set on PHP, you can always try Doctrine. I've never used it, but I've heard reasonable things about it. Propel is another option. If you're not opposed to full frameworks, I Symfony, CakePHP, and CodeIgniter all have some sort of ActiveRecord implementation.
SubSonic is definitly a .Net only project. I have used SubSonic with Mono to run a blog with a MySql back end on an OpenSuse Linux machine with Apache and found that SubSonic worked well. If you are stuck on PHP you could just create a webservice with Mono and SubSonic and then call your webservice from PHP or even from JSON if you set your web service up to handle JSON.