{"id":12,"date":"2016-07-15T05:23:00","date_gmt":"2016-07-15T05:23:00","guid":{"rendered":""},"modified":"2018-12-04T23:25:11","modified_gmt":"2018-12-04T23:25:11","slug":"running-php-at-a-windows-10-command-line","status":"publish","type":"post","link":"https:\/\/karwin.com\/blog\/index.php\/2016\/07\/15\/running-php-at-a-windows-10-command-line\/","title":{"rendered":"Running PHP at a Windows 10 Command Line"},"content":{"rendered":"<p>A technical writer friend of mine asked me to help her this week. She needs to run PHP scripts at the command-line on Windows 10. She installed&nbsp;<a href=\"http:\/\/www.wampserver.com\/en\/\" target=\"_blank\">WAMP Server<\/a>&nbsp;which includes PHP. I think she just needs to change the PATH so when she runs &#8220;php&#8221; in a command window, it will find the PHP interpreter.<\/p>\n<p>I hardly use Windows these days. But I do have a Windows PC around, so I tried installing WAMP, and then figuring out what it takes to change one&#8217;s PATH on Windows these days. Here are the steps, with screen shots.<\/p>\n<h4>1. Open Windows Settings and click the System icon:<\/h4>\n<p><a href=\"https:\/\/i0.wp.com\/karwin.com\/blog\/wp-content\/uploads\/2016\/07\/Step1.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" border=\"0\" height=\"320\" src=\"https:\/\/i0.wp.com\/karwin.com\/blog\/wp-content\/uploads\/2016\/07\/Step1.png?resize=263%2C320&#038;ssl=1\" width=\"263\" \/><\/a><\/p>\n<h4>2. Click the &#8220;About&#8221; link<\/h4>\n<div><a href=\"https:\/\/i0.wp.com\/karwin.com\/blog\/wp-content\/uploads\/2016\/07\/Step2.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" border=\"0\" height=\"320\" src=\"https:\/\/i0.wp.com\/karwin.com\/blog\/wp-content\/uploads\/2016\/07\/Step2.png?resize=276%2C320&#038;ssl=1\" width=\"276\" \/><\/a><\/div>\n<h4>3. Click the &#8220;System info&#8221; link<\/h4>\n<div><a href=\"https:\/\/i0.wp.com\/karwin.com\/blog\/wp-content\/uploads\/2016\/07\/Step3.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" border=\"0\" height=\"320\" src=\"https:\/\/i0.wp.com\/karwin.com\/blog\/wp-content\/uploads\/2016\/07\/Step3.png?resize=263%2C320&#038;ssl=1\" width=\"263\" \/><\/a><\/div>\n<h4>4. Click the &#8220;Advanced system settings&#8221; link<\/h4>\n<div><a href=\"https:\/\/i0.wp.com\/karwin.com\/blog\/wp-content\/uploads\/2016\/07\/Step4.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" border=\"0\" height=\"235\" src=\"https:\/\/i0.wp.com\/karwin.com\/blog\/wp-content\/uploads\/2016\/07\/Step4.png?resize=320%2C235&#038;ssl=1\" width=\"320\" \/><\/a><\/div>\n<h4>5. Click the &#8220;Environment Variables&#8230;&#8221; button<\/h4>\n<div><a href=\"https:\/\/i0.wp.com\/karwin.com\/blog\/wp-content\/uploads\/2016\/07\/Step5.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" border=\"0\" height=\"320\" src=\"https:\/\/i0.wp.com\/karwin.com\/blog\/wp-content\/uploads\/2016\/07\/Step5.png?resize=281%2C320&#038;ssl=1\" width=\"281\" \/><\/a><\/div>\n<h4>6. Select the &#8220;Path&#8221; variable and click the &#8220;Edit&#8230;&#8221; button<\/h4>\n<div><a href=\"https:\/\/i0.wp.com\/karwin.com\/blog\/wp-content\/uploads\/2016\/07\/Step6.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" border=\"0\" height=\"303\" src=\"https:\/\/i0.wp.com\/karwin.com\/blog\/wp-content\/uploads\/2016\/07\/Step6.png?resize=320%2C303&#038;ssl=1\" width=\"320\" \/><\/a><\/div>\n<h4>7. Click the &#8220;Browse&#8230;&#8221; button<\/h4>\n<div><a href=\"https:\/\/i0.wp.com\/karwin.com\/blog\/wp-content\/uploads\/2016\/07\/Step7.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" border=\"0\" height=\"304\" src=\"https:\/\/i0.wp.com\/karwin.com\/blog\/wp-content\/uploads\/2016\/07\/Step7.png?resize=320%2C304&#038;ssl=1\" width=\"320\" \/><\/a><\/div>\n<h4>8. Browse to the directory &#8220;C:wamp64binphpphp5.6.19&#8221; and click the &#8220;Ok&#8221; button<\/h4>\n<div><a href=\"https:\/\/i0.wp.com\/karwin.com\/blog\/wp-content\/uploads\/2016\/07\/Step8.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" border=\"0\" height=\"320\" src=\"https:\/\/i0.wp.com\/karwin.com\/blog\/wp-content\/uploads\/2016\/07\/Step8.png?resize=262%2C320&#038;ssl=1\" width=\"262\" \/><\/a><\/div>\n<h4>9. Continue clicking the &#8220;Ok&#8221; buttons for all the windows that you opened during this exercise<\/h4>\n<div><a href=\"https:\/\/i0.wp.com\/karwin.com\/blog\/wp-content\/uploads\/2016\/07\/Step9.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" border=\"0\" height=\"310\" src=\"https:\/\/i0.wp.com\/karwin.com\/blog\/wp-content\/uploads\/2016\/07\/Step9.png?resize=320%2C310&#038;ssl=1\" width=\"320\" \/><\/a><\/div>\n<h4>10. Open a command shell window and run &#8220;php -v&#8221; to confirm you can now use PHP via your PATH.<\/h4>\n<div><a href=\"https:\/\/i0.wp.com\/karwin.com\/blog\/wp-content\/uploads\/2016\/07\/Step10.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" border=\"0\" height=\"250\" src=\"https:\/\/i0.wp.com\/karwin.com\/blog\/wp-content\/uploads\/2016\/07\/Step10.png?resize=320%2C250&#038;ssl=1\" width=\"320\" \/><\/a><\/div>\n<div><\/div>\n<div>Now you should be able to run PHP in the command window from any directory.<\/div>\n","protected":false},"excerpt":{"rendered":"<p>A technical writer friend of mine asked me to help her this week. She needs to run PHP scripts at the command-line on Windows 10. She installed&nbsp;WAMP Server&nbsp;which includes PHP. I think she just needs to change the PATH so when she runs &#8220;php&#8221; in a command window, it will find the PHP interpreter. I [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":79,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":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":[7,6],"tags":[],"class_list":["post-12","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php","category-windows"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/karwin.com\/blog\/wp-content\/uploads\/2016\/07\/Step1.png?fit=768%2C933&ssl=1","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pawgV7-c","jetpack-related-posts":[],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/karwin.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/12","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/karwin.com\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/karwin.com\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/karwin.com\/blog\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/karwin.com\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=12"}],"version-history":[{"count":0,"href":"https:\/\/karwin.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/12\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/karwin.com\/blog\/index.php\/wp-json\/wp\/v2\/media\/79"}],"wp:attachment":[{"href":"https:\/\/karwin.com\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=12"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/karwin.com\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=12"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/karwin.com\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=12"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}