2001-08-19 11:09:18 +00:00
|
|
|
<?xml encoding="iso-8859-1"?>
|
2001-11-09 15:48:16 +00:00
|
|
|
<!-- $Revision: 1.20 $ -->
|
1999-06-06 18:51:02 +00:00
|
|
|
<chapter id="introduction">
|
|
|
|
<title>Introduction</title>
|
|
|
|
|
|
|
|
<sect1 id="intro-whatis">
|
|
|
|
<title>What is PHP?</title>
|
|
|
|
<simpara>
|
1999-11-15 07:51:00 +00:00
|
|
|
PHP (officially "PHP: Hypertext Preprocessor") is a server-side
|
1999-12-19 17:16:54 +00:00
|
|
|
HTML-embedded scripting language.
|
|
|
|
</simpara>
|
1999-06-06 18:51:02 +00:00
|
|
|
<para>
|
1999-12-19 17:16:54 +00:00
|
|
|
Simple answer, but what does that mean? An example:
|
|
|
|
</para>
|
1999-06-19 21:58:55 +00:00
|
|
|
<para>
|
|
|
|
<example>
|
|
|
|
<title>An introductory example</title>
|
1999-12-19 20:13:06 +00:00
|
|
|
<programlisting role="php">
|
2001-11-09 15:48:16 +00:00
|
|
|
<![CDATA[
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Example</title>
|
|
|
|
</head>
|
|
|
|
<body>
|
2000-08-31 05:56:42 +00:00
|
|
|
|
2001-11-09 15:48:16 +00:00
|
|
|
<?php
|
2000-08-31 05:56:42 +00:00
|
|
|
echo "Hi, I'm a PHP script!";
|
2001-11-09 15:48:16 +00:00
|
|
|
?>
|
2000-08-31 05:56:42 +00:00
|
|
|
|
2001-11-09 15:48:16 +00:00
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
]]>
|
1999-06-19 21:58:55 +00:00
|
|
|
</programlisting>
|
1999-12-19 17:16:54 +00:00
|
|
|
</example>
|
|
|
|
</para>
|
1999-06-20 01:21:17 +00:00
|
|
|
<para>
|
1999-06-06 18:51:02 +00:00
|
|
|
Notice how this is different from a CGI script written in other
|
|
|
|
languages like Perl or C -- instead of writing a program with lots
|
|
|
|
of commands to output HTML, you write an HTML script with a some
|
1999-10-20 22:46:26 +00:00
|
|
|
embedded code to do something (in this case, output some
|
1999-12-19 17:16:54 +00:00
|
|
|
text). The PHP code is enclosed in special <link
|
|
|
|
linkend="language.basic-syntax.phpmode">start and end tags</link>
|
|
|
|
that allow you to jump into and out of PHP mode.
|
|
|
|
</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
<para>
|
|
|
|
What distinguishes PHP from something like client-side Javascript
|
|
|
|
is that the code is executed on the server. If you were to have a
|
|
|
|
script similar to the above on your server, the client would receive
|
|
|
|
the results of running that script, with no way of determining what
|
|
|
|
the underlying code may be. You can even configure your web server
|
|
|
|
to process all your HTML files with PHP, and then there's really no
|
1999-12-19 17:16:54 +00:00
|
|
|
way that users can tell what you have up your sleeve.
|
|
|
|
</para>
|
|
|
|
</sect1>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
<sect1 id="intro-whatcando">
|
|
|
|
<title>What can PHP do?</title>
|
|
|
|
<para>
|
|
|
|
At the most basic level, PHP can do anything any other CGI
|
|
|
|
program can do, such as collect form data, generate dynamic
|
1999-12-19 17:16:54 +00:00
|
|
|
page content, or send and receive cookies.
|
|
|
|
</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
<para>
|
|
|
|
Perhaps the strongest and most significant feature in PHP is its
|
|
|
|
support for a wide range of databases. Writing a database-enabled
|
|
|
|
web page is incredibly simple. The following databases are currently
|
|
|
|
supported:
|
|
|
|
<blockquote>
|
1999-10-20 22:46:26 +00:00
|
|
|
<simplelist columns="3">
|
1999-06-06 18:51:02 +00:00
|
|
|
<member>Adabas D</member>
|
|
|
|
<member>dBase</member>
|
|
|
|
<member>Empress</member>
|
2000-08-07 05:31:47 +00:00
|
|
|
<member>FilePro (read-only)</member>
|
2000-10-27 07:59:39 +00:00
|
|
|
<member>Hyperwave</member>
|
2000-08-07 05:31:47 +00:00
|
|
|
<member>IBM DB2</member>
|
1999-06-06 18:51:02 +00:00
|
|
|
<member>Informix</member>
|
2000-08-07 05:31:47 +00:00
|
|
|
<member>Ingres</member>
|
1999-06-06 18:51:02 +00:00
|
|
|
<member>InterBase</member>
|
2000-08-07 05:31:47 +00:00
|
|
|
<member>FrontBase</member>
|
1999-06-06 18:51:02 +00:00
|
|
|
<member>mSQL</member>
|
2000-08-07 05:31:47 +00:00
|
|
|
<member>Direct MS-SQL</member>
|
1999-06-06 18:51:02 +00:00
|
|
|
<member>MySQL</member>
|
2000-08-07 05:31:47 +00:00
|
|
|
<member>ODBC</member>
|
|
|
|
<member>Oracle (OCI7 and OCI8)</member>
|
2000-10-27 07:59:39 +00:00
|
|
|
<member>Ovrimos</member>
|
1999-06-06 18:51:02 +00:00
|
|
|
<member>PostgreSQL</member>
|
|
|
|
<member>Solid</member>
|
|
|
|
<member>Sybase</member>
|
|
|
|
<member>Velocis</member>
|
|
|
|
<member>Unix dbm</member>
|
|
|
|
</simplelist>
|
1999-12-19 17:16:54 +00:00
|
|
|
</blockquote>
|
|
|
|
</para>
|
1999-06-06 18:51:02 +00:00
|
|
|
<para>
|
|
|
|
PHP also has support for talking to other services using protocols
|
2000-08-07 05:31:47 +00:00
|
|
|
such as IMAP, SNMP, NNTP, POP3, HTTP and countless others. You can also
|
|
|
|
open raw network sockets and interact using other protocols.
|
1999-12-19 17:16:54 +00:00
|
|
|
</para>
|
2000-06-07 16:49:38 +00:00
|
|
|
<!--
|
1999-12-19 17:16:54 +00:00
|
|
|
<figure>
|
|
|
|
<title>Internal Structure</title>
|
|
|
|
<graphic fileref="../images/php3_internal_structure.gif"/>
|
|
|
|
</figure>
|
|
|
|
<figure>
|
|
|
|
<title>Request Scheme</title>
|
|
|
|
<graphic fileref="../images/php3_request_scheme.gif"/>
|
|
|
|
</figure>
|
2000-06-07 16:49:38 +00:00
|
|
|
-->
|
1999-12-19 17:16:54 +00:00
|
|
|
</sect1>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
<sect1 id="intro-history">
|
1999-08-01 00:37:07 +00:00
|
|
|
<title>A brief history of PHP</title>
|
1999-06-06 18:51:02 +00:00
|
|
|
<simpara>
|
1999-10-20 22:46:26 +00:00
|
|
|
PHP was conceived sometime in the fall of 1994 by &link.rasmus;.
|
1999-12-19 17:16:54 +00:00
|
|
|
Early non-released versions were used on his home page to keep
|
|
|
|
track of who was looking at his online resume. The first version
|
|
|
|
used by others was available sometime in early 1995 and was known
|
|
|
|
as the Personal Home Page Tools. It consisted of a very
|
|
|
|
simplistic parser engine that only understood a few special macros
|
|
|
|
and a number of utilities that were in common use on home pages
|
|
|
|
back then. A guestbook, a counter and some other stuff. The
|
|
|
|
parser was rewritten in mid-1995 and named PHP/FI Version 2. The
|
|
|
|
FI came from another package Rasmus had written which interpreted
|
|
|
|
html form data. He combined the Personal Home Page tools scripts
|
|
|
|
with the Form Interpreter and added mSQL support and PHP/FI was
|
|
|
|
born. PHP/FI grew at an amazing pace and people started
|
|
|
|
contributing code to it.
|
|
|
|
</simpara>
|
1999-06-06 18:51:02 +00:00
|
|
|
<simpara>
|
1999-10-20 22:46:26 +00:00
|
|
|
It is difficult to give any hard statistics, but it is estimated
|
|
|
|
that by late 1996 PHP/FI was in use on at least 15,000 web sites
|
|
|
|
around the world. By mid-1997 this number had grown to over
|
|
|
|
50,000. Mid-1997 also saw a change in the development of PHP. It
|
|
|
|
changed from being Rasmus' own pet project that a handful of
|
|
|
|
people had contributed to, to being a much more organized team
|
|
|
|
effort. The parser was rewritten from scratch by Zeev Suraski and
|
|
|
|
Andi Gutmans and this new parser formed the basis for PHP Version
|
2000-09-15 16:09:44 +00:00
|
|
|
3. A lot of the utility code from PHP/FI was ported over to PHP 3
|
1999-12-19 17:16:54 +00:00
|
|
|
and a lot of it was completely rewritten.
|
|
|
|
</simpara>
|
1999-06-06 18:51:02 +00:00
|
|
|
<simpara>
|
2001-01-12 23:36:02 +00:00
|
|
|
The latest version (PHP 4) uses the <ulink
|
|
|
|
url="&url.zend;">Zend</ulink> scripting engine to deliver higher
|
|
|
|
performance, supports an even wider array of third-party libraries
|
|
|
|
and extensions, and runs as a native server module with all of the
|
|
|
|
popular web servers.
|
|
|
|
</simpara>
|
|
|
|
<simpara>
|
|
|
|
Today (1/2001) PHP 3 or PHP 4 now ships with a number of
|
|
|
|
commercial products such as Red Hat's Stronghold web server.
|
|
|
|
A conservative estimate based on an extrapolation from
|
|
|
|
numbers provided by <ulink url="&url.netcraft;">Netcraft</ulink>
|
1999-12-19 17:16:54 +00:00
|
|
|
(see also <ulink url="&url.netcraft-survey;">Netcraft Web Server
|
2001-01-12 23:36:02 +00:00
|
|
|
Survey</ulink>) would be that PHP is in use on over 5,100,000
|
|
|
|
sites around the world. To put that in perspective, that is
|
2001-01-13 00:50:35 +00:00
|
|
|
slightly more sites than run Microsoft's IIS server on the Internet
|
|
|
|
(5.03 million).
|
1999-12-19 17:16:54 +00:00
|
|
|
</simpara>
|
2000-06-07 16:49:38 +00:00
|
|
|
<!--
|
1999-12-19 17:16:54 +00:00
|
|
|
<figure>
|
|
|
|
<title>NetCraft Webserver Survey</title>
|
2000-02-02 13:54:20 +00:00
|
|
|
<graphic fileref="&url.php.stats;"/>
|
1999-12-19 17:16:54 +00:00
|
|
|
</figure>
|
2000-06-07 16:49:38 +00:00
|
|
|
-->
|
1999-12-19 17:16:54 +00:00
|
|
|
</sect1>
|
1999-06-06 18:51:02 +00:00
|
|
|
|
|
|
|
</chapter>
|
|
|
|
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
|
|
Local variables:
|
|
|
|
mode: sgml
|
|
|
|
sgml-omittag:t
|
|
|
|
sgml-shorttag:t
|
|
|
|
sgml-minimize-attributes:nil
|
|
|
|
sgml-always-quote-attributes:t
|
|
|
|
sgml-indent-step:1
|
|
|
|
sgml-indent-data:t
|
|
|
|
sgml-parent-document:nil
|
1999-12-19 17:16:54 +00:00
|
|
|
sgml-default-dtd-file:"../../manual.ced"
|
1999-06-06 18:51:02 +00:00
|
|
|
sgml-exposed-tags:nil
|
|
|
|
sgml-local-catalogs:nil
|
|
|
|
sgml-local-ecat-files:nil
|
|
|
|
End:
|
2001-09-21 22:47:49 +00:00
|
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
|
|
vim: et tw=78 syn=sgml
|
|
|
|
vi: ts=1 sw=1
|
1999-06-06 18:51:02 +00:00
|
|
|
-->
|