lalitmishra Posted June 7, 2008 Share Posted June 7, 2008 How to execute linux commands through a php program? :- 1- I am taking a 'C' program as input in PHP program. I want execute it directly through PHP means linux commands 'gcc' should be executed directly through our php program and out put should be displayed on our php page. 2- Execution of linux Commands like VMSTAT in our php program. How to execute it through php program. Please reply soon. Quote Link to comment Share on other sites More sharing options...
MiCR0 Posted June 7, 2008 Share Posted June 7, 2008 It depends on what Linux you are on however FC you can kick out of php to run Linux command with system("cd /home/whereEver;nohup ./myscipt --commands > /dev/null & echo $!;"; the "> /dev/null & echo $!" changes from versions of Linux however it is needed to stop hanging of a command if you are not looking for as reply. You could also use shell_exec("whatever "); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.