Exec bash shell via PHP Site !


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Exec bash shell via PHP Site !
# 1  
Old 07-22-2008
Exec bash shell via PHP Site !

Hi everybody !

I writed php code so exec bash shell via php (SMS Send via bash shell) but i have problem as follow :
1. When i exec from linux mode : ./sms.sh --- output is "Messages ... OK". Then all message has been sent.
2. When i exec from PHP site --- return value is "Message ... OK" on PHP site. But no messages has sent.

I don't know why! This is sample code :

[index.php]
<?php
$output = shell_exec('./bash.sh');
echo "<pre>$output</pre>";
echo "Messages ...OK<br>";
?>

[bash.sh]
#!/bin/sh
### SMS sending code ###...
echo "Messages ...OK"

Anybody can give any ideas in this case !

Thank so much !
# 2  
Old 07-22-2008
Probably the SMS sending code is doing something which is not permitted when it is run as the Apache / PHP user, but which is okay when it is run as yourself. Without seeing that code, we can only guess.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to block first bash script until second bash script script launches web server/site?

I'm new to utilities like socat and netcat and I'm not clear if they will do what I need. I have a "compileDeployStartWebServer.sh" script and a "StartBrowser.sh" script that are started by emacs/elisp at the same time in two different processes. I'm using Cygwin bash on Windows 10. My... (3 Replies)
Discussion started by: siegfried
3 Replies

2. Shell Programming and Scripting

Exec submit form in bash script

Hi All, I'm new in forum. Many congratulations to everyone for all work. I'm not an expert in bash script I've a problem with a sh file. The sh file run every t minuts and it read data from txt file and then compile form. Finally, the user, from the web browser click on send. The script... (0 Replies)
Discussion started by: Herbert
0 Replies

3. Programming

Bash script - find command with delete and exec

hi all, i have devised a script that starts in /restored/ and in there, there are a lot of sub folders called peoples names and in the sub folders are files/folders and it deletes the data in the sub folders BUT not the sub folder itself and it should then touch a file in all the sub folders... (3 Replies)
Discussion started by: robertkwild
3 Replies

4. SCO

FTP problem with site exec command

Hello dear Users, I am for the first time in this forum. I come from Germany. Please excuse my bad englisch. My OS is SCO open Server Release 5. I have a problem whith FTP and the command "site exec" if I use the command "ftp> site chmod 777 /tmp/startkpf.sc 200 CHMOD command successful. ... (8 Replies)
Discussion started by: fla5do
8 Replies

5. Programming

PHP exec to restart mysqld

I want to do something very very bad. I want to create a button that restarts mysqld. Why is irrelevant for my issue. Here is my php script ... <?php if(isset($_POST)){ exec("sudo /etc/init.d/mysqld restart"); } ?> <form method="POST"> <input type="submit" name="restart"... (3 Replies)
Discussion started by: noPermissions
3 Replies

6. Shell Programming and Scripting

php shell_exec, exec command timeout

HI, Does anybody know if its possible to execute a command through exec, shell exec, system and if the program doesn't terminate in N seconds returns control to PHP ? reg, research3 ---------- Post updated 10-16-09 at 12:20 AM ---------- Previous update was 10-15-09 at 11:03 PM... (1 Reply)
Discussion started by: research3
1 Replies

7. Shell Programming and Scripting

General Q: how to run/schedule a php script from cron jobs maybe via bash from shell?

Status quo is, within a web application, which is coded completely in php (not by me, I dont know php), I have to fill out several fields, and execute it manually by clicking the "go" button in my browser, several times a day. Thats because: The script itself pulls data (textfiles) from a... (3 Replies)
Discussion started by: lowmaster
3 Replies

8. Shell Programming and Scripting

how to use exec command in C shell

i have a script where i am reading some lines from a file into another file.. script works fine in bash.. #!/usr/bin/csh awk 'NR>20&&NR<32' try.sum | awk '{print $4 }' >io awk 'NR>20&&NR<32' try.sum | awk '{print $9 }' >io1 awk 'NR>20&&NR<32' try.sum | awk '{print $14 }'>io2 exec 10<io... (1 Reply)
Discussion started by: npatwardhan
1 Replies

9. Shell Programming and Scripting

bash shell: 'exec', 'eval', 'source' - looking for help to understand

Hi, experts. Whould anybody clear explay me difference and usage of these 3 commands (particulary in bash) : exec eval source I've tryed to read the manual pages but did not get much. Also could not get something useful from Google search - just so much and so not exactly, that is... (3 Replies)
Discussion started by: alex_5161
3 Replies
Login or Register to Ask a Question