{"id":66570,"date":"2024-10-09T14:12:03","date_gmt":"2024-10-09T09:12:03","guid":{"rendered":"https:\/\/devrims.com\/blog\/?p=66570"},"modified":"2025-01-24T17:51:00","modified_gmt":"2025-01-24T12:51:00","slug":"how-to-run-a-php-file-using-xampp","status":"publish","type":"post","link":"https:\/\/devrims.com\/blog\/how-to-run-a-php-file-using-xampp\/","title":{"rendered":"How to Run a PHP File Using XAMPP"},"content":{"rendered":"\r\n\r\n\r\n\r\n\r\n\r\n\n<p>Before transferring your PHP application to a live server, you must develop and test it on a local host. A popular program called XAMPP makes this process simple and effective.&nbsp;<\/p>\n\n\n\n<p>By following this tutorial, you will be able to set up XAMPP and run your PHP files.<\/p>\n\n\n\n<h2 id='what-is-xampp'  id=\"boomdevs_1\" class=\"wp-block-heading\">What is XAMPP?<\/h2>\n\n\n\n<p>XAMPP is an open-source web server solution package developed by Apache Friends. On local web servers, it is mainly used for web application testing. XAMPP stands for:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>X<\/strong>: Cross-platform<\/li>\n\n\n\n<li><strong>A<\/strong>: Apache Server<\/li>\n\n\n\n<li><strong>M<\/strong>: MariaDB (MySQL)<\/li>\n\n\n\n<li><strong>P<\/strong>: PHP<\/li>\n\n\n\n<li><strong>P<\/strong>: Perl<\/li>\n<\/ul>\n\n\n\n<h3 id='why-use-xampp'  id=\"boomdevs_2\" class=\"wp-block-heading\"><strong>Why Use XAMPP?<\/strong><\/h3>\n\n\n\n<p>XAMPP provides all the necessary tools to run PHP programs, including MySQL databases and Apache servers. It provides local application testing for developers before launching to a live server.<\/p>\n\n\n\n<h3 id='how-to-install-xampp-on-windows-localhost'  id=\"boomdevs_3\" class=\"wp-block-heading\"><strong>How to Install XAMPP on Windows Localhost?<\/strong><\/h3>\n\n\n\n<p>Your PHP development journey on Windows requires a robust and stable local server environment. XAMPP, an open-source solution, that is highly recommended for developers. In this guide, XAMPP, ensure you&#8217;re well-equipped to dive into PHP development with ease. Let&#8217;s transform your Windows localhost into a powerful development playground!<\/p>\n\n\n\n<p><strong>Step 1: Download XAMPP<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"888\" height=\"564\" src=\"https:\/\/devrims.com\/blog\/wp-content\/uploads\/2024\/10\/9-1.png\" alt=\"\" class=\"wp-image-66571\" srcset=\"https:\/\/devrims.com\/blog\/wp-content\/uploads\/2024\/10\/9-1.png 888w, https:\/\/devrims.com\/blog\/wp-content\/uploads\/2024\/10\/9-1-300x191.png 300w, https:\/\/devrims.com\/blog\/wp-content\/uploads\/2024\/10\/9-1-768x488.png 768w, https:\/\/devrims.com\/blog\/wp-content\/uploads\/2024\/10\/9-1-24x15.png 24w, https:\/\/devrims.com\/blog\/wp-content\/uploads\/2024\/10\/9-1-36x23.png 36w, https:\/\/devrims.com\/blog\/wp-content\/uploads\/2024\/10\/9-1-48x30.png 48w\" sizes=\"auto, (max-width: 888px) 100vw, 888px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Visit the <a href=\"https:\/\/www.apachefriends.org\/\" target=\"_blank\" rel=\"noopener\">ApacheFriend.org<\/a> website and download XAMPP for your operating system.<\/li>\n<\/ul>\n\n\n\n<p><strong>Step 2: Run the Installer<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"671\" height=\"261\" src=\"https:\/\/devrims.com\/blog\/wp-content\/uploads\/2024\/10\/11-1.png\" alt=\"\" class=\"wp-image-66573\" srcset=\"https:\/\/devrims.com\/blog\/wp-content\/uploads\/2024\/10\/11-1.png 671w, https:\/\/devrims.com\/blog\/wp-content\/uploads\/2024\/10\/11-1-300x117.png 300w, https:\/\/devrims.com\/blog\/wp-content\/uploads\/2024\/10\/11-1-24x9.png 24w, https:\/\/devrims.com\/blog\/wp-content\/uploads\/2024\/10\/11-1-36x14.png 36w, https:\/\/devrims.com\/blog\/wp-content\/uploads\/2024\/10\/11-1-48x19.png 48w\" sizes=\"auto, (max-width: 671px) 100vw, 671px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Open the downloaded file and follow the installation instructions. It is recommended to keep the default installation directory (C:\\xampp).<\/li>\n<\/ul>\n\n\n\n<p><strong>Step 3: Start Apache and MySQL<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXdKLFBzQLB6GPfifOZxw7lYDmkzZqhsOCvwOtJSwjNSEFZUCuU2QVLkNmKCDlxcZhjBwVjyvl1iPrh25WMmVfxWx10rcxgB1hePUFN4JLWlVvzJDxM4yeJZjWJXBK8ufsuMj0yghPr9Ssc86aX3drs0SQaF?key=N1IHBKP0TAWViAEs3PuQ5Q\" alt=\"\"><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Open the XAMPP Control Panel. Execute the Apache and MySQL services by clicking the &#8220;Start&#8221; buttons next to them.<\/li>\n<\/ul>\n\n\n\n<p>Congratulations! You have completed the XAMPP installation process &amp; started Apache and MySQL!<\/p>\n\n\n\n<h3 id='setting-up-a-php-project-in-xampp'  id=\"boomdevs_4\" class=\"wp-block-heading\"><strong>Setting Up a PHP Project in XAMPP<\/strong><\/h3>\n\n\n\n<p>It&#8217;s quite easy to get started with your PHP project with XAMPP. After putting your PHP files in a new directory, open your web browser and enter your project. You will be able to code and test your PHP applications locally after completing this process.<\/p>\n\n\n\n<p><strong>Step 1: Create a New Folder in <\/strong><strong>htdocs<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Navigate to the XAMPP installation directory (C:\\xampp\\htdocs) and create a new folder for your project. For example, name it demo.<\/li>\n<\/ul>\n\n\n\n<p><strong>Step 2: Write a PHP Script<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"618\" height=\"330\" src=\"https:\/\/devrims.com\/blog\/wp-content\/uploads\/2024\/10\/12-1.png\" alt=\"\" class=\"wp-image-66574\" srcset=\"https:\/\/devrims.com\/blog\/wp-content\/uploads\/2024\/10\/12-1.png 618w, https:\/\/devrims.com\/blog\/wp-content\/uploads\/2024\/10\/12-1-300x160.png 300w, https:\/\/devrims.com\/blog\/wp-content\/uploads\/2024\/10\/12-1-24x13.png 24w, https:\/\/devrims.com\/blog\/wp-content\/uploads\/2024\/10\/12-1-36x19.png 36w, https:\/\/devrims.com\/blog\/wp-content\/uploads\/2024\/10\/12-1-48x26.png 48w\" sizes=\"auto, (max-width: 618px) 100vw, 618px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Inside the demo folder, create a new file named new.php.&nbsp;<\/li>\n<\/ul>\n\n\n\n<p><strong>Step 3: Save the File<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Save the file in the (demo) folder.<\/li>\n<\/ul>\n\n\n\n<h3 id='running-your-php-script'  id=\"boomdevs_5\" class=\"wp-block-heading\"><strong>Running Your PHP Script<\/strong><\/h3>\n\n\n\n<p>It&#8217;s easy to run your PHP script using XAMPP. Once your PHP project is configured in the &#8220;htdocs&#8221; directory, use the XAMPP control panel to make sure that the Apache server is started and running. Your PHP script will run as a result, and the output will appear in the browser. You may easily test and debug your PHP code locally by following these easy steps.<\/p>\n\n\n\n<p><strong>Step 1: Open Your Web Browser<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Open your preferred web browser. In my case, I am using Google Chrome.<\/li>\n<\/ul>\n\n\n\n<p><strong>Step 2: Access the Localhost<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"306\" src=\"https:\/\/devrims.com\/blog\/wp-content\/uploads\/2024\/10\/13-1.png\" alt=\"\" class=\"wp-image-66575\" srcset=\"https:\/\/devrims.com\/blog\/wp-content\/uploads\/2024\/10\/13-1.png 600w, https:\/\/devrims.com\/blog\/wp-content\/uploads\/2024\/10\/13-1-300x153.png 300w, https:\/\/devrims.com\/blog\/wp-content\/uploads\/2024\/10\/13-1-24x12.png 24w, https:\/\/devrims.com\/blog\/wp-content\/uploads\/2024\/10\/13-1-36x18.png 36w, https:\/\/devrims.com\/blog\/wp-content\/uploads\/2024\/10\/13-1-48x24.png 48w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Type (<strong>http:\/\/localhost\/demo<\/strong>) in the address bar and press Enter.<\/li>\n<\/ul>\n\n\n\n<p><strong>Step 3: View the Output<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>You should see &#8220;Hello, world!&#8221; displayed in your browser, indicating that your PHP script is running successfully.<\/li>\n<\/ul>\n\n\n\n<h2 id='faqs'  id=\"boomdevs_6\" class=\"wp-block-heading\">FAQs<\/h2>\n\n\n<div ><style>#sp-ea-66576 .spcollapsing { height: 0; overflow: hidden; transition-property: height;transition-duration: 300ms;}#sp-ea-66576.sp-easy-accordion>.sp-ea-single {margin-bottom: 10px; border: 1px solid #e2e2e2; }#sp-ea-66576.sp-easy-accordion>.sp-ea-single>.ea-header a {color: #444;}#sp-ea-66576.sp-easy-accordion>.sp-ea-single>.sp-collapse>.ea-body {background: #fff; color: #444;}#sp-ea-66576.sp-easy-accordion>.sp-ea-single {background: #eee;}#sp-ea-66576.sp-easy-accordion>.sp-ea-single>.ea-header a .ea-expand-icon { float: left; color: #444;font-size: 16px;}<\/style><div id=\"sp_easy_accordion-1728464611\"><div id=\"sp-ea-66576\" class=\"sp-ea-one sp-easy-accordion\" data-ea-active=\"ea-click\" data-ea-mode=\"vertical\" data-preloader=\"\" data-scroll-active-item=\"\" data-offset-to-scroll=\"0\"><div class=\"ea-card ea-expand sp-ea-single\"><h3 id='what-is-php'  id=\"boomdevs_7\" class=\"ea-header\"><a class=\"collapsed\" id=\"ea-header-665760\" role=\"button\" data-sptoggle=\"spcollapse\" data-sptarget=\"#collapse665760\" aria-controls=\"collapse665760\" href=\"#\" aria-expanded=\"true\" tabindex=\"0\"><i aria-hidden=\"true\" role=\"presentation\" class=\"ea-expand-icon eap-icon-ea-expand-minus\"><\/i> What Is PHP?<\/a><\/h3><div class=\"sp-collapse spcollapse collapsed show\" id=\"collapse665760\" data-parent=\"#sp-ea-66576\" role=\"region\" aria-labelledby=\"ea-header-665760\"> <div class=\"ea-body\"><p>PHP (Hypertext Preprocessor) an open-source programming language which is widely used for web development. It runs over various servers and platforms. PHP files are files with an extension (.php) that can be used for a variety of tasks, including file creation, reading, writing, file management, database operations, and user access control. In order to improve security, PHP can additionally encrypt data.<\/p><\/div><\/div><\/div><div class=\"ea-card sp-ea-single\"><h3 id='why-choose-php-for-your-website'  id=\"boomdevs_8\" class=\"ea-header\"><a class=\"collapsed\" id=\"ea-header-665761\" role=\"button\" data-sptoggle=\"spcollapse\" data-sptarget=\"#collapse665761\" aria-controls=\"collapse665761\" href=\"#\" aria-expanded=\"false\" tabindex=\"0\"><i aria-hidden=\"true\" role=\"presentation\" class=\"ea-expand-icon eap-icon-ea-expand-plus\"><\/i> Why Choose PHP for your Website:<\/a><\/h3><div class=\"sp-collapse spcollapse \" id=\"collapse665761\" data-parent=\"#sp-ea-66576\" role=\"region\" aria-labelledby=\"ea-header-665761\"> <div class=\"ea-body\"><p>PHP has many benefits that make it a top choice for web developers.<\/p><ol><li><b>Simplicity:<\/b> PHP is a language that both beginner and expert developers may easily learn, thanks to its simple commands.<\/li><li><b>Compatibility:<\/b> PHP is compatible with a wide range of operating systems, such as Linux, macOS, and Windows.<\/li><li><b>Flexibility:<\/b> PHP makes it simple for developers to modify already existing projects.<\/li><li><b>Cost-effective:<\/b> PHP is free to download and use without any license fees because it is an open-source language.<\/li><li><b>Performance:<\/b> PHP is an excellent language for web development since PHP scripts load more quickly than those of many other computer languages.<\/li><\/ol><p><b>Library Support: <\/b>To make their work easier, developers may use PHP&#8217;s extensive library of pre-written programs and libraries.<\/p><\/div><\/div><\/div><\/div><\/div><\/div>\n\n\n<h3 id='in-summary'  id=\"boomdevs_9\" class=\"wp-block-heading\">In Summary<\/h3>\n\n\n\n<p>One simple step in developing websites is to set up XAMPP and run PHP scripts locally. That has the potential to greatly improve your development workflow.<\/p>\n\n\n\n<p>Before putting your PHP website on a live server, you may build, test, and debug them in a secure local environment by following these steps. Have fun with coding!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Before transferring your PHP application to a live server, you must develop and test it on a local host. A popular program called XAMPP makes this process simple and effective.&nbsp; By following this tutorial, you will be able to set up XAMPP and run your PHP files. What is XAMPP? XAMPP is an open-source web [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":66593,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[14],"tags":[58],"ad-banner":[85],"blog-popup":[],"cta-banner":[],"class_list":["post-66570","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php","tag-php-development","ad-banner-php"],"acf":[],"_links":{"self":[{"href":"https:\/\/devrims.com\/blog\/wp-json\/wp\/v2\/posts\/66570","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devrims.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devrims.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devrims.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/devrims.com\/blog\/wp-json\/wp\/v2\/comments?post=66570"}],"version-history":[{"count":2,"href":"https:\/\/devrims.com\/blog\/wp-json\/wp\/v2\/posts\/66570\/revisions"}],"predecessor-version":[{"id":66578,"href":"https:\/\/devrims.com\/blog\/wp-json\/wp\/v2\/posts\/66570\/revisions\/66578"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devrims.com\/blog\/wp-json\/wp\/v2\/media\/66593"}],"wp:attachment":[{"href":"https:\/\/devrims.com\/blog\/wp-json\/wp\/v2\/media?parent=66570"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devrims.com\/blog\/wp-json\/wp\/v2\/categories?post=66570"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devrims.com\/blog\/wp-json\/wp\/v2\/tags?post=66570"},{"taxonomy":"ad-banner","embeddable":true,"href":"https:\/\/devrims.com\/blog\/wp-json\/wp\/v2\/ad-banner?post=66570"},{"taxonomy":"blog-popup","embeddable":true,"href":"https:\/\/devrims.com\/blog\/wp-json\/wp\/v2\/blog-popup?post=66570"},{"taxonomy":"cta-banner","embeddable":true,"href":"https:\/\/devrims.com\/blog\/wp-json\/wp\/v2\/cta-banner?post=66570"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}