Solved

IBM iseries i5 php system command

Posted on 2009-07-08
3
935 Views
Last Modified: 2013-12-13
I am running PHP on an IBM iSeries i5 machine.  From within a PHP script I am trying to issue the "system()" command.  As far as I can tell nothing is happening.  I have tried "system()", "exec()", "shell_exec()" but nothing works.  Can someone point me in the right direction?  Thank you!
system("SNDMSG MSG('this is a test 2') TOUSR(RCRIST)");

Open in new window

0
Comment
Question by:richard_crist
  • 2
3 Comments
 
LVL 34

Accepted Solution

by:
Gary Patterson earned 500 total points
ID: 24806052
I'm not a PHP expert, but maybe this will get you going in the right direction:

PHP runs in the PASE environement.  I assume this means that if you use system(), exec(), shell_exec(), etc, you probaby need to use PASE commands and not native (OS/400) commands.  The PASE "system" command is used to run OS/400 commands from a PASE session.

CALL QP2TERM   /* Starts a PASE terminal session */
system 'SNDMSG MSG('this is a test 2') TOUSR(RCRIST)'

Will allow you run the SNDMSG command from PASE.  The full path to "system" is /QOpenSys/usr/bin/system, so if you need to specify a path:

/QOpenSys/usr/bin/system 'SNDMSG MSG('this is a test 2') TOUSR(RCRIST)'

should do it.

You'll have to figure out how to get it quoted properly, I suspect.

This redbook has some info and examples on getting started with PHP on AS/400:

http://www.redbooks.ibm.com/redpapers/pdfs/redp3639.pdf

- Gary Patterson
0
 
LVL 3

Author Closing Comment

by:richard_crist
ID: 31601182
You are a Guru!  No...really.   :)

Thanks, Gary, for your help on this and other stuff in the past!  Your idea worked great!  Below is what I ended up doing:

  $cmd = "/QOpenSys/usr/bin/system \"SNDMSG  MSG('hello 5') TOUSR(RCRIST)\"";
  system($cmd);
0
 
LVL 34

Expert Comment

by:Gary Patterson
ID: 24808694
Happy I could help.

- Gary Patterson
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
curl SSL certificate unable to get local issuer certificate 15 66
PHP & MySql - Turn Select Query Results into a Glyphicon 3 30
PHP and google maps 13 44
RUNRMTCMD from AS/400 12 45
As the title indicates, I have done this before. It chills me everytime I update the OS on my phone, (http://www.experts-exchange.com/articles/18084/Upgrading-to-Android-5-0-Lollipop.html) because one time I did this and I essentially had a bricked …
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question