How to install php on xampp
Hello and welcome to this tutorial, everyone. Today, we'll look at how you can set up and use PHP in a project. But before we get started, we'll need
to understand what PHP is all about. PHP is an abbreviation or acronym for "Hypertext Preprocessor." It's a web-based open source server-side scripting language that's integrated in your HTML files. You use it to make webpages that are both responsive and interactive with the database. PHP has many benefits, and here are a few of them: You don't need to study extensively to learn and use PHP because its syntax is sensible and well-organized. The command functions are also easy to work with because they help you understand exactly what they do. Flexibility is a major benefit that every scripting language should have, and PHP is no exception. Even after a project has been launched, a PHP developer has the ability to make changes to the project. You can use PHP to collect data from a form that has been created with HTML (like Name, E-mail, Phone Number, or Password). Many websites use this particular function of PHP. PHP does not outsource the data or information collected from forms. This is part of the reason why most most website and social media apps make use of it because it has a
secure database system. To get started with PHP, you'll need three things: a code editor for writing your code, an installed version of PHP, and XAMPP. We'll be using Visual Studio code in this example, and I'll teach you how to install a version of PHP and XAMPP on your PC. Go to the PHP website and click on download in the navigation bar. The current version should be at the top. Click on "Windows downloads," and when it opens, scroll down a little and you should see a section that has "VS16 x64 Thread Safe (2022-May-11 09:29:42)." The section contains a "zip" file below it – click on it and wait for your download to finish. Click on the Download ButtonClick on Windows downloadsBelow Thread Safe click on the zip file to downloadWhen the download is complete, go to your computer's downloads folder and look for a PHP zip file. Right-click it and select extract file. It's important to save the file to your local drive. Zip folder and the extracted folderOpen the Local Disk and open the extracted PHP folder. Click once on the bar that shows the current directory then copy the name of the directory, which should be in this format: C:\php-8.1.6. Click the bar once and copy the Directory nameIn your windows bar, search for “Edit the systems environment property”. Click on the “environment variables” button, click on “Path”, and then click on the edit button below. It opens a space where you can create a new variable. So click on the new button and then paste the name of the directory you copied earlier (which should be “C:\php-8.1.6”) and click ok for all of them. To test if PHP is now installed in your computer, search for the command prompt in Windows by using the search keyword The current version of PHP is installed on our PC as seen in the image above. The next step is to get XAMPP. What is XAMPP?The acronym XAMPP stands for cross-platform, Apache, MySQL, PHP, and Perl. XAMPP is a free and open source web server that allows you to develop, test, and build websites on a local server. Unlike PHP, XAMPP installation is quite simple and uncomplicated. Search for "XAMPP Download" in your browser or go to their website. You should see the current version of XAMPP for Windows, Linux, and OSX when it opens. Because I'm using a Windows computer, I simply need to click on the one for Windows, and the download should begin. When its done downloading, go to your downloads, right click on the setup file and select “run as administrator”. This will take you to the Setup-xampp wizard: click nextClick next, and you'll be able to select the components you want: Select components and click nextThen you'll come to the installation folder. You have to select a folder where you want to install XAMPP. I recommend creating a folder in your local disk to install XAMPP. select an installation folderThen you'll select the language. You can select either English or Deutsch (your choice): select languageNow you'll get Bitnami for XAMPP: click nextAnd you're ready to install: click nextBe patient while the installation process completes. When it's, done click ok. wait for the installation to completeOnce the installation process is finished, you can now use XAMPP in you project. Why Do You Need XAMPP?To run PHP for the web, you will need to install a web server like Apache and a database like MySQL – and both are supported by XAMPP. XAMPP is a local server that can run smoothly on our personal computer, and is accepted in both Windows and Linux. It also helps you test websites and see if they work before actually publishing them to a web server. How to Run PHP with XAMPPTo run PHP with XAMPP you will have to go through some steps, and I will break it down so you can understand. First, open the local storage folder, go to the “xampp” folder and open it. You should see a folder named “htdocs”. Open it then create a new folder in it. In my case I named the folder I created “Demo” (so give your folder the name of your choice). Next, open your VS code, click on open folder, then go to the location where you saved the folder you created (which in my case I named “Demo”). Create a file with the extension PHP is run with the
The echo keyword tells the browser to display After writing the code, open the XAMPP control panel, and start the Apache module by clicking on start under the action section. Then go to your web browser and in the search bar type If your code was displayed on the web browser, congratulations! You're up and running. ConclusionThank you very much for following along with this tutorial. I hope you got some value out of this lesson and I hope you'll try using PHP and XAMPP. Stay tuned for my next tutorial. Have fun coding! Learn to code for free. freeCodeCamp's open source curriculum has helped more than 40,000 people get jobs as developers. Get started Do I need to install PHP if I have XAMPP?To run PHP for the web, you will need to install a web server like Apache and a database like MySQL – and both are supported by XAMPP. XAMPP is a local server that can run smoothly on our personal computer, and is accepted in both Windows and Linux.
Where do I put PHP code in XAMPP?Before running a PHP script, you must know where to write it. In the XAMPP directory, there exists a folder called “htdocs”. This is where all the programs for the web pages will be stored.
How do I install PHP?How to Install PHP. Step 1: Download the PHP files. You'll need the PHP Windows installer. ... . Step 2: Extract the files. ... . Step 3: Configure php. ... . Step 4: Add C:\php to the path environment variable. ... . Step 5: Configure PHP as an Apache module. ... . Step 6: Test a PHP file.. How do I start PHP in XAMPP?Place your PHP files in the "HTDocs" folder located under the "XAMMP" folder on your C: drive. The file path is "C:\xampp\htdocs" for your Web server. Make sure your PHP files are saved as such; they must have the ". php" file extension.
|