PHP is a powerful scripting language that fits gracefully into HTML
and puts the tools for creating dynamic websites in the hands of the
people — even people like me who were too lazy to learn Perl scripting
and other complicated backend hoodoo.
This tutorial is for the person who understands HTML but doesn’t
know much about PHP. One of PHP’s greatest attributes is that it’s a
freely distributed open-source language, so there’s all kinds of
excellent reference material about it out there, which means that once
you understand the basics, it’s easy to find the materials that you need
to push your skills.
PHP is an HTML embedded language you should have a basic
understanding of HTML/XHTML and (a little) JavaScript. In the coming
tutorials we will explain the PHP code, but we won’t explain the HTML
code (at least not in great detail.)
What is PHP?
- PHP stands for PHP: Hypertext Preprocessor.
- As we said before it is a server-side scripting language.
- PHP is free and is an open source software product.
- The PHP scripts are executed on the server.
- PHP supports many databases (MySQL, Sybase, Oracle and many others.)
- PHP runs on different platforms (Unix, Linux, Windows.)
- PHP is compatible with almost all web-servers used today (Apache, IIS, etc.)
- A PHP file can contain plain text, HTML tags and scripts
- The PHP files can have one of the following extensions: php, php3 or phtml.
There are three main areas where PHP scripts are used.
- Server-side scripting. This is the most traditional
and main target field for PHP. You need three things
to make this work. The PHP parser (CGI or server
module), a web server and a web browser. You need to
run the web server, with a connected PHP installation.
You can access the PHP program output with a web browser,
viewing the PHP page through the server. All these can
run on your home machine if you are just experimenting
with PHP programming. See the
installation instructions
section for more information.
- Command line scripting. You can make a PHP script
to run it without any server or browser.
You only need the PHP parser to use it this way.
This type of usage is ideal for scripts regularly
executed using cron (on *nix or Linux) or Task Scheduler (on
Windows). These scripts can also be used for simple text
processing tasks. See the section about
Command line usage of PHP
for more information.
- Writing desktop applications. PHP is probably
not the very best language to create a desktop
application with a graphical user interface, but if
you know PHP very well, and would like to use some
advanced PHP features in your client-side applications
you can also use PHP-GTK to write such programs. You also
have the ability to write cross-platform applications this
way. PHP-GTK is an extension to PHP, not available in
the main distribution. If you are interested
in PHP-GTK,
PHP can be used on all major operating systems, including
Linux, many Unix variants (including HP-UX, Solaris and OpenBSD),
Microsoft Windows, Mac OS X, RISC OS, and probably others.
PHP has also support for most of the web servers today. This
includes Apache, IIS, and many others. And this includes any
web server that can utilize the FastCGI PHP binary, like lighttpd
and nginx. PHP works as either a module, or as a CGI processor.