You can execute linux commands within a php script - all you have to do is put the command line in backticks (`).
And also concentrate on exec() , this and shell_exec() ..
Shanti C
Posting Virtuoso
1,642 posts since Jul 2008
Reputation Points: 137
Solved Threads: 162
Sorry...i don't know much on this...
Any other experts will get you the information....
Sorry...
Shanti C
Posting Virtuoso
1,642 posts since Jul 2008
Reputation Points: 137
Solved Threads: 162
Thanks Shanti but would you be a bit elaborate about how could I log in to a remote server. I had visited php.net earlier but the first and foremost problem for me is to log into the remote system. Suppose the username is "abcde", password is "wxyz" and IP address is 100.100.100.100. Please tell me how to first log into this system using these parameters. Any sort of help would be much appreciated.
Thanks Again
Gaurav
It would probably be best to create a PHP page on the remote system that will get the "memory utilization and disk quota of a remote system" and display it to HTTP.
eg: http://remote-sever.com/memory-and-disk-quota.php
<?php
$results = exec('your command');
echo $results;
?>
Then from your local machine query the remote system over HTTP:
<?php
$results = file_get_contents('
http://remote-sever.com/memory-and-disk-quota.php');
echo $results;
?>
You can also build authentication into the remote machine, or use basic auth, etc.
eg: basic auth
<?php
$results = file_get_contents('
http://user:pass@remote-sever.com/memory-and-disk-quota.php');
echo $results;
?>
This way, you don't ever send arbitrary code to the remote system, and limit the code execution to that hardcoded into your PHP file.
If you really need to pass arbitrary commands to the remote system for some reason, you may want to implement the SSH protocol. In this way, your PHP script will act as an SSH client, that will log into the SSH server on the remote system, execute commands and read the response.
digital-ether
Nearly a Posting Virtuoso
1,293 posts since Sep 2005
Reputation Points: 461
Solved Threads: 101
Hi,
Pls tell me how to code this shell command in PHP
( echo "RGBA32 88 31 20 25 0 1" ; cat /var/www/vhosts/lankaclipstv.com/httpdocs/mylogo.rgba ) > /var/www/vhosts/lankaclipstv.com/httpdocs/mylogo.fifo &
I tried above but it seems not working no output.
There will be no output from those set of commands. All output from the first and seconds are sent to: /var/www/vhosts/lankaclipstv.com/httpdocs/mylogo.fifo
so if you want to see if it works, view the contents of /var/www/vhosts/lankaclipstv.com/httpdocs/mylogo.fifo
eg:
cat /var/www/vhosts/lankaclipstv.com/httpdocs/mylogo.fifo
digital-ether
Nearly a Posting Virtuoso
1,293 posts since Sep 2005
Reputation Points: 461
Solved Threads: 101