Basic PHP Installation Guide
Basic PHP Installation Guide for Beginners
1. What is PHP?
PHP (Hypertext Preprocessor) is a popular server-side scripting language used to develop dynamic
web pages.
2. Requirements:
- A web server (Apache recommended)
- PHP software
- A database server (MySQL recommended)
3. Installation on Windows:
- Download XAMPP from https://www.apachefriends.org/index.html
- Run the installer and follow the instructions
- Start Apache and MySQL from the XAMPP control panel
- Save your PHP files in the htdocs directory (e.g., C:\xampp\htdocs\myproject)
- Open your browser and go to http://localhost/myproject
4. Installation on macOS:
- Use MAMP or install PHP via Homebrew
- MAMP can be downloaded from https://www.mamp.info/
- Place your PHP files in /Applications/MAMP/htdocs/
- Start servers using the MAMP control panel
5. Installation on Linux:
- Use your package manager (e.g., apt, yum)
Example for Ubuntu:
sudo apt update
sudo apt install apache2 php libapache2-mod-php
- Save your PHP files in /var/www/html/
- Restart Apache: sudo systemctl restart apache2
6. Test PHP Installation:
- Create a file named info.php with the following content:
<?php phpinfo(); ?>
- Place it in your web server root and access it via browser
7. Next Steps:
- Learn PHP syntax: variables, loops, arrays, functions
- Connect PHP to MySQL database
- Build a simple CRUD (Create, Read, Update, Delete) application