FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Can Php call command line interfaces on the OS





mike_phi
Hi there I just wanted to know if anyone has any samples of Php calling command line commands on the os, looking for the most elegant way of doing this, maybe some sort of os module exitst out there

e.g. unix type operating system being able to call mkdir, cp, ls > somefile.txt

if so please just slip me a note

cheers Mic
JayBee
All functionality depends on php safe_mode, disable_functions directives, ...

If you want only execute an external program
exec, system, shell_exec

If you want communicate with the program and manage output
popen or better proc_open

http://php.net/manual/ref.exec.php

some "php shell" script
Code:
<?php
$cmd = $_REQUEST["-cmd"];
?><html>
    <head><title>SH3LL</title></head>
<body bgcolor=#000000 text=#FFFFFF"
onLoad="document.forms[0].elements[-cmd].focus()">
  <form method=POST>
    <input type=TEXT name="-cmd" size=64 value="<?$cmd?>" style="background:#000000;color:#FFFFFF;">
      <pre><?php

        if ($cmd != "")
          print Shell_Exec($cmd);

      ?></pre>
  </form>
</body>
</html>


or better one http://mgeisler.net/php-shell/

and some useful link
http://www.mhuffman.com/notes/dos/bash_cmd.htm


I don't know if I answer what you ask Very Happy
Related topics
Check strange file(or your computer) for viruses on-line
[PHP] Faking Shell Access Through PHP
Screwed Up PC
Is there a bittorrent command line daemonized client?
The Matrix Effect (ms dos command line)
apache php and mysql on mac OS X
Convert .flv to avi etc..
Softwares for Command Line Freaks...
Movie Computers
Finch - IM Client for command line
Offline js compressor
Ubiquity : Command-Line
cron jobs
C++ with the command line?, C++ for vista
Reply to topic    Frihost Forum Index -> Computers -> Software

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.