{"id":303,"date":"2021-03-14T05:28:05","date_gmt":"2021-03-14T05:28:05","guid":{"rendered":"https:\/\/phptutorial.net\/?page_id=303"},"modified":"2025-04-05T13:53:45","modified_gmt":"2025-04-05T13:53:45","slug":"install-php","status":"publish","type":"page","link":"https:\/\/www.phptutorial.net\/php-tutorial\/install-php\/","title":{"rendered":"Install PHP"},"content":{"rendered":"\r\n<p><strong>Summary<\/strong>: in this tutorial, you&#8217;ll learn how to install PHP on your computer locally to start learning PHP.<\/p>\r\n\r\n\r\n\r\n<p>Installing PHP on your computer allows you to safely develop and test a web application without affecting the live system.<\/p>\r\n\r\n\r\n\r\n<p>To work with PHP locally, you need to have the following software:<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li>PHP<\/li>\r\n<li>A web server that supports PHP. We&#8217;ll use the <a href=\"https:\/\/httpd.apache.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">Apache webserver<\/a>.<\/li>\r\n<li>A database server. We&#8217;ll use the <a href=\"https:\/\/www.mysql.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">MySQL database server<\/a>.<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<p>Typically, you won&#8217;t install all this software separately because connecting them is tricky and not intended for beginners.<\/p>\r\n\r\n\r\n\r\n<p>Therefore, it is easier to find an all-in-one software package that includes PHP, a web server, and a database server. One of the most popular PHP development environments is <a href=\"https:\/\/www.apachefriends.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">XAMPP<\/a>.<\/p>\r\n\r\n\r\n\r\n<p>XAMPP is an easy-to-install Apache distribution that contains PHP, MariaDB, and an Apache webserver. It supports Windows, Linux, and MacOS.<\/p>\r\n\r\n\r\n\r\n<p class=\"note\">Note that <a href=\"https:\/\/mariadb.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">MariaDB<\/a> is a fork of the most popular relational database management system, MySQL.<\/p>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\" id='download-xampp'>Download XAMPP <a href=\"#download-xampp\" class=\"anchor\" id=\"download-xampp\" title=\"Anchor for Download XAMPP\">#<\/a><\/h2>\r\n\r\n\r\n\r\n<p>To install XAMPP on\u00a0<span style=\"box-sizing: border-box; margin: 0px; padding: 0px;\">Windows, go to the\u00a0<a href=\"https:\/\/www.apachefriends.org\/index.html\" target=\"_blank\" rel=\"noopener\">XAMPP official website<\/a> and download the appropriate<\/span>\u00a0version for your platform.<\/p>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\" id='install-xampp-on-windows'>Install XAMPP on Windows <a href=\"#install-xampp-on-windows\" class=\"anchor\" id=\"install-xampp-on-windows\" title=\"Anchor for Install XAMPP on Windows\">#<\/a><\/h2>\r\n\r\n\r\n\r\n<p>To install XAMPP on Windows, you can follow these steps:<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\" id='step-1-start-the-installation'>Step 1. Start the installation <a href=\"#step-1-start-the-installation\" class=\"anchor\" id=\"step-1-start-the-installation\" title=\"Anchor for Step 1. Start the installation\">#<\/a><\/h3>\r\n\r\n\r\n\r\n<p>Double-click the downloaded file to start setting up XAMPP:<\/p>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-305\" src=\"https:\/\/phptutorial.net\/wp-content\/uploads\/2021\/03\/install-php-step-1.png\" alt=\"\" width=\"502\" height=\"425\" srcset=\"https:\/\/www.phptutorial.net\/wp-content\/uploads\/2021\/03\/install-php-step-1.png 502w, https:\/\/www.phptutorial.net\/wp-content\/uploads\/2021\/03\/install-php-step-1-300x254.png 300w\" sizes=\"auto, (max-width: 502px) 100vw, 502px\" \/><\/figure>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\" id='step-2-select-components-to-install'>Step 2. Select components to install <a href=\"#step-2-select-components-to-install\" class=\"anchor\" id=\"step-2-select-components-to-install\" title=\"Anchor for Step 2. Select components to install\">#<\/a><\/h3>\r\n\r\n\r\n\r\n<p>Select the components that you want to install. In this step, you can select Apache, MySQL, PHP, and phpMyAdmin, deselect other components like the following, and click the Next button to go to the next step.<\/p>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"502\" height=\"425\" class=\"wp-image-306\" src=\"https:\/\/phptutorial.net\/wp-content\/uploads\/2021\/03\/install-php-step-2.png\" alt=\"\" srcset=\"https:\/\/www.phptutorial.net\/wp-content\/uploads\/2021\/03\/install-php-step-2.png 502w, https:\/\/www.phptutorial.net\/wp-content\/uploads\/2021\/03\/install-php-step-2-300x254.png 300w\" sizes=\"auto, (max-width: 502px) 100vw, 502px\" \/><\/figure>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\" id='step-3-specifying-the-installation-folder'>Step 3. Specifying the installation folder <a href=\"#step-3-specifying-the-installation-folder\" class=\"anchor\" id=\"step-3-specifying-the-installation-folder\" title=\"Anchor for Step 3. Specifying the installation folder\">#<\/a><\/h3>\r\n\r\n\r\n\r\n<p>Select a folder to install XAMPP. It&#8217;s recommended to install XAMPP in the c:\\xampp folder. Click the Next button to go to the next step.<\/p>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"502\" height=\"425\" class=\"wp-image-307\" src=\"https:\/\/phptutorial.net\/wp-content\/uploads\/2021\/03\/install-php-step-3.png\" alt=\"\" srcset=\"https:\/\/www.phptutorial.net\/wp-content\/uploads\/2021\/03\/install-php-step-3.png 502w, https:\/\/www.phptutorial.net\/wp-content\/uploads\/2021\/03\/install-php-step-3-300x254.png 300w\" sizes=\"auto, (max-width: 502px) 100vw, 502px\" \/><\/figure>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\" id='step-4-selecting-a-language'>Step 4. Selecting a language <a href=\"#step-4-selecting-a-language\" class=\"anchor\" id=\"step-4-selecting-a-language\" title=\"Anchor for Step 4. Selecting a language\">#<\/a><\/h2>\r\n\r\n\r\n\r\n<p>Select a language for the XAMPP Control Panel. By default, it&#8217;s English. You can select your preferred language and click the Next button to proceed to the next step.<\/p>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"502\" height=\"425\" class=\"wp-image-308\" src=\"https:\/\/phptutorial.net\/wp-content\/uploads\/2021\/03\/install-php-step-4.png\" alt=\"\" srcset=\"https:\/\/www.phptutorial.net\/wp-content\/uploads\/2021\/03\/install-php-step-4.png 502w, https:\/\/www.phptutorial.net\/wp-content\/uploads\/2021\/03\/install-php-step-4-300x254.png 300w\" sizes=\"auto, (max-width: 502px) 100vw, 502px\" \/><\/figure>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\" id='step-5-bitnami-for-xampp'>Step 5. Bitnami for XAMPP <a href=\"#step-5-bitnami-for-xampp\" class=\"anchor\" id=\"step-5-bitnami-for-xampp\" title=\"Anchor for Step 5. Bitnami for XAMPP\">#<\/a><\/h3>\r\n\r\n\r\n\r\n<p>Feel free to skip this step because you don&#8217;t need Bitnami to learn PHP. Just click the Next button to proceed to the next step.<\/p>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"502\" height=\"425\" class=\"wp-image-309\" src=\"https:\/\/phptutorial.net\/wp-content\/uploads\/2021\/03\/install-php-step-5.png\" alt=\"\" srcset=\"https:\/\/www.phptutorial.net\/wp-content\/uploads\/2021\/03\/install-php-step-5.png 502w, https:\/\/www.phptutorial.net\/wp-content\/uploads\/2021\/03\/install-php-step-5-300x254.png 300w\" sizes=\"auto, (max-width: 502px) 100vw, 502px\" \/><\/figure>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\" id='step-6-begin-installing-xampp'>Step 6. Begin installing XAMPP <a href=\"#step-6-begin-installing-xampp\" class=\"anchor\" id=\"step-6-begin-installing-xampp\" title=\"Anchor for Step 6. Begin installing XAMPP\">#<\/a><\/h3>\r\n\r\n\r\n\r\n<p>You&#8217;re now ready to install XAMPP. Click the Next button to start the installation, which will take a few minutes to complete.<\/p>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"502\" height=\"425\" class=\"wp-image-310\" src=\"https:\/\/phptutorial.net\/wp-content\/uploads\/2021\/03\/install-php-step-6.png\" alt=\"\" srcset=\"https:\/\/www.phptutorial.net\/wp-content\/uploads\/2021\/03\/install-php-step-6.png 502w, https:\/\/www.phptutorial.net\/wp-content\/uploads\/2021\/03\/install-php-step-6-300x254.png 300w\" sizes=\"auto, (max-width: 502px) 100vw, 502px\" \/><\/figure>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\" id='step-7-completing-the-xampp-setup'>Step 7. Completing the XAMPP setup <a href=\"#step-7-completing-the-xampp-setup\" class=\"anchor\" id=\"step-7-completing-the-xampp-setup\" title=\"Anchor for Step 7. Completing the XAMPP setup\">#<\/a><\/h3>\r\n\r\n\r\n\r\n<p>Once completed, the XAMPP setup wizard shows the following screen. You can click the Finish button to launch the XAMPP Control Panel:<\/p>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"502\" height=\"425\" class=\"wp-image-312\" src=\"https:\/\/phptutorial.net\/wp-content\/uploads\/2021\/03\/install-php-step-7.png\" alt=\"\" srcset=\"https:\/\/www.phptutorial.net\/wp-content\/uploads\/2021\/03\/install-php-step-7.png 502w, https:\/\/www.phptutorial.net\/wp-content\/uploads\/2021\/03\/install-php-step-7-300x254.png 300w\" sizes=\"auto, (max-width: 502px) 100vw, 502px\" \/><\/figure>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\" id='step-8-completing-the-xampp-setup'>Step 8. Completing the XAMPP setup <a href=\"#step-8-completing-the-xampp-setup\" class=\"anchor\" id=\"step-8-completing-the-xampp-setup\" title=\"Anchor for Step 8. Completing the XAMPP setup\">#<\/a><\/h3>\r\n\r\n\r\n\r\n<p>The XAMPP Control Panel lists installed services. To start a service, you click the corresponding Start button:<\/p>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"668\" height=\"434\" class=\"wp-image-313\" src=\"https:\/\/phptutorial.net\/wp-content\/uploads\/2021\/03\/install-php-step-8.png\" alt=\"\" srcset=\"https:\/\/www.phptutorial.net\/wp-content\/uploads\/2021\/03\/install-php-step-8.png 668w, https:\/\/www.phptutorial.net\/wp-content\/uploads\/2021\/03\/install-php-step-8-300x195.png 300w\" sizes=\"auto, (max-width: 668px) 100vw, 668px\" \/><\/figure>\r\n\r\n\r\n\r\n<p>The following shows the Apache web server and MySQL are up and running. The Apache web server listens on ports 80 and 443 while the MySQL listens on port 3306:<\/p>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"668\" height=\"434\" class=\"wp-image-314\" src=\"https:\/\/phptutorial.net\/wp-content\/uploads\/2021\/03\/install-php-step-9.png\" alt=\"\" srcset=\"https:\/\/www.phptutorial.net\/wp-content\/uploads\/2021\/03\/install-php-step-9.png 668w, https:\/\/www.phptutorial.net\/wp-content\/uploads\/2021\/03\/install-php-step-9-300x195.png 300w\" sizes=\"auto, (max-width: 668px) 100vw, 668px\" \/><\/figure>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\" id='step-9-launch-the-xampp'>Step 9. Launch the XAMPP <a href=\"#step-9-launch-the-xampp\" class=\"anchor\" id=\"step-9-launch-the-xampp\" title=\"Anchor for Step 9. Launch the XAMPP\">#<\/a><\/h3>\r\n\r\n\r\n\r\n<p>Open the web browser and navigate to the following URL: http:\/\/localhost\/. If the installation is completed successfully, you&#8217;ll see the XAMPP welcome screen.<\/p>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\" id='troubleshooting'>Troubleshooting <a href=\"#troubleshooting\" class=\"anchor\" id=\"troubleshooting\" title=\"Anchor for Troubleshooting\">#<\/a><\/h2>\r\n\r\n\r\n\r\n<p>By default, Apache uses port 80. However, if port 80 is used by another service, you&#8217;ll get an error like this:<\/p>\r\n\r\n\r\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"plaintext\" data-shcb-language-slug=\"plaintext\"><span><code class=\"hljs language-plaintext\">Problem detected!\r\nPort 80 in use by \"Unable to open process\" with PID 4!\r\nApache WILL NOT start without the configured ports free!\r\nYou need to uninstall\/disable\/reconfigure the blocking application\r\nor reconfigure Apache and the Control Panel to listen on a different port<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">plaintext<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">plaintext<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\r\n\r\n\r\n<p>In this case, you must change the port from 80 to a free one, e.g., 8080. To do that, you follow these steps:<\/p>\r\n\r\n\r\n\r\n<p>First, click the Config button that aligns with the Apache module:<\/p>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"756\" height=\"357\" class=\"wp-image-322\" src=\"https:\/\/phptutorial.net\/wp-content\/uploads\/2021\/03\/Configure-Apache-Step-1.png\" alt=\"\" srcset=\"https:\/\/www.phptutorial.net\/wp-content\/uploads\/2021\/03\/Configure-Apache-Step-1.png 756w, https:\/\/www.phptutorial.net\/wp-content\/uploads\/2021\/03\/Configure-Apache-Step-1-300x142.png 300w\" sizes=\"auto, (max-width: 756px) 100vw, 756px\" \/><\/figure>\r\n\r\n\r\n\r\n<p>Second, find the line that has the text <code>Listen 80<\/code> and change the port from <code>80<\/code> to <code>8080<\/code> like this:<\/p>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"627\" height=\"326\" class=\"wp-image-321\" src=\"https:\/\/phptutorial.net\/wp-content\/uploads\/2021\/03\/Configure-Apache-Step-2.png\" alt=\"\" srcset=\"https:\/\/www.phptutorial.net\/wp-content\/uploads\/2021\/03\/Configure-Apache-Step-2.png 627w, https:\/\/www.phptutorial.net\/wp-content\/uploads\/2021\/03\/Configure-Apache-Step-2-300x156.png 300w\" sizes=\"auto, (max-width: 627px) 100vw, 627px\" \/><\/figure>\r\n\r\n\r\n\r\n<p>Third, click the Start button to start the Apache service. If the port is free, Apache should start properly, as shown in the following picture:<\/p>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"664\" height=\"434\" class=\"wp-image-324\" src=\"https:\/\/phptutorial.net\/wp-content\/uploads\/2021\/03\/Configure-Apache-Step-3.png\" alt=\"\" srcset=\"https:\/\/www.phptutorial.net\/wp-content\/uploads\/2021\/03\/Configure-Apache-Step-3.png 664w, https:\/\/www.phptutorial.net\/wp-content\/uploads\/2021\/03\/Configure-Apache-Step-3-300x196.png 300w\" sizes=\"auto, (max-width: 664px) 100vw, 664px\" \/><\/figure>\r\n\r\n\r\n\r\n<p>In this tutorial, you&#8217;ve learned step by step how to install the XAMPP PHP development environment on your computer.<\/p>\r\n<div class=\"helpful-block-content\" data-title=\"\">\n\t<header>\n\t\t<div class=\"wth-question\">Did you find this tutorial useful?<\/div>\n\t\t<div class=\"wth-thumbs\">\n\t\t\t<button\n\t\t\t\tdata-post=\"303\"\n\t\t\t\tdata-post-url=\"https:\/\/www.phptutorial.net\/php-tutorial\/install-php\/\"\n\t\t\t\tdata-post-title=\"Install PHP\"\n\t\t\t\tdata-response=\"1\"\n\t\t\t\tclass=\"wth-btn-rounded wth-yes-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\tclass=\"feather feather-thumbs-up block w-full h-full\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> Yes <\/span>\n\t\t\t<\/button>\n\n\t\t\t<button\n\t\t\t\tdata-response=\"0\"\n\t\t\t\tdata-post=\"303\"\n\t\t\t\tdata-post-url=\"https:\/\/www.phptutorial.net\/php-tutorial\/install-php\/\"\n\t\t\t\tdata-post-title=\"Install PHP\"\n\t\t\t\tclass=\"wth-btn-rounded wth-no-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> No <\/span>\n\t\t\t<\/button>\n\t\t<\/div>\n\t<\/header>\n\n\t<div class=\"wth-form hidden\">\n\t\t<div class=\"wth-form-wrapper\">\n\t\t\t<div class=\"wth-title\"><\/div>\n\t\t\t\n\t\t\t<textarea class=\"wth-message\"><\/textarea>\n\n\t\t\t<button class=\"btn btn-primary wth-btn-submit\">Send<\/button>\n\t\t\t<button class=\"btn wth-btn-cancel\">Cancel<\/button>\n\t\t\n\t\t<\/div>\n\t<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial shows you step by step how to install XAMPP on your local computer for learning PHP.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":15,"menu_order":1,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-303","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.phptutorial.net\/wp-json\/wp\/v2\/pages\/303","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.phptutorial.net\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.phptutorial.net\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.phptutorial.net\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.phptutorial.net\/wp-json\/wp\/v2\/comments?post=303"}],"version-history":[{"count":5,"href":"https:\/\/www.phptutorial.net\/wp-json\/wp\/v2\/pages\/303\/revisions"}],"predecessor-version":[{"id":2928,"href":"https:\/\/www.phptutorial.net\/wp-json\/wp\/v2\/pages\/303\/revisions\/2928"}],"up":[{"embeddable":true,"href":"https:\/\/www.phptutorial.net\/wp-json\/wp\/v2\/pages\/15"}],"wp:attachment":[{"href":"https:\/\/www.phptutorial.net\/wp-json\/wp\/v2\/media?parent=303"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}