Overview
PHP is a server-side scripting language used to create dynamic web pages. You build pages using PHP and HTML. When a visitor opens a web page, the server processes the PHP instructions and sends the results to the visitor's browser — similar to ASP or ColdFusion.However, unlike ASP or ColdFusion, PHP is cross-platform and open source.
PHP can run on Windows NT and many different Unix versions. It can also be compiled as an Apache module or as a CGI binary. When compiled as an Apache module, PHP is particularly lightweight and efficient. It has no overhead from heavy processes, so it can return results quickly, and there's no need to adjust mod_perl just to keep server memory usage low.
Beyond generating web page content, PHP can also send HTTP headers. You can set cookies, manage authentication, and redirect users to new pages. It also offers excellent access to many databases and ODBC. In addition, PHP integrates with various external libraries, allowing you to do almost anything — from creating PDF files to parsing XML.
PHP code is embedded directly within web pages, so you don't need a special development environment or IDE. You mark PHP code with `<?php` and `?>` (you can also configure PHP to use ASP-style `<% %>` tags or even `<SCRIPT LANGUAGE="php"></SCRIPT>`). The PHP engine processes everything between these markers.
PHP's syntax is very similar to C and Perl. You don't need to declare variables before using them. Creating arrays and hashes (associative arrays) is also fast. PHP's basic object-oriented features provide an easy way to organize and encapsulate code.
Although PHP runs fastest when embedded as an Apache module, you can find guides on the official PHP website for seamless integration with Microsoft IIS and Netscape Enterprise Server as well. If you don't already have PHP, you can download it from the official website. There you'll also find a comprehensive user manual covering all PHP functions and features.
Since PHP scripts are written directly into HTML documents, you don't need a special editor to create pages. However, you must run PHP on a server that supports it. If you're using your own server, that's easy to set up. If you're working through an ISP, you'll need to contact their support team to request PHP installation.
For Unix systems, you'll need basic Unix skills — such as knowing how to use make and having a C compiler. You'll also need an ANSI C compiler and a web server on your system.
For Windows 95/NT, you'll need one of the following servers: Microsoft Personal Web Server, Microsoft Internet Information Server 3 or 4, Apache 1.3.x, or Omni HTTPd 2.0b1.
### What is a PHP Database?
PHP itself is not a database — it's a programming language. When people talk about a "PHP database," they usually mean a database that PHP can connect to and interact with. The most common combination is **PHP + MySQL**, both of which are open-source and widely used together.
PHP supports many database systems, including:
- MySQL / MariaDB
- PostgreSQL
- SQLite
- Oracle
- Microsoft SQL Server
- MongoDB (via extensions)
To work with databases in PHP, you typically use extensions like **mysqli**, **PDO_MySQL**, or **PDO** (PHP Data Objects), which provide a consistent interface for connecting to and querying databases.
