Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

IBM iseries i5 php system command

Posted on 2009-07-08
3
Medium Priority
?
955 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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

These days socially coordinated efforts have turned into a critical requirement for enterprises.
This article discusses four methods for overlaying images in a container on a web page
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
Suggested Courses

618 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