PHP calling programs on AS/400

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I have a website (running on a linux machine) that currently makes use
of JSP to access data on an AS/400.

I've found information telling me that after setting up ODBC drivers on
the linux server I'll be able to access the databases on the AS/400
however I've not found any information about executing programs on the

I've looked at the docs for exec, passthru, etc. and it appears those
will only work on the local operating system.

Is it possible for a PHP page to execute a program on a remote machine?

If so, how does PHP handle the ASCII <--> EBCDIC conversion for
parameters passed and returned?


Re: PHP calling programs on AS/400

PHP is server side oriented.
ascii2ebcdic() and abcdic2ascii() functions in PHP translate from/to EBCDIC.

Quoted text here. Click to load it

Re: PHP calling programs on AS/400

Speedy Gonzales wrote:
Quoted text here. Click to load it

Unfortunately those two functions are only available on Apache that is
running on EBCDIC systems such as OS/390.  My Apache is running on linux.

I've been doing a lot of searching on this and it appears that I'm going
to have to stick with Java on this project.

Thanks anyway Speedy.

Re: PHP calling programs on AS/400

I just came from a shop that used Websphere which was able to execute
programs on the AS/400(iSeries) and it worked just fine.  It was
running on Windows using the Apache server.  Sorrry no Linux info.

Re: PHP calling programs on AS/400

beebee wrote:
Quoted text here. Click to load it

Hmm... do you know if the calls to programs on the AS/400 were passing
parameters back and forth?

I did stumble across ssh2_* functions that will let you execute programs
on a remote server but trying to adapt that and integrate home-rolled
functions to convert EBCDIC <-> ASCII sounds like more work (and shaky
work at that!) than I want to mess with.

In case anyone is curious it appears they are working on this type of
functionality in the CVS version of PHP:

Thanks beebee, I appreciate the post.

Re: PHP calling programs on AS/400

Benny Hill wrote:
Quoted text here. Click to load it
Oh yeh, they were passing everything back and forth once you signed on.

It seems as though they offered other middleware to iseries programs. /, will probably give you soom other paths to
where you want to go other than this Java intensive Websphere doo-doo.
I think there was even a free software package available.  Of course
you couldn't do any development or fancy screen facing that Websphere
allows.  I'd be willing to bet that IBM will drop Java and take off
with something in PHP. It seems like they never want to be pinned down.

Re: PHP calling programs on AS/400

beebee wrote:

Quoted text here. Click to load it

Geez I hate IBM's website.  I checked out your link to see if it would
take me anywhere new in the seemingly never-ending land of and I
didn't see anything that looks helpful for my particular set up.
Everything on their site suggests using Websphere which is definitely
*not* what I want to do.

If my client was willing to run Apache/PHP directly on the AS/400 I
could probably make things work but they won't do that "because of
security reasons". Instead the web server resides on a separate linux
box (on the other side of two separate firewalls actually).

I'm glad that Big Blue is on the linux bandwagon though and the Java
Toolbox they provide for accessing data and programs on a 400 is
certainly acceptable. Just not my cup of tea.

Thanks again,

Site Timeline