chapters/intro.xml
77f5f3b3a8bbe1ad7727201c7603d1419dd7840f
77f5f3b3a8bbe1ad7727201c7603d1419dd7840f
...
...
@@ -1,13 +1,16 @@
1
1
<?xml version="1.0" encoding="utf-8"?>
2
2
<!-- $Revision$ -->
3
3
<chapter xml:id="introduction" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
4
-
<info><title>Introduction</title></info>
4
+
<info>
5
+
<titleabbrev>Introduction</titleabbrev>
6
+
<title>What is PHP and what can it do?</title>
7
+
</info>
5
8
6
-
<section xml:id="intro-whatis">
9
+
<section xml:id="intro-whatis" annotations="chunk:false">
7
10
<info><title>What is PHP?</title></info>
8
11
<para>
9
-
<acronym>PHP</acronym> (recursive acronym for <literal>PHP: Hypertext
10
-
Preprocessor</literal>) is a widely-used open source general-purpose
12
+
<acronym>PHP</acronym> (recursive acronym for <emphasis>PHP: Hypertext
13
+
Preprocessor</emphasis>) is a widely-used open source general-purpose
11
14
scripting language that is especially suited for web
12
15
development and can be embedded into HTML.
13
16
</para>
...
...
@@ -19,8 +22,7 @@
19
22
<info><title>An introductory example</title></info>
20
23
<programlisting role="php">
21
24
<![CDATA[
22
-
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
23
-
"http://www.w3.org/TR/html4/loose.dtd">
25
+
<!DOCTYPE html>
24
26
<html>
25
27
<head>
26
28
<title>Example</title>
...
...
@@ -40,58 +42,55 @@
40
42
<para>
41
43
Instead of lots of commands to output HTML (as seen in C or Perl),
42
44
PHP pages contain HTML with embedded code that does
43
-
"something" (in this case, output "Hi, I'm a PHP script!").
45
+
<replaceable>something</replaceable> (in this case, output <computeroutput>Hi, I'm a PHP script!</computeroutput>).
44
46
The PHP code is enclosed in special <link
45
47
linkend="language.basic-syntax.phpmode">start and end processing
46
48
instructions <code><?php</code> and <code>?></code></link>
47
-
that allow you to jump into and out of "PHP mode."
49
+
that allow jumping in and out of <quote>PHP mode.</quote>
48
50
</para>
49
51
<para>
50
52
What distinguishes PHP from something like client-side JavaScript
51
53
is that the code is executed on the server, generating HTML which
52
54
is then sent to the client. The client would receive
53
55
the results of running that script, but would not know
54
-
what the underlying code was. You can even configure your web server
55
-
to process all your HTML files with PHP, and then there's really no
56
-
way that users can tell what you have up your sleeve.
56
+
what the underlying code was. A web server can even be configured
57
+
to process all HTML files with PHP, and then there's no
58
+
way that users can tell that PHP is being used.
57
59
</para>
58
60
<para>
59
-
The best things in using PHP are that it is extremely simple
61
+
The best part about using PHP is that it is extremely simple
60
62
for a newcomer, but offers many advanced features for
61
-
a professional programmer. Don't be afraid reading the long
62
-
list of PHP's features. You can jump in, in a short time, and
63
-
start writing simple scripts in a few hours.
63
+
a professional programmer. Don't be afraid to read the long
64
+
list of PHP's features. With PHP, almost anyone can get up and running and be
65
+
writing simple scripts in no time at all.
64
66
</para>
65
67
<para>
66
68
Although PHP's development is focused on server-side scripting,
67
-
you can do much more with it. Read on, and see more in the
69
+
much more can be done with it. Read on, and see more in the
68
70
<link linkend="intro-whatcando">What can PHP do?</link> section,
69
71
or go right to the <link linkend="tutorial">introductory
70
-
tutorial</link> if you are only interested in web programming.
72
+
tutorial</link> to jump straight to learning about web programming.
71
73
</para>
72
74
</section>
73
75
74
-
<section xml:id="intro-whatcando">
76
+
<section xml:id="intro-whatcando" annotations="chunk:false">
75
77
<info><title>What can PHP do?</title></info>
76
78
<para>
77
79
Anything. PHP is mainly focused on server-side scripting,
78
-
so you can do anything any other CGI program can do, such
80
+
so it can do anything any other CGI program can do, such
79
81
as collect form data, generate dynamic page content, or
80
82
send and receive cookies. But PHP can do much more.
81
83
</para>
82
84
<para>
83
-
There are three main areas where PHP scripts are used.
85
+
There are two main areas where PHP scripts are used.
84
86
<itemizedlist>
85
87
<listitem>
86
88
<simpara>
87
-
Server-side scripting. This is the most traditional
88
-
and main target field for PHP. You need three things
89
-
to make this work. The PHP parser (CGI or server
90
-
module), a web server and a web browser. You need to
91
-
run the web server, with a connected PHP installation.
92
-
You can access the PHP program output with a web browser,
93
-
viewing the PHP page through the server. All these can
94
-
run on your home machine if you are just experimenting
89
+
Server-side scripting. This is the most widely used
90
+
and main target field for PHP. Three things are needed
91
+
to make this work: the PHP parser (CGI or server
92
+
module), a web server, and a web browser. All these can
93
+
run on a local machine in order to just experiment
95
94
with PHP programming. See the
96
95
<link linkend="install">installation instructions</link>
97
96
section for more information.
...
...
@@ -99,57 +98,41 @@
99
98
</listitem>
100
99
<listitem>
101
100
<simpara>
102
-
Command line scripting. You can make a PHP script
103
-
to run it without any server or browser.
104
-
You only need the PHP parser to use it this way.
101
+
Command line scripting. A PHP script can be run
102
+
without any server or browser, only the
103
+
PHP parser is needed to use it this way.
105
104
This type of usage is ideal for scripts regularly
106
-
executed using cron (on *nix or Linux) or Task Scheduler (on
105
+
executed using <command>cron</command> (on Unix or macOS) or Task Scheduler (on
107
106
Windows). These scripts can also be used for simple text
108
107
processing tasks. See the section about
109
108
<link linkend="features.commandline">Command line usage of PHP</link>
110
109
for more information.
111
110
</simpara>
112
111
</listitem>
113
-
<listitem>
114
-
<simpara>
115
-
Writing desktop applications. PHP is probably
116
-
not the very best language to create a desktop
117
-
application with a graphical user interface, but if
118
-
you know PHP very well, and would like to use some
119
-
advanced PHP features in your client-side applications
120
-
you can also use PHP-GTK to write such programs. You also
121
-
have the ability to write cross-platform applications this
122
-
way. PHP-GTK is an extension to PHP, not available in
123
-
the main distribution. If you are interested
124
-
in PHP-GTK, visit <link xlink:href="&url.php.gtk;">its
125
-
own website</link>.
126
-
</simpara>
127
-
</listitem>
128
112
</itemizedlist>
129
113
</para>
130
114
<para>
131
115
PHP can be <link linkend="install">used</link> on all major operating systems, including
132
116
Linux, many Unix variants (including HP-UX, Solaris and OpenBSD),
133
-
Microsoft Windows, Mac OS X, RISC OS, and probably others.
134
-
PHP has also support for most of the web servers today. This
117
+
Microsoft Windows, macOS, RISC OS, and probably others.
118
+
PHP also has support for most of the web servers today. This
135
119
includes Apache, IIS, and many others. And this includes any
136
120
web server that can utilize the FastCGI PHP binary, like lighttpd
137
121
and nginx. PHP works as either a module, or as a CGI processor.
138
122
</para>
139
123
<para>
140
-
So with PHP, you have the freedom of choosing an operating
141
-
system and a web server. Furthermore, you also have the choice
142
-
of using procedural programming or object oriented
124
+
So with PHP, developers have the freedom of choosing an operating
125
+
system and a web server. Furthermore, they also have the choice
126
+
of using procedural programming or object-oriented
143
127
programming (OOP), or a mixture of them both.
144
128
</para>
145
129
<para>
146
-
With PHP you are not limited to output HTML. PHP's abilities
147
-
includes outputting images, PDF files and even Flash movies
148
-
(using libswf and Ming) generated on the fly. You can also
149
-
output easily any text, such as XHTML and any other XML file.
150
-
PHP can autogenerate these files, and save them in the file
151
-
system, instead of printing it out, forming a server-side
152
-
cache for your dynamic content.
130
+
PHP is not limited to outputting HTML. PHP's abilities include
131
+
outputting rich file types, such as images or PDF files, encrypting data,
132
+
and sending emails. It can also output easily any text, such as JSON
133
+
or XML. PHP can autogenerate these files, and save them in the
134
+
file system, instead of printing it out, forming a server-side cache for
135
+
dynamic content.
153
136
</para>
154
137
<para>
155
138
One of the strongest and most significant features in PHP is its
...
...
@@ -165,7 +148,7 @@
165
148
<para>
166
149
PHP also has support for talking to other services using protocols
167
150
such as LDAP, IMAP, SNMP, NNTP, POP3, HTTP, COM (on Windows) and
168
-
countless others. You can also open raw network sockets and
151
+
countless others. It can also open raw network sockets and
169
152
interact using any other protocol. PHP has support for the WDDX
170
153
complex data exchange between virtually all Web programming
171
154
languages. Talking about interconnection, PHP has support for
...
...
@@ -183,11 +166,11 @@
183
166
<para>
184
167
And many other interesting extensions exist, which are categorized both
185
168
<link linkend="extensions">alphabetically</link> and by <link linkend="funcref">category</link>.
186
-
And there are additional PECL extensions that may or may not be documented
169
+
And there are additional <link linkend="install.pecl.intro">PECL extensions</link> that may or may not be documented
187
170
within the PHP manual itself, like <link xlink:href="&url.xdebug;">XDebug</link>.
188
171
</para>
189
172
<para>
190
-
As you can see this page is not enough to list all
173
+
This page is not enough to list all
191
174
the features and benefits PHP can offer. Read on in
192
175
the sections about <link linkend="install">installing
193
176
PHP</link>, and see the <link linkend="funcref">function
194
177