Jump to content

shell commands in php


ashok!!!

Recommended Posts

guys....... need help!!

there is command which when executed in terminal gives the output without error in 5 seconds. but when i run the same in a php file using

shell_exec($cmd)

i m getting error. please help me out here.

thanq in advance :)

Link to comment
Share on other sites

when i tried

shell_exec(ls)

its working fine... i mean.. i m getting all the files/folders in the directory in which the php file is present.

actually... i can send sms from the terminal through my mobile (connected to the computer) which takes about 5 secs.

but when i tried running the same in the php file..... i m getting error as "device not found". i also saw some posts telling that the commands which take time to execute are giving errors when ran in a php file.

Link to comment
Share on other sites

this is my php file

 

<?php

$msg=$_GET['messagee'];

$num=$_GET['senderr'];

$output = popen("echo $msg | /usr/bin/gammu --sendsms TEXT $num &", 'r');

echo "'$output'; " . gettype($output) . "\n";

?>

 

this was my output:

'Resource id #2'; resource

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.