PHP CHAPTER 02

PHP Install

PHP installation means preparing a PHP runtime and web server so PHP programs can execute.

📘

What is it?

PHP installation means preparing a PHP runtime and web server so PHP programs can execute.

💡

Why do we use it?

A local development environment allows you to build and test PHP applications before publishing them online.

⚙️

How does it work?

XAMPP provides Apache, PHP, MySQL and phpMyAdmin for local PHP development.

🧩

Syntax

PHP Syntax
<?php
phpinfo();
?>
💻

Example

PHP Example
<?php

phpinfo();

?>
🔍

Example Explained

phpinfo() displays information about the installed PHP environment.
🚀

More Examples

<?php echo "PHP environment is ready."; ?>

⚠️ Important Rules

For XAMPP, keep your project inside C:/xampp/htdocs/ and start Apache.

❌ Common Mistakes

Apache is not running, project is outside htdocs, or the URL does not use localhost.

🌍 Real-World Use

Developers normally test applications locally before deploying them to hosting or cPanel.

📝 Practice Exercise

Create test.php, run it through localhost and display PHP information.

💻 Try It Yourself

Write and run this PHP lesson inside the AIFA Coding Lab.

Open Coding Lab →