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. Link to comment https://forums.phpfreaks.com/topic/109101-how-to-execute-linux-commands-through-a-php-program/ 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 "); Link to comment https://forums.phpfreaks.com/topic/109101-how-to-execute-linux-commands-through-a-php-program/#findComment-559684 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.