{"id":5499,"date":"2013-12-05T05:04:28","date_gmt":"2013-12-04T18:04:28","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=5499"},"modified":"2013-12-05T05:04:28","modified_gmt":"2013-12-04T18:04:28","slug":"php-show-linux-processes-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/php-show-linux-processes-primer-tutorial\/","title":{"rendered":"PHP Show Linux Processes Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/LinuxProcesses\/PHP_exec_ps-ef.jpg\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"PHP Show Linux Processes Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/LinuxProcesses\/PHP_exec_ps-ef.jpg\" title=\"PHP Show Linux Processes Primer Tutorial\"  \/><\/a><p class=\"wp-caption-text\">PHP Show Linux Processes Primer Tutorial<\/p><\/div>\n<p>The Linux (or unix) command <a target=_blank title='diff' href='http:\/\/pic.dhe.ibm.com\/infocenter\/zos\/v1r13\/index.jsp?topic=%2Fcom.ibm.zos.r13.bpxa500%2Fps.htm'><i>ps<\/i><\/a> shows process information at the command line of a Linux (or unix) operating system.   The performance of your Mac laptop or web server can be monitored, albeit in a non-GUI rather crude way using switches with the <i>ps<\/i> command..<\/p>\n<p>Some good background reading here would be:<\/p>\n<ul>\n<li><a target=_blank title='diff' href='http:\/\/pic.dhe.ibm.com\/infocenter\/zos\/v1r13\/index.jsp?topic=%2Fcom.ibm.zos.r13.bpxa500%2Fps.htm'>ps<\/a> (Linux or unix ps command)<\/li>\n<li><a target=_blank title='exec' href='http:\/\/php.net\/manual\/en\/function.exec.php'>exec<\/a> (as interface to use with PHP on the web)<\/li>\n<li><a target=_blank title='exec' href='http:\/\/www.w3schools.com\/jsref\/met_win_setinterval.asp'>setInterval<\/a> (Javascript function calls at specified interval)<\/li>\n<\/ul>\n<p>So &#8230; why does the picture for this tutorial not show a Linux command line screen?   Well, today we show you the power of the combination of Linux commands and the PHP way to access these commands (in our case processes.php). <\/p>\n<p>Here is a link to downloadable PHP programming source code which you could rename to <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/LinuxProcesses\/processes.php_GETME\" title=\"processes.php\">processes.php<\/a> as you wish.<\/p>\n<p>Specifically, in processes.php (of the picture) it has lines of code like &#8230; <\/p>\n<blockquote><p>  exec(&#8220;ps -ef | tail +2 | sed &#8216;\/^[ ]*\/s\/\/\/g&#8217; | sed &#8216;\/ [ ]*\/s\/\/ \/g&#8217; | cut -f2,8,9,10,11,12,13 -d&#8217; &#8216; > &#8221; . dirname(__FILE__) . &#8220;\/ps.ef&#8221;);<\/p><\/blockquote>\n<p>&#8230; to bring (Linux) process information results to the web for display purposes.<\/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='#d5499' onclick='var dv=document.getElementById(\"d5499\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?tag=Linux\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d5499' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>The Linux (or unix) command ps shows process information at the command line of a Linux (or unix) operating system. The performance of your Mac laptop or web server can be monitored, albeit in a non-GUI rather crude way using &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/php-show-linux-processes-primer-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":[652,707,932,992,995,1319,1339],"class_list":["post-5499","post","type-post","status-publish","format-standard","hentry","category-elearning","category-operating-system","category-tutorials","tag-javascript","tag-linux","tag-php","tag-processes","tag-proframming","tag-tutorial","tag-unix"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/5499"}],"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=5499"}],"version-history":[{"count":0,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/5499\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=5499"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=5499"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=5499"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}