php and linux integration help.
I m devoloping a website which communicate with Linux server .
Whenever a page is loaded it runs one script on Linux server. My problem is a simple commands like date , ls runs very smoothly. But whenever i execute big script.It wont display the output. My knowledge of PHP is very less i m using simple echo command to run the script and display the output. My php file: Working Program: <html> <head><title>This is my page</title></head> <body> This is the content of my page. <?php print "Do you like it?"; ?> <?php echo `date`; ?> </body></html> Output: This is the content of my page. Do you like it?Thu Mar 18 15:02:36 IST 2010 When i modify my php file as <html> <head><title>This is my page</title></head> <body> This is the content of my page. <?php print "Do you like it?"; ?> <?php echo `ssh -ttq 10.180.8.231 ls -ltr`; ?> </body> </html> Output:This is the content of my page. Do you like it? However the command ssh -ttq 10.180.8.231 ls -ltr get executed properly on linux machine. Please help. |
Have you looked here http://www.php.net/manual/en/. There's examples of how to use all the cmds in php.
|
You're up against user permission issues. PHP inherits the user permissions of the web server (e.g. Apache). Can your web server issue a passwordless SSH command?
|
Quote:
Being new to linux can u help me giving permission to Apache webserver. The reason i m not giving a password for SSH is i have added RSA key to Remote server i.e 10.180.8.231 there fore when i execute ssh -ttq 10.180.8.231 ls -ltr it doesnt ask for password . However i m not sure how do i run the same command from web browser ? |
I think i need to give bash script execution permission to apache? correct me if i m wrong.
|
You need to
su - apache and create a key for that user and txfr it. |
Thank you very much my problem is solved by creating key and transferring it using apache login.
|
All times are GMT -5. The time now is 10:04 AM. |