![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how will i connect postgres database from unix shell script | jambesh | Shell Programming and Scripting | 3 | 07-16-2008 12:09 PM |
| connect to sqlplus from shell | aya_r | Shell Programming and Scripting | 4 | 02-07-2007 05:52 AM |
| How to connect to database db2 through Unix Shell Script | ankitgupta | Shell Programming and Scripting | 3 | 10-31-2006 09:50 AM |
| Difference between writing Unix Shell script and AIX Shell Scripts | haroonec | AIX | 0 | 04-12-2006 03:27 AM |
| Connect to sybase database using Korn shell script | bhgopi | Shell Programming and Scripting | 7 | 08-10-2005 10:34 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
How to connect PHP and Shell Scripts
Dear Friends,
Plz some one tell me how to connect PHP and Shell Scripts. Mail me on address removed by moderator Thanks Nishant Last edited by blowtorch; 03-19-2007 at 05:47 AM.. Reason: remove email id |
|
||||
|
what do you mean by connecting PHP with shell scripts? in PHP you can use shell scripts/single commands by using exec passthru system see http://php.net for more details on these commands. PHP Code:
Having a shell script you can use PHP like this: Code:
#!/bin/sh
MY_LOCAL_DATE=`php -r 'echo "today is ".date("l d.m.Y", time());'`
echo $MY_LOCAL_DATE
In this case you have to echo the output of your PHP stuff, to receive the result and save it to a variable. The following code demonstrates how to access shell variables within PHP Code:
#!/bin/sh export MY_PWD=`pwd` MY_OUTPUT=`php -r 'echo "we are in directory ".$_ENV["MY_PWD"];'` echo $MY_OUTPUT |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|