You're mixing up server-side and client-side code. The exec inside the onclick will run when the web page is built on the server, leaving the web page with an empty
onclick=""
.
PHP only runs when the web page is put together by the server, so you will either have to run the command when the page is opened and then display the result as part of the page, or use AJAX to call back to the server to run the command from the page and get the results back if you must use a button.
According to the
manual page[
^], the exec function does not output anything so you would need to echo the result of the call or assign it to a variable to see what you get back.