1.1 History of PHP
- Origin:
- PHP (Hypertext Preprocessor) was created in 1994 by Rasmus Lerdorf.
- Initially designed as a set of Common Gateway Interface (CGI) binaries to track visitors to his website.
- Evolution:
- 1995: PHP/FI (Personal Home Page/Forms Interpreter) released.
- 1997: PHP 2.0 introduced by Zeev Suraski and Andi Gutmans.
- 1998: PHP 3.0 – Redesigned engine, increased popularity.
- 2000: PHP 4.0 introduced the Zend Engine.
- 2004: PHP 5.0 introduced advanced OOP features.
- Current Version: PHP 8.x with major performance improvements and new features like Just-In-Time (JIT) compilation.
1.2 Features of PHP
- Open Source: Free to use and modify.
- Cross-Platform: Runs on Windows, Linux, macOS, etc.
- Server-Side Scripting: Executes on the server, outputs HTML to the client.
- Database Integration: Supports MySQL, PostgreSQL, SQLite, and more.
- Scalability: Suitable for small websites to large-scale web applications.
- Community Support: Extensive online resources and libraries.
- Dynamic Content: Enables dynamic and interactive web pages.
- Security Features: Tools to prevent SQL injection, XSS, and more.
1.3 How PHP Works with Web Servers
- PHP and Apache/Nginx:
- PHP works as a module or via FastCGI with web servers like Apache and Nginx.
- The web server sends HTTP requests to the PHP processor.
- Execution Flow:
- A user requests a PHP page via a browser (e.g.,
index.php
). - The web server passes the request to the PHP interpreter.
- The PHP interpreter processes the PHP code and generates HTML.
- The web server sends the HTML back to the user’s browser.
- A user requests a PHP page via a browser (e.g.,