{"id":24219,"date":"2016-12-22T11:39:56","date_gmt":"2016-12-22T11:39:56","guid":{"rendered":"http:\/\/www.webdevelopersnotes.com\/?p=24219"},"modified":"2017-09-26T13:26:59","modified_gmt":"2017-09-26T13:26:59","slug":"install-php-on-windows-10","status":"publish","type":"post","link":"https:\/\/www.webdevelopersnotes.com\/install-php-on-windows-10","title":{"rendered":"Install PHP on Windows 10"},"content":{"rendered":"<p>PHP is a server-side scripting language and, at the time of writing, the world&#8217;s most used web computer language. Additionally, some of the most popular web-suites like the WordPress and Joomla content management software, have been written in PHP.<\/p>\n<p>The language was created by Rasmus Lerdorf in 1995 for his personal web site and, probably for this reason, was called originally <strong>Personal Home Page<\/strong>. PHP soon became popular and other developers started chipping in. Its name was later changed to a recursive acronym, <em>PHP: HyperText Preprocessor<\/em>.<\/p>\n<div class=\"clr\"><\/div>\n<div class=\"bottom-ads\">\n<h4>Sponsored Links<\/h4>\n<script async src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script>\n<!-- Inner Page Top - Non Responsive -->\n<ins class=\"adsbygoogle\"\n     style=\"display:inline-block;width:336px;height:280px\"\n     data-ad-client=\"ca-pub-1043128618639037\"\n     data-ad-slot=\"5670477364\"><\/ins>\n<script>\n(adsbygoogle = window.adsbygoogle || []).push({});\n<\/script>\n<\/div>\n<div class=\"clr\"><\/div>\n<p>We believe PHP is a simple language to learn. A few months of dedicated practice and you would be able to create fairly decent applications for web sites. The strong point of PHP is that it can easily connect to databases such as MySQL that help you to develop dynamic pages.<\/p>\n<p>In this article, we would be providing detailed instructions on how to install PHP on a Windows 10 computer. This way you can set up a local <a href=\"\/\/www.webdevelopersnotes.com\/web-development-on-windows-10\" title=\"Web development on a Windows 10 computer\">web development environment<\/a> and avoid the expenses of an actual web host.<\/p>\n<p>But PHP doesn&#8217;t run on its own. It needs a web server such as Apache. So before you start on this guide, make sure you have <a href=\"\/\/www.webdevelopersnotes.com\/how-to-install-apache-on-windows-10\" title=\"Instructions on how installed Apache on your Windows 10 computer\">installed Apache on your Windows 10 computer<\/a> &#8211; click on that link to check out that guide.<\/p>\n<p>Once the <a href=\"\/\/www.webdevelopersnotes.com\/set-up-and-configure-apache-on-windows-10\" title=\"Set up and configure Apache on Windows 10\">Apache web server is set up and configured on Windows 10<\/a>, come back to this page and set up PHP. The process is quite easy!<\/p>\n<p>If you have Apache running, dig right in.<\/p>\n<div class=\"swiper-container\">\n<ul class=\"swiper-wrapper\">\n<li class=\"swiper-slide\"><img decoding=\"async\" src=\"\/\/www.webdevelopersnotes.com\/slideshow\/install-php-windows-10\/php-net-web-site.png\" alt=\"PHP.net web site\"\/><\/li>\n<li class=\"swiper-slide\"><img decoding=\"async\" src=\"\/\/www.webdevelopersnotes.com\/slideshow\/install-php-windows-10\/current-stable-release-php-7-1-0.png\" alt=\"Current stable release PHP 7.1.0\"\/><\/li>\n<li class=\"swiper-slide\"><img decoding=\"async\" src=\"\/\/www.webdevelopersnotes.com\/slideshow\/install-php-windows-10\/choose-vc14-x64-thread-safe-zip-file.png\" alt=\"Choose VC14 x64 Thread Safe zip file\"\/><\/li>\n<li class=\"swiper-slide\"><img decoding=\"async\" src=\"\/\/www.webdevelopersnotes.com\/slideshow\/install-php-windows-10\/select-extract-all-option-after-right-clicking-zip-archive.png\" alt=\"Select Extract all option after right-clicking zip archive\"\/><\/li>\n<li class=\"swiper-slide\"><img decoding=\"async\" src=\"\/\/www.webdevelopersnotes.com\/slideshow\/install-php-windows-10\/specify-extraction-folder-c-php.png\" alt=\"Specify extraction folder C:\/PHP\"\/><\/li>\n<li class=\"swiper-slide\"><img decoding=\"async\" src=\"\/\/www.webdevelopersnotes.com\/slideshow\/install-php-windows-10\/files-being-extracted-to-php-install-folder.png\" alt=\"Files being extracted to PHP install folder\"\/><\/li>\n<li class=\"swiper-slide\"><img decoding=\"async\" src=\"\/\/www.webdevelopersnotes.com\/slideshow\/install-php-windows-10\/two-php-ini-files.png\" alt=\"Two PHP.ini files\"\/><\/li>\n<li class=\"swiper-slide\"><img decoding=\"async\" src=\"\/\/www.webdevelopersnotes.com\/slideshow\/install-php-windows-10\/copy-php-ini-development-file.png\" alt=\"Copy php.ini-development file\"\/><\/li>\n<li class=\"swiper-slide\"><img decoding=\"async\" src=\"\/\/www.webdevelopersnotes.com\/slideshow\/install-php-windows-10\/copy-of-the-php-ini-development-file-created.png\" alt=\"Copy of the php.ini-development file created\"\/><\/li>\n<li class=\"swiper-slide\"><img decoding=\"async\" src=\"\/\/www.webdevelopersnotes.com\/slideshow\/install-php-windows-10\/system-warns-about-file-name-extension-change-click-yes.png\" alt=\"System warns about file name extension change - Click Yes\"\/><\/li>\n<li class=\"swiper-slide\"><img decoding=\"async\" src=\"\/\/www.webdevelopersnotes.com\/slideshow\/install-php-windows-10\/open-php-ini-with-notepad.png\" alt=\"Open php.ini with Notepad\"\/><\/li>\n<li class=\"swiper-slide\"><img decoding=\"async\" src=\"\/\/www.webdevelopersnotes.com\/slideshow\/install-php-windows-10\/php-ini-file-displayed-in-notepad.png\" alt=\"php.ini file displayed in Notepad\"\/><\/li>\n<li class=\"swiper-slide\"><img decoding=\"async\" src=\"\/\/www.webdevelopersnotes.com\/slideshow\/install-php-windows-10\/locate-extension-dir-in-php-ini.png\" alt=\"Locate extension_dir in php.ini\"\/><\/li>\n<li class=\"swiper-slide\"><img decoding=\"async\" src=\"\/\/www.webdevelopersnotes.com\/slideshow\/install-php-windows-10\/change-the-extension-directory.png\" alt=\"Change the extension directory\"\/><\/li>\n<li class=\"swiper-slide\"><img decoding=\"async\" src=\"\/\/www.webdevelopersnotes.com\/slideshow\/install-php-windows-10\/list-of-php-extensions-on-windows.png\" alt=\"List of PHP extensions on Windows\"\/><\/li>\n<li class=\"swiper-slide\"><img decoding=\"async\" src=\"\/\/www.webdevelopersnotes.com\/slideshow\/install-php-windows-10\/save-php-ini-file.png\" alt=\"Save php.ini file\"\/><\/li>\n<li class=\"swiper-slide\"><img decoding=\"async\" src=\"\/\/www.webdevelopersnotes.com\/slideshow\/install-php-windows-10\/control-panel-system-and-security.png\" alt=\"Control Panel - System and Security\"\/><\/li>\n<li class=\"swiper-slide\"><img decoding=\"async\" src=\"\/\/www.webdevelopersnotes.com\/slideshow\/install-php-windows-10\/control-panel-system.png\" alt=\"Control Panel - System\"\/><\/li>\n<li class=\"swiper-slide\"><img decoding=\"async\" src=\"\/\/www.webdevelopersnotes.com\/slideshow\/install-php-windows-10\/advanced-system-settings-in-the-control-panel.png\" alt=\"Advanced system settings in the Control Panel\"\/><\/li>\n<li class=\"swiper-slide\"><img decoding=\"async\" src=\"\/\/www.webdevelopersnotes.com\/slideshow\/install-php-windows-10\/click-environment-variables-button.png\" alt=\"Click Environment Variables button\"\/><\/li>\n<li class=\"swiper-slide\"><img decoding=\"async\" src=\"\/\/www.webdevelopersnotes.com\/slideshow\/install-php-windows-10\/edit-the-system-path.png\" alt=\"Edit the system PATH\"\/><\/li>\n<li class=\"swiper-slide\"><img decoding=\"async\" src=\"\/\/www.webdevelopersnotes.com\/slideshow\/install-php-windows-10\/path-variable-values.png\" alt=\"PATH variable values\"\/><\/li>\n<li class=\"swiper-slide\"><img decoding=\"async\" src=\"\/\/www.webdevelopersnotes.com\/slideshow\/install-php-windows-10\/add-new-to-path.png\" alt=\"Add new to PATH\"\/><\/li>\n<li class=\"swiper-slide\"><img decoding=\"async\" src=\"\/\/www.webdevelopersnotes.com\/slideshow\/install-php-windows-10\/click-ok-button.png\" alt=\"Click OK button\"\/><\/li>\n<li class=\"swiper-slide\"><img decoding=\"async\" src=\"\/\/www.webdevelopersnotes.com\/slideshow\/install-php-windows-10\/change-directoryindex-in-httpd-conf.png\" alt=\"Change DirectoryIndex in httpd.conf\"\/><\/li>\n<li class=\"swiper-slide\"><img decoding=\"async\" src=\"\/\/www.webdevelopersnotes.com\/slideshow\/install-php-windows-10\/add-a-few-lines-to-httpd-conf.png\" alt=\"Add a few lines to httpd.conf\"\/><\/li>\n<li class=\"swiper-slide\"><img decoding=\"async\" src=\"\/\/www.webdevelopersnotes.com\/slideshow\/install-php-windows-10\/the-phpinfo-page.png\" alt=\"The phpinfo page\"\/><\/li>\n<\/ul>\n<div class=\"swiper-pagination\"><\/div>\n<div class=\"swiper-button-next\"><\/div>\n<div class=\"swiper-button-prev\"><\/div>\n<\/div>\n<ol class=\"slide-steps\">\n<li>Launch a web browser and go to <a href=\"\/\/www.php.net\" title=\"PHP web site\" target=\"_blank\">PHP.net<\/a>. Click the &#8220;Downloads&#8221; tab on the page &#8211; its at the top [Slide 1].<\/li>\n<li>The current stable release is PHP 7.1.0 and this is what we would be installing on the Windows 10 computer. Click the &#8220;Windows downloads&#8221; link [Slide 2].<\/li>\n<li>Choose the VC14 x64 Thread Safe zip file on the next page [Slide 3].<\/li>\n<li>The file will be downloaded to the default downloads folder. Move to the folder when the download completes, right-click on the file and select the &#8220;Extract All&#8230;&#8221; option [Slide 4].<\/li>\n<li>This opens a pop-up with the default directory to which the archive would be unzipped to. We like to keep things simple on our computer and would recommend you do the same. Thus, we recommend installing PHP in its own directory on the C: drive.<br \/>\nReplace the default directory to <span class=\"codeword-light\">C:\\PHP<\/span> and hit the <span class=\"button-eff\">Extract<\/span> button [Slide 5].<br \/>\nFiles from the PHP zip archive would begin to get extracted to the specified folder [Slide 6].<\/li>\n<li>The next step is to configure PHP on the Windows 10 computer.<br \/>\nMove to the folder to which the PHP files were extracted and locate the <span class=\"codeword-light\">ini<\/span> files; there would be two of them &#8211; <span class=\"codeword-light\">php.ini-development<\/span> and <span class=\"codeword-light\">php.ini-production<\/span> [Slide 7].<\/li>\n<li>Right-click on <span class=\"codeword-light\">php.ini-development<\/span>, select &#8220;Copy&#8221; option from the menu to create a duplicate of the file [Slide 8]. This way, if we mess up, we&#8217;ve at least preserved a copy of the original. Right-click on a black area and select the &#8220;Paste&#8221; option to get a copy of the file [Slide 9].<\/li>\n<li>Rename this copy to simply <span class=\"codeword-light\">php.ini<\/span>. Since we are changing the file extension, the system would throw up a warning asking for a confirmation [Slide 10]. Click the <span class=\"button-eff\">Yes<\/span> button. FYI, once the file name is modified, the file icon would also change.<\/li>\n<li>Right-click on the <span class=\"codeword-light\">php.ini<\/span> file and select &#8220;Open with&#8221; -&gt; &#8220;Notepad&#8221; option [Slide 11].<\/li>\n<li>We now get to see what the <span class=\"codeword-light\">php.ini<\/span> file looks like &#8211; it&#8217;s essentially plain text. For PHP to run on our Windows 10 computer without any issues, we need to make a few modifications.<\/li>\n<li>Using the &#8220;Find&#8221; feature (keyboard shortcut <span class=\"button-eff\">Ctrl<\/span> + <span class=\"button-eff\">F<\/span>) hunt for <span class=\"codeword-light\">extension_dir = <\/span>. You should come to a line similar to what is shown in Slide 13.<br \/>\nWe need to change this to:<\/p>\n<pre>\r\nextension_dir = \"c:\\PHP\\ext\"\r\n<\/pre>\n<p>Thus, remove the prefix semicolon and set the directory path to <span class=\"codeword-light\">c:\\PHP\\ext<\/span>. FYI, this points to the <span class=\"codeword-light\">ext<\/span> folder inside the directory in which we installed PHP &#8211; <span class=\"codeword-light\">c:\\PHP<\/span>.<br \/>Refer Slide 14 in case of any doubt.<\/li>\n<li>Employ the &#8220;Find&#8221; feature once again to locate the &#8220;Windows Extensions&#8221; section in the <span class=\"codeword-light\">php.ini<\/span> file. You&#8217;ll find a list of extensions that should be loaded by PHP for it to work with other applications such as MySQL database [Slide 15].<\/li>\n<li>Remove the semicolon before the GD library and MySQL extensions. The two lines should look like ones below (refer Slide 15 again):\n<pre>\r\nextension=php_gd2.dll\r\n...\r\nextension=php_mysqli.dll\r\n<\/pre>\n<p>You can remove the semicolon (or <em>uncomment<\/em>) other lines to enable those extensions to load.<\/li>\n<li>FYI, the default upload file size of this PHP installation is 2MB. If you feel that you may need to increase this value, hunt for &#8220;upload_max_filesize = &#8221; line and change it as per requirements.<\/li>\n<li>Save the <span class=\"codeword-light\">php.ini<\/span> file [Slide 16] and close the Notepad app.<\/li>\n<li>We now need to set the environment variable for PHP. Open the <strong>Control Panel<\/strong>. Go to <em>System and Security<\/em> [Slide 17] -&gt; <em>System<\/em> [Slide 18] -&gt; <em>Advanced system settings<\/em> [Slide 19].<\/li>\n<li>Click the <span class=\"button-eff\">Environment Variables<\/span> button [Slide 20].<\/li>\n<li>Select &#8220;Path&#8221; from the &#8220;System variables&#8221; section and click the <span class=\"button-eff\">Edit<\/span> button [Slide 21].<\/li>\n<li>A pop-up window will appear [Slide 22]. Click the <span class=\"button-eff\">New<\/span> button and add <span class=\"codeword-light\">c:\\PHP<\/span> as the new variable as shown in Slide 23.<\/li>\n<li>Click <span class=\"codeword-light\">OK<\/span> button [Slide 24] on this pop-up and all the others to close everything.<\/li>\n<li>As mentioned before, for PHP to work we need a web server like Apache. Assuming you had set up and configured Apache on your Windows 10 computer, open the server&#8217;s configuration file <span class=\"codeword-light\">httpd.conf<\/span> in Notepad. It should be residing in <span class=\"codeword-light\">c:\/Apache24\/conf<\/span> folder if you&#8217;ve used our instructions.<\/li>\n<li>Move to the <span class=\"codeword-light\">DirectoryIndex<\/span> line and add <span class=\"codeword-light\">index.php<\/span> with a preceding space character. The lines should look like:\n<pre>\r\n&lt;IfModule dir_module&gt;\r\n\tDirectoryIndex index.html index.php\r\n&lt;\/IfModule&gt;\r\n<\/pre>\n<p>Refer Slide 25 in case of doubt.<\/li>\n<li>Move to the very end of the <span class=\"codeword-light\">httpd.conf<\/span> file and add the following three lines:\n<pre>\r\nLoadModule php7_module \"c:\/PHP\/php7apache2_4.dll\"\r\nAddHandler application\/x-httpd-php .php\r\nPHPIniDir \"c:\/PHP\"\r\n<\/pre>\n<p>I&#8217;ve marked these lines in blue in Slide 26.<\/li>\n<li>Save the file.<\/li>\n<li>Since we have changed the PATH variable a restart of the computer is typically required.<\/li>\n<\/ol>\n<h2>Testing the PHP installation on your Windows 10 computer<\/h2>\n<p>Go to the document root folder. It should be <span class=\"codeword-light\">c:\/websites<\/span> if you&#8217;ve followed our guide on installing Apache on Windows 10.<\/p>\n<p>Launch the Notepad application and put in the following three lines:<\/p>\n<pre>\r\n&lt;?php\r\nphpinfo();\r\n?&gt;\r\n<\/pre>\n<p>Save this file as <span class=\"codeword-light\">phpinfo.php<\/span>.<br \/>Make sure the extension is <span class=\"codeword-light\">.php<\/span> and not <span class=\"codeword-light\">.txt<\/span> or <span class=\"codeword-light\">.html<\/span>.<\/p>\n<p>Launch your chosen web browser and type in <span class=\"codeword-light\">localhost\/phpinfo.php<\/span> in the address bar.<\/p>\n<p>You should get a page similar to Slide 27.<br \/>\nHurray! Your PHP installation was successful.<\/p>\n<p>Here is a &#8220;Hackerman meme&#8221; for you!<br \/>\n<img decoding=\"async\" src=\"\/\/www.webdevelopersnotes.com\/wp-content\/uploads\/hackerman-php-installation-on-windows-10.jpg\" alt=\"Hackerman Meme - Installed PHP\" class=\"full-width\"\/><\/p>\n<p>We&#8217;re sure you&#8217;ll be pleased and pumped up after installing PHP. Why don&#8217;t you start on our guide on how to install MySQL which will complete the <a href=\"\/\/www.webdevelopersnotes.com\/web-development-on-windows-10\" title=\"Set up a local web development environment on Windows 10\">local web development environment on your Windows 10<\/a> computer.<\/p>\n","protected":false},"excerpt":{"rendered":"PHP is a server-side scripting language and, at the time of writing, the world&#8217;s most used web computer language. Additionally, some of the most popular web-suites like the WordPress and Joomla content management software, have been written in PHP. The language was created by Rasmus Lerdorf in 1995 for his personal web site and, probably [&hellip;]","protected":false},"author":2,"featured_media":24227,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[51,49,27],"tags":[],"class_list":["post-24219","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-apache","category-php","category-web-development"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.webdevelopersnotes.com\/wp-json\/wp\/v2\/posts\/24219","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webdevelopersnotes.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webdevelopersnotes.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webdevelopersnotes.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webdevelopersnotes.com\/wp-json\/wp\/v2\/comments?post=24219"}],"version-history":[{"count":0,"href":"https:\/\/www.webdevelopersnotes.com\/wp-json\/wp\/v2\/posts\/24219\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webdevelopersnotes.com\/wp-json\/wp\/v2\/media\/24227"}],"wp:attachment":[{"href":"https:\/\/www.webdevelopersnotes.com\/wp-json\/wp\/v2\/media?parent=24219"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webdevelopersnotes.com\/wp-json\/wp\/v2\/categories?post=24219"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webdevelopersnotes.com\/wp-json\/wp\/v2\/tags?post=24219"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}