{"id":55220,"date":"2022-03-25T03:01:40","date_gmt":"2022-03-24T17:01:40","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=55220"},"modified":"2022-03-24T15:12:34","modified_gmt":"2022-03-24T05:12:34","slug":"php-shell_exec-versus-exec-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/php-shell_exec-versus-exec-tutorial\/","title":{"rendered":"PHP shell_exec Versus exec Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/s_e\/s_e.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"PHP shell_exec Versus exec Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/s_e\/s_e.jpg\" title=\"PHP shell_exec Versus exec Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">PHP shell_exec Versus exec Tutorial<\/p><\/div>\n<p>Being suckers for &#8220;out of the box&#8221; solutions to programming issues, what comes &#8220;out of the box&#8221; with your (perhaps underlying) operating system of use is always inflicting &#8220;sucker punches&#8221; onto areas we didn&#8217;t know existed before <font size=1>&#8230; well, you had to be there, didn&#8217;t you?<\/font><\/p>\n<p>That&#8217;s why we really like PHP&#8217;s <a target=_blank title='PHP exec() method information' href='http:\/\/php.net\/manual\/en\/function.exec.php'>&#8220;exec&#8221;<\/a> and <a target=_blank title='PHP exec() method information' href='http:\/\/php.net\/manual\/en\/function.passthru.php'>&#8220;passthru&#8221;<\/a> that we have used quite a bit in the past, to get through to that underlying operating system set of commands in its command line environment, as applicable.  Even mobile platforms get a go here, because PHP is a serverside language addressing the RJM Programming linux web server, though you can download <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/s_e\/s_e.php_GETME\" title=\"s_e.php\">s_e.php<\/a> to your local (client) environment, and access a different perspective in an Apache\/PHP\/MySql local web server environment such as <a target=_blank title='MAMP for Apache\/PHP\/MySql on Mac OS X local web server' href='http:\/\/www.mamp.info'>MAMP<\/a> to work in.<\/p>\n<p>Today, we compare <a target=_blank title='PHP exec() method information' href='http:\/\/php.net\/manual\/en\/function.shell-exec.php'>&#8220;shell_exec&#8221;<\/a> to &#8220;exec&#8221; with our <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/s_e\/s_e.php\">proof of concept PHP web application<\/a> we&#8217;ve written for you to try today, for you to see that &#8220;shell_exec&#8221; is everything &#8220;exec&#8221; is plus returning the entire command line command&#8217;s output, as distinct from the &#8220;just last line return&#8221; of exec  &#8230;<\/p>\n<p><iframe src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/s_e\/s_e.php\" style=\"width:100%;height:600px;\"><\/iframe><\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d55220' onclick='var dv=document.getElementById(\"d55220\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/exec\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d55220' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Being suckers for &#8220;out of the box&#8221; solutions to programming issues, what comes &#8220;out of the box&#8221; with your (perhaps underlying) operating system of use is always inflicting &#8220;sucker punches&#8221; onto areas we didn&#8217;t know existed before &#8230; well, you &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/php-shell_exec-versus-exec-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,29,37],"tags":[233,234,405,714,744,885,2427,932,997,1122,3716,3942,1319,1411],"class_list":["post-55220","post","type-post","status-publish","format-standard","hentry","category-elearning","category-operating-system","category-tutorials","tag-command","tag-command-line","tag-exec","tag-local-web-server","tag-mamp","tag-operating-system-2","tag-passthru","tag-php","tag-programming","tag-server","tag-serverside","tag-shell_exec","tag-tutorial","tag-web-server"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/55220"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=55220"}],"version-history":[{"count":6,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/55220\/revisions"}],"predecessor-version":[{"id":55226,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/55220\/revisions\/55226"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=55220"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=55220"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=55220"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}