2.1 Installing XAMPP/WAMP/MAMP
- What is XAMPP/WAMP/MAMP?
- XAMPP: Cross-platform Apache, MySQL, PHP, Perl.
- WAMP: Windows-based server stack.
- MAMP: macOS-based stack.
- Steps to Install XAMPP:
- Download from the official XAMPP website.
- Run the installer and follow the prompts.
- Start the Apache and MySQL services from the XAMPP Control Panel.
- Verifying Installation:
- Open a browser and visit
http://localhost
. - You should see the XAMPP dashboard.
- Open a browser and visit
2.2 Setting Up VS Code/PhpStorm for PHP
- Visual Studio Code (VS Code):
- Download and install from the VS Code website.
- Install the PHP Intelephense extension for code suggestions.
- Set up the PHP executable path in VS Code settings.
- PhpStorm:
- Download and install PhpStorm from JetBrains.
- Configure your project by pointing to the PHP interpreter and web server.
2.3 Running Your First PHP Script
-
- Create a file named
index.php
in the XAMPPhtdocs
directory (or the equivalent for WAMP/MAMP). - Add the following code:
- Create a file named
- Open a browser and navigate to
http://localhost/index.php
. - You should see
Hello, World!
displayed on the screen.
<?php
echo "Hello, World!";
?>
Leave a Reply