PHP is a server-side scripting,
so you can do anything any other CGI program can do, such
as collect form data, generate dynamic page content, or
send and receive cookies.
There are three main areas where PHP scripts are used.
1.
Server-side scripting:
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.
2. 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.
3. 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.
PHP also has support for talking to other services using protocols
such as LDAP, IMAP, SNMP, NNTP, POP3, HTTP, COM (on Windows) and
countless others. You can also open raw network sockets and
interact using any other protocol. PHP has support for the WDDX
complex data exchange between virtually all Web programming
languages. Talking about interconnection, PHP has support for
instantiation of Java objects and using them transparently
as PHP objects.
PHP has useful text processing features, which includes the Perl compatible regular expressions (PCRE), and many extensions and tools to parse and access XML documents. PHP standardizes all of the XML extensions on the solid base of libxml2, and extends the feature set adding SimpleXML, XMLReader and XMLWriter support.
PHP will support for a wide range of databases. Writing a database-enabled web page is incredibly simple using one of the database specific extensions (e.g., for mysql), or using an abstraction layer like PDO, or connect to any database supporting the Open Database Connection standard via the ODBC extension. Other databases may utilize cURL or sockets, like CouchDB.