Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 925
  • Last Modified:

Execute Telnet Commands

Hi,

In my website I don't have telnet access.

Is there a way to execute telnet commands using php such as creating or transfering databases ?

Regards,,

0
Zuhair070699
Asked:
Zuhair070699
  • 2
1 Solution
 
ykf2000Commented:
Hi,


You can execute commands in PHP. Try the exec command like

exec("mylsqldump xxx > backup.txt");
0
 
sweatjeCommented:
If you really wanted to be dangerous (allowing adhoc exec commands on your system is something you should try to keep to a minimum), make a form with a textbox you enter your command in as shell_command and post to this script:

<?php
exec("$shell_command", $output, $error);  
if (!$error){
     while (list(,$line) = each($output)){
       echo $line, "<BR>\n";
     }
}
?>
0
 
Zuhair070699Author Commented:
Hi,

I tried the following script but I got error number: 127

========================================================

<?

$shell_command= "mysql -uUserName -pPassword DatabaseName < /home/www/backup/backup.sql";

exec("$shell_command", $output, $error);  
if (!$error){
    while (list(,$line) = each($output)){
      echo $line, "<BR>\n";
    }
}

else{ echo "Error no: ";}
?>

========================================================

Any Idea
0
 
sweatjeCommented:
One problem is that all commands executed in this manner will be at the security level of the web server (generally nobody).  I believe nobody will have to be able to have read/execure rights on mysql and read rights on /home/www/backup/backup.sql
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now