UNIX Shell Scripts that requires input from user in PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dpittman36
Forum Newbie
Posts: 2
Joined: Wed Sep 01, 2010 5:15 pm

UNIX Shell Scripts that requires input from user in PHP

Post by dpittman36 »

Hi I am a Newbie to the forum.

Is it possible to run a UNIX shell script that requires input from users in a PHP page?
Does anyone have an example or tutorial.
I am familiar with system(), passthru, and shell_exec.

Suppose I ran a UNIX shell script (change_date.sh) in UNIX .
The script will prompt user to enter new date. (User enters date)
Afterward, ask user are you sure you want to change date. (User enters Y or N)

How do I call change_date.sh in my PHP page to do the same thing?

Thanks
Gargoyle
Forum Contributor
Posts: 130
Joined: Wed Jul 14, 2010 12:25 am

Re: UNIX Shell Scripts that requires input from user in PHP

Post by Gargoyle »

yes, possible, but you need to open a pipe to the process. see php function popen().
dpittman36
Forum Newbie
Posts: 2
Joined: Wed Sep 01, 2010 5:15 pm

Re: UNIX Shell Scripts that requires input from user in PHP

Post by dpittman36 »

Any good tutorial sites you can recommend?
I still cannot find anything similiar to what I am looking for.

Thanks
Post Reply