call shell script from php exec()
Posted: Tue May 27, 2008 3:12 pm
Hi,
I call a shell script through php.The shell script need root privelages,for this I edit the sudoers file and give the root permission to apache.
Every thing in the shell script working fine except the httpd restart.But when i run it from command lne its working fine.Here is my flow
my client.php in /var/www/html
passthru(" sudo /usr/bin/php -f /home/server.php"")
/home/server.php
exec("cd /home/gaea/shell/;sh LoginMysql.sh", $output ,$returnValue);
my shell script
..
/opt/tomcat/bin/startup.sh
/etc/init.d/httpd restart
apache log
caught SIGTERM, shutting down
please help me out this problem,sorry for my poor english
Thanks
Govindan
I call a shell script through php.The shell script need root privelages,for this I edit the sudoers file and give the root permission to apache.
Every thing in the shell script working fine except the httpd restart.But when i run it from command lne its working fine.Here is my flow
my client.php in /var/www/html
passthru(" sudo /usr/bin/php -f /home/server.php"")
/home/server.php
exec("cd /home/gaea/shell/;sh LoginMysql.sh", $output ,$returnValue);
my shell script
..
/opt/tomcat/bin/startup.sh
/etc/init.d/httpd restart
apache log
caught SIGTERM, shutting down
please help me out this problem,sorry for my poor english
Thanks
Govindan