health-check domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/yogisv5/sitesbyyogi.com/wp-includes/functions.php on line 6260Objective: Understand what PHP is, where it runs, and how to set up your local development environment.
PHP (short for Hypertext Preprocessor) is a server-side scripting language designed
primarily for web development, but it’s also used as a general-purpose programming language.
<?php
echo "Hello, StreetGeek!";
?>
The server interprets this, sends only the text Hello, StreetGeek! to the browser, and hides the PHP logic from view.
| Language | Runs On | Purpose | Example |
|---|---|---|---|
| HTML | Browser | Structure | Defines page layout (<h1>Title</h1>) |
| CSS | Browser | Style | Controls colors, fonts, spacing |
| JavaScript | Browser | Interactivity | Responds to user actions, fetches data dynamically |
| PHP | Server | Logic & Data | Fetches data, processes forms, connects to databases |
💡 Think of it like this:
HTML is your skeleton, CSS is your clothes, JavaScript is your movements,
and PHP is your brain.
| Type | Runs On | Example | Use Case |
|---|---|---|---|
| Client-side | User’s browser | JavaScript | Animations, instant form validation |
| Server-side | Web server | PHP | Database interaction, authentication, dynamic content |
PHP runs before the page reaches the browser. JavaScript runs after the browser receives the page.
The LAMP stack is a classic environment for running PHP websites:
You can also run PHP on Windows (WAMP) or Mac (MAMP).
localwp.com.apachefriends.org.C:\xampp\htdocs\C:\xampp\htdocs\php-basics\mamp.info./Applications/MAMP/htdocs/
Create a folder called php-basics inside your web root directory:
app/public folder.htdocs/php-basicshtdocs/php-basicsInside it, create a file called index.php and add:
<?php
echo "Hello, StreetGeek!";
?>
Open your browser and visit:
http://localhost/php-basics/
✅ You should see: Hello, StreetGeek!
.php FilesWhen you request a PHP file like:
http://localhost/php-basics/index.php
<?php ... ?> tags.<?php
$greeting = "StreetGeek Academy";
echo "<h1>Welcome to $greeting!</h1>";
?>
→ Browser output:
Welcome to StreetGeek Academy!
Deliverable
Run your first PHP script that outputs:
<?php
echo "Hello, StreetGeek!";
?>
Assignment
php-basics.index.php.http://localhost/php-basics/.
Objective: Get hands-on experience with PHP by setting up your environment,
writing your first script, and understanding how PHP interacts with HTML and the web server.
Requirements:
Folder Structure:
htdocs/
└── php-basics/
└── index.php
Goal: Write your first PHP program.
php-basics folder.index.php.<?php
echo "Hello, StreetGeek!";
?>
Open in your browser:
http://localhost/php-basics/
✅ Verify the page displays Hello, StreetGeek!
Goal: Learn how PHP and HTML can work together.
<!DOCTYPE html>
<html>
<head>
<title>StreetGeek Academy</title>
</head>
<body>
<h1>Welcome to PHP Basics</h1>
<p>
<?php
echo "This line is generated by PHP on " . date("l, F jS Y") . ".";
?>
</p>
</body>
</html>
✅ The date changes dynamically each time you refresh.
Goal: Use PHP to generate different content dynamically.
<?php
$hour = date("H");
if ($hour < 12) {
$greeting = "Good morning, StreetGeek!";
} elseif ($hour < 18) {
$greeting = "Good afternoon, StreetGeek!";
} else {
$greeting = "Good evening, StreetGeek!";
}
?>
<!DOCTYPE html>
<html>
<body>
<h1><?php echo $greeting; ?></h1>
</body>
</html>
Goal: Verify that PHP code is executed on the server.
<?php ... ?>) does not appear—only the resulting HTML is shown.Goal: Learn about your server configuration.
php-basics called info.php.<?php
phpinfo();
?>
Open in the browser:
http://localhost/php-basics/info.php
✅ You’ll see a detailed list of PHP settings, modules, and versions.
| # | Question | Options | Correct |
|---|---|---|---|
| 1 | What does PHP stand for? | a) Personal Home Page · b) PHP: Hypertext Preprocessor · c) Private Home Program | b |
| 2 | Where does PHP code execute? | a) In the browser · b) On the web server · c) On both | b |
| 3 | Which tag is used to start PHP code? | a) <php> · b) <?php · c) {php} | b |
| 4 | What is the file extension for PHP files? | a) .ph · b) .html · c) .php | c |
| 5 | What happens when you “View Page Source” of a PHP file? | a) You see all PHP code · b) You see only HTML output · c) You see server configuration | b |
Objective: Build a simple PHP web page that changes its message based on the time of day.
greeting.php inside your php-basics folder.date("H"))date()<h1>, <p>, <em>, etc.)Target format:
Good afternoon, StreetGeek!
Today is Tuesday, October 27, 2025 — The perfect day to learn PHP.
Add CSS styling inline or via <style> tags and run it at:
http://localhost/php-basics/greeting.php
php-basicsindex.php displays “Hello, StreetGeek!”info.php shows PHP configurationgreeting.php outputs a time-based greeting🏁 Completion Message: Once you finish, you’ve completed your first step toward PHP mastery.
In Module 2, you’ll learn the syntax and building blocks of PHP — variables, data types, and debugging with var_dump().