Manage files using PHP on Linux Server
I have been playing around with my Ubuntu Server recently and found out that I have to use SSH each time I need to use the server. This remained me of PHP backtick operator, which has the ability to execute Linux command using PHP. This means that I can write a PHP script to manage the files on my server using Linux commands that I already knew without SSH.
Since I can’t connect my server to the outside world because of Verizon, I don’t have any security risk to change the files permissions on my server to 777. I then wrote the following code to show the list of files/directories under the web server root:
$command = `ls`;
$list = explode("n", $command);
$lslist = "";
foreach ($list as $lsLx) {
   echo $lsLx . "<br />";
}
Here is the code I wrote to use different parameters of li command. For instance, li -a shows all of the files/directories including the hidden ones and li -l shows the long list format.
I want to write a web UI to use with FFmpeg since I use it most of time on my server to convert videos to ogv format. The above code is just my concept of how to use PHP form to execute Linux command dynamically. It enabled me to use it as a base of designing the Web User Interface for Linux commands.
There are no posts related to Manage files using PHP on Linux Server.