{"id":47542,"date":"2019-09-09T08:08:47","date_gmt":"2019-09-09T13:08:47","guid":{"rendered":"https:\/\/www.inmotionhosting.com\/support\/?p=47542"},"modified":"2023-06-07T11:06:48","modified_gmt":"2023-06-07T15:06:48","slug":"how-to-use-the-php-built-in-web-server","status":"publish","type":"post","link":"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-use-the-php-built-in-web-server\/","title":{"rendered":"How To Use The PHP Built-in Web Server"},"content":{"rendered":"\n<p> Have you ever tried to open a PHP file locally? You may have noticed your web browser does not process PHP code naturally. You need a web server in order to do that. <\/p>\n\n\n\n<p class=\"alert alert-info\">If you&#8217;re unfamiliar with <a href=\"https:\/\/www.inmotionhosting.com\/php-hosting\">PHP web hosting<\/a>, you can check out a <a href=\"https:\/\/zetcode.com\/lang\/php\/\" target=\"_blank\" rel=\"noreferrer noopener\">free PHP tutorial<\/a> to brush up on your scripting skills. <\/p>\n\n\n\n<div id=\"text-table-of-contents\">\n<ul>\n<li><a href=\"#org6220015\">Why Use The PHP Built-in Server<\/a><\/li>\n<li><a href=\"#org622e137\">Using the PHP Built-in Server<\/a><\/li>\n<\/ul>\n<\/div>\n\n\n\n<div id=\"outline-container-org6220015\" class=\"outline-2\">\n<h2 id=\"org6220015\">Why Use The PHP Built-in Server<\/h2>\n<div class=\"outline-text-2\" id=\"text-org6220015\">\n<p>\nThe built-in PHP web server can be run on any computer that has PHP installed. (Apple computers already have PHP installed, but if you&#8217;re on Windows or Linux you may need to run a PHP installer.) \n<\/p>\n\n<p class=\"alert alert-danger\">The PHP built-in server is used to aid in writing PHP scripts without having to run a full stack web server. But it should <em>not<\/em> be used for local WordPress development or for a production website.<\/p>\n\n<p>\nThe built-in PHP server lets you quickly and easily test a PHP script for educational or development purposes. For something more advanced, you will want to look into installing a local development environment or purchasing <a href=\"https:\/\/www.inmotionhosting.com\/shared-hosting\">shared hosting<\/a>.\n<\/p>\n<\/div>\n<\/div>\n\n\n\n<div id=\"outline-container-org622e137\" class=\"outline-2\">\n<h2 id=\"org622e137\">Using the PHP Built-in Server<\/h2>\n<div class=\"outline-text-2\" id=\"text-org622e137\">\n<p>\nIn order to use the PHP built-in server you&#8217;ll need to open your computer&#8217;s terminal app and have a PHP file available to work with.\n<\/p>\n\n<p>\nUsing your terminal app, navigate to the folder where your PHP file resides and run this command:\n<\/p>\n\n<div class=\"org-src-container\">\n<pre class=\"src src-bash\">$ php -S localhost:8000\n<\/pre>\n<\/div>\n\n<p>\nYou&#8217;ll notice this binds a sort of pop-up web server you can access by going to the <i>localhost:8000<\/i> URL in your web browser. And your PHP scripts will execute as needed.\n<\/p>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Have you ever tried to open a PHP file locally? You may have noticed your web browser does not process PHP code naturally. You need a web server in order to do that. If you&#8217;re unfamiliar with PHP web hosting, you can check out a free PHP tutorial to brush up on your scripting skills.<a class=\"moretag\" href=\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-use-the-php-built-in-web-server\/\"> Read More ><\/a><\/p>\n","protected":false},"author":17,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4288],"tags":[],"class_list":["post-47542","post","type-post","status-publish","format-standard","hentry","category-website"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How To Use The PHP Built-in Web Server | InMotion Hosting<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-use-the-php-built-in-web-server\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How To Use The PHP Built-in Web Server | InMotion Hosting\" \/>\n<meta property=\"og:description\" content=\"Have you ever tried to open a PHP file locally? You may have noticed your web browser does not process PHP code naturally. You need a web server in order to do that. If you&#8217;re unfamiliar with PHP web hosting, you can check out a free PHP tutorial to brush up on your scripting skills. Read More &gt;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-use-the-php-built-in-web-server\/\" \/>\n<meta property=\"og:site_name\" content=\"InMotion Hosting Support Center\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/inmotionhosting\/\" \/>\n<meta property=\"article:published_time\" content=\"2019-09-09T13:08:47+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-06-07T15:06:48+00:00\" \/>\n<meta name=\"author\" content=\"Christopher Maiorana\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:site\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Christopher Maiorana\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-use-the-php-built-in-web-server\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-use-the-php-built-in-web-server\/\"},\"author\":{\"name\":\"Christopher Maiorana\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/c6922c56c84e17079fd558e07b7ef72f\"},\"headline\":\"How To Use The PHP Built-in Web Server\",\"datePublished\":\"2019-09-09T13:08:47+00:00\",\"dateModified\":\"2023-06-07T15:06:48+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-use-the-php-built-in-web-server\/\"},\"wordCount\":272,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"articleSection\":[\"Website\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-use-the-php-built-in-web-server\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-use-the-php-built-in-web-server\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-use-the-php-built-in-web-server\/\",\"name\":\"How To Use The PHP Built-in Web Server | InMotion Hosting\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\"},\"datePublished\":\"2019-09-09T13:08:47+00:00\",\"dateModified\":\"2023-06-07T15:06:48+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-use-the-php-built-in-web-server\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-use-the-php-built-in-web-server\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-use-the-php-built-in-web-server\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.inmotionhosting.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How To Use The PHP Built-in Web Server\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"name\":\"InMotion Hosting Support Center\",\"description\":\"Web Hosting Support &amp; Tutorials\",\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\",\"name\":\"InMotion Hosting\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"contentUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"width\":696,\"height\":696,\"caption\":\"InMotion Hosting\"},\"image\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/inmotionhosting\/\",\"https:\/\/x.com\/InMotionHosting\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/c6922c56c84e17079fd558e07b7ef72f\",\"name\":\"Christopher Maiorana\",\"description\":\"Christopher Maiorana joined the InMotion community team in 2015 and regularly dispenses tips and tricks in the Support Center, Community Q&A, and the InMotion Hosting Blog.\",\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/chris-m-4623144b\/\"],\"url\":\"https:\/\/www.inmotionhosting.com\/support\/author\/christopherm\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How To Use The PHP Built-in Web Server | InMotion Hosting","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-use-the-php-built-in-web-server\/","og_locale":"en_US","og_type":"article","og_title":"How To Use The PHP Built-in Web Server | InMotion Hosting","og_description":"Have you ever tried to open a PHP file locally? You may have noticed your web browser does not process PHP code naturally. You need a web server in order to do that. If you&#8217;re unfamiliar with PHP web hosting, you can check out a free PHP tutorial to brush up on your scripting skills. Read More >","og_url":"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-use-the-php-built-in-web-server\/","og_site_name":"InMotion Hosting Support Center","article_publisher":"https:\/\/www.facebook.com\/inmotionhosting\/","article_published_time":"2019-09-09T13:08:47+00:00","article_modified_time":"2023-06-07T15:06:48+00:00","author":"Christopher Maiorana","twitter_card":"summary_large_image","twitter_creator":"@InMotionHosting","twitter_site":"@InMotionHosting","twitter_misc":{"Written by":"Christopher Maiorana","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-use-the-php-built-in-web-server\/#article","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-use-the-php-built-in-web-server\/"},"author":{"name":"Christopher Maiorana","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/c6922c56c84e17079fd558e07b7ef72f"},"headline":"How To Use The PHP Built-in Web Server","datePublished":"2019-09-09T13:08:47+00:00","dateModified":"2023-06-07T15:06:48+00:00","mainEntityOfPage":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-use-the-php-built-in-web-server\/"},"wordCount":272,"commentCount":0,"publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"articleSection":["Website"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.inmotionhosting.com\/support\/website\/how-to-use-the-php-built-in-web-server\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-use-the-php-built-in-web-server\/","url":"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-use-the-php-built-in-web-server\/","name":"How To Use The PHP Built-in Web Server | InMotion Hosting","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#website"},"datePublished":"2019-09-09T13:08:47+00:00","dateModified":"2023-06-07T15:06:48+00:00","breadcrumb":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-use-the-php-built-in-web-server\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.inmotionhosting.com\/support\/website\/how-to-use-the-php-built-in-web-server\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.inmotionhosting.com\/support\/website\/how-to-use-the-php-built-in-web-server\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.inmotionhosting.com\/support\/"},{"@type":"ListItem","position":2,"name":"How To Use The PHP Built-in Web Server"}]},{"@type":"WebSite","@id":"https:\/\/www.inmotionhosting.com\/support\/#website","url":"https:\/\/www.inmotionhosting.com\/support\/","name":"InMotion Hosting Support Center","description":"Web Hosting Support &amp; Tutorials","publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.inmotionhosting.com\/support\/#organization","name":"InMotion Hosting","url":"https:\/\/www.inmotionhosting.com\/support\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/","url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","contentUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","width":696,"height":696,"caption":"InMotion Hosting"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/inmotionhosting\/","https:\/\/x.com\/InMotionHosting"]},{"@type":"Person","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/c6922c56c84e17079fd558e07b7ef72f","name":"Christopher Maiorana","description":"Christopher Maiorana joined the InMotion community team in 2015 and regularly dispenses tips and tricks in the Support Center, Community Q&A, and the InMotion Hosting Blog.","sameAs":["https:\/\/www.linkedin.com\/in\/chris-m-4623144b\/"],"url":"https:\/\/www.inmotionhosting.com\/support\/author\/christopherm\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"primary_category":null,"_links":{"self":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/47542","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/users\/17"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/comments?post=47542"}],"version-history":[{"count":7,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/47542\/revisions"}],"predecessor-version":[{"id":104797,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/47542\/revisions\/104797"}],"wp:attachment":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/media?parent=47542"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/categories?post=47542"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/tags?post=47542"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}