1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- EN-Revision: 1.24 Maintainer: perugini Status: ready -->
<chapter id="introduction">
<title>Introduction</title>
<sect1 id="intro-whatis">
<title>Che cosa il PHP?</title>
<para>
PHP (acronimo ricorsivo per "PHP: Hypertext Preprocessor") un linguaggio
open-source di scripting lato server immerso nel HTML.
</para>
<para>
Risposta banale, ma che cosa significa? Un esempio:
</para>
<para>
<example>
<title>Un esempio introduttivo</title>
<programlisting role="php">
<![CDATA[
<html>
<head>
<title>Esempio</title>
</head>
<body>
<?php
echo "Ciao, sono uno script PHP!";
?>
</body>
</html>
]]>
</programlisting>
</example>
</para>
<para>
Notate come questo esempio differente da uno script scritto
in altri linguaggi tipo Perl o C -- invece di scrivere un programma
con parecchi comandi per produrre HTML, si scrive in HTML con qualche
comando immerso per ottenere dei risultati (in questo semplice esempio,
la visualizzazione di una frase). Il codice PHP delimitato da speciali
<link linkend="language.basic-syntax.phpmode">start ed end tag</link>
che ne indicano l'inizio e la fine e che consentono di passare dal modo HTML al modo PHP.
</para>
<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
way that users can tell what you have up your sleeve.
</para>
<para>
The best things in using PHP are that it is extremely simple
for a newcomer, but offers many advanced features for
a professional programmer. Don't be afraid reading the long
list of PHP's features. You can jump in, in a short time, and
start writing simple scripts in a few hours.
</para>
<para>
Although PHP's development is focused on server-side scripting,
you can do much more with it. Read on, and see more in the
<link linkend="intro-whatcando">What can PHP do?</link> section.
</para>
</sect1>
<sect1 id="intro-whatcando">
<title>What can PHP do?</title>
<para>
Anything. PHP is mainly focused on 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. But PHP can do much more.
</para>
<para>
There are three main fields where PHP scripts are used.
<itemizedlist>
<listitem>
<simpara>
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 webserver and a web browser. You need to
run the webserver, with a connected PHP installation.
You can access the PHP program output with a web browser,
viewing the PHP page through the server. See the
<link linkend="installation">installation instructions</link>
section for more information.
</simpara>
</listitem>
<listitem>
<simpara>
Command line scripting. You can make a PHP script
to run it without any server and any browser.
You only need the PHP parser to use it this way.
This type of usage is ideal for scripts regularly
executed using cron (task sheduler on Windows),
or simple text processing tasks. See the section about
<link linkend="commandline">Command line usage
of PHP</link> for more information.
</simpara>
</listitem>
<listitem>
<simpara>
Writing client-side GUI applications. PHP is probably
not the very best language to write windowing
applications, 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, visit <ulink url="&url.php.gtk;">it's
own website</ulink>.
</simpara>
</listitem>
</itemizedlist>
</para>
<para>
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, Microsoft Internet Information Server,
Personal Web Server, Netscape and iPlanet servers, Oreilly
Website Pro server, Caudium, Xitami, OmniHTTPd, and many
others. For the majority of the servers PHP has a module,
for the others supporting the CGI standard, PHP can work
as a CGI processor.
</para>
<para>
So with PHP, you have the freedom of choosing an operating
system and a web server. Furthermore, you also have the choice
of using procedural programming or object oriented
programming, or a mixture of them. Although not every
standard OOP feature is realized in the current version
of PHP, many code libraries and large applications (including the
PEAR library) are written only
using OOP code.
</para>
<para>
With PHP you are not limited to output HTML. PHP's abilities
includes outputing images, PDF files and even Flash movies
(using libswf and Ming) generated on the fly. You can also
output easily any text, such as XHTML and any other XML file.
PHP can autogenerate these files, and save them in the file
system, instead of printing it out, forming a server-side
cache for your dynamic content.
</para>
<para>
One of 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>
<simplelist columns="3">
<member>Adabas D</member>
<member>dBase</member>
<member>Empress</member>
<member>FilePro (read-only)</member>
<member>Hyperwave</member>
<member>IBM DB2</member>
<member>Informix</member>
<member>Ingres</member>
<member>InterBase</member>
<member>FrontBase</member>
<member>mSQL</member>
<member>Direct MS-SQL</member>
<member>MySQL</member>
<member>ODBC</member>
<member>Oracle (OCI7 and OCI8)</member>
<member>Ovrimos</member>
<member>PostgreSQL</member>
<member>Solid</member>
<member>Sybase</member>
<member>Velocis</member>
<member>Unix dbm</member>
</simplelist>
</blockquote>
We also have a DBX database abstraction extension allowing you
to transparently use any database supported by that extension.
Additionally PHP supports ODBC, the Open Database Connection
standard, so you can connect to any other database supporting
this world standard.
</para>
<para>
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. You can also use our CORBA extension to
access remote objects.
</para>
<para>
PHP has extremely useful text processing features, from the
POSIX Extended or Perl regular expressions to parsing XML
documents. For parsing and accessing XML documents, we
support the SAX and DOM standards. You can use our XSLT
extension to transform XML documents.
</para>
<para>
While using PHP in the ecommerce field, you'll find
the Cybercash payment, CyberMUT, Verysign Payflow
Pro and CCVS functions useful for your online payment
programs.
</para>
<para>
At last but not least, we have many other interesting
extensions, the mnoGoSearch search engine functions,
the IRC Gateway functions, many compression utilities
(gzip, bz2), calendar conversion, translation...
</para>
<para>
As you can see this page is not enough to list all
the features and benefits PHP can offer. Read on in
the sections about <link linkend="installation">installing
PHP</link>, and see the <link linkend="funcref">function
reference</link> part for explanation of the extensions
mentioned here.
</para>
</sect1>
<sect1 id="intro-history">
<title>A brief history of PHP</title>
<simpara>
PHP was conceived sometime in the fall of 1994 by &link.rasmus;.
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>
<simpara>
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
3. A lot of the utility code from PHP/FI was ported over to PHP 3
and a lot of it was completely rewritten.
</simpara>
<simpara>
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>
(see also <ulink url="&url.netcraft-survey;">Netcraft Web Server
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
slightly more sites than run Microsoft's IIS server on the Internet
(5.03 million).
</simpara>
<!--
<figure>
<title>NetCraft Webserver Survey</title>
<graphic fileref="&url.php.stats;"/>
</figure>
-->
</sect1>
</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
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
|