{"id":23,"date":"2007-10-23T18:01:37","date_gmt":"2007-10-23T17:01:37","guid":{"rendered":"http:\/\/www.walkingrandomly.com\/?p=23"},"modified":"2012-04-11T11:04:23","modified_gmt":"2012-04-11T10:04:23","slug":"getting-php-on-the-command-line","status":"publish","type":"post","link":"https:\/\/walkingrandomly.com\/?p=23","title":{"rendered":"Getting PHP on the command line"},"content":{"rendered":"<p>I don&#8217;t know very much about PHP.  In fact it is probably more accurate to say that I don&#8217;t know <strong>anything<\/strong> about programming in PHP and yet, earlier today, I found myself in need of being able to type in simple PHP scripts and run them on the command line.  A quick google search later and I find that I need to issue the following command in Ubuntu<\/p>\n<p>apt-get install php5-cli<\/p>\n<p>Now I can write little scripts like this one (which I called md5.php) and run them on the command line<\/p>\n<pre>\r\n#!\/usr\/bin\/php -q\r\n&lt;?php\r\n$arg=$_SERVER[\"argv\"][1];\r\necho md5($arg),\"\\n\";\r\n?&gt;\r\n<\/pre>\n<p>.\/md5.php hello<br \/>\n5d41402abc4b2a76b9719d911017c592<\/p>\n<p>I mention it because I might forget about it and looking up on here is quicker for me than googling it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I don&#8217;t know very much about PHP. In fact it is probably more accurate to say that I don&#8217;t know anything about programming in PHP and yet, earlier today, I found myself in need of being able to type in simple PHP scripts and run them on the command line. A quick google search later [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[5,7],"tags":[],"class_list":["post-23","post","type-post","status-publish","format-standard","hentry","category-linux","category-programming"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p3swhs-n","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/posts\/23","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=23"}],"version-history":[{"count":1,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/posts\/23\/revisions"}],"predecessor-version":[{"id":4233,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/posts\/23\/revisions\/4233"}],"wp:attachment":[{"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=23"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=23"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=23"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}