Solved

IBM iseries i5 php system command

Posted on 2009-07-08
3
940 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 35

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 35

Expert Comment

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

- Gary Patterson
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Change static entered data to dynamic with counter 5 36
Survey branching tutorial 11 44
Using the QLIRLIBD 2 21
CURL sending XML without spaces PHP 5 37
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 …
In a recent article here at Experts Exchange (http://www.experts-exchange.com/articles/18880/PaperPort-14-in-Windows-10-A-First-Look.html), I discussed my nine-month sandbox testing of the Windows 10 Technical Preview, specifically with respect to r…
The viewer will learn how to dynamically set the form action using jQuery.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

726 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