Afilias IncPostgreSQL users, 576 AFTER trigger, PostgreSQL, 740, 741 aggregate functions, PostgreSQL, 724 aggregate functions, SQLite :alnum: character class, 194 :alpha: character class
Trang 1Copying Data to and from a Table
Copying data from a table to a text file or standard output is accomplished using the COPY
tablename TO {filename | STDOUT} variant of the COPY command The complete syntax follows: COPY tablename [(column [, ])]
TO {'filename' | STDOUT}
[[WITH]
[BINARY]
[OIDS]
[DELIMITER [AS] 'delimiter']
[NULL [AS] 'null string']
[CSV [HEADER]
[QUOTE [AS] 'quote']
[ESCAPE [AS] 'escape']
[FORCE NOT NULL column [, ]]
Copying data residing in a text file to a table or standard output is accomplished using the same syntax as that for copying from a table, except for three slight variations of the syntax These changes are bolded in the syntax that follows:
COPY tablename [(column [, ])]
FROM {'filename' | STDIN}
[[WITH]
[BINARY]
[OIDS]
[DELIMITER [AS] 'delimiter']
[NULL [AS] 'null string']
[CSV [HEADER]
[QUOTE [AS] 'quote']
[ESCAPE [AS] 'escape']
[FORCE QUOTE column [, ]]
As you can see, COPY has quite a bit to offer Perhaps the best way to understand its many capabilities is through several examples
Copying Data from a Table
To begin, let’s dump data from a table containing employee information to standard output:psql>COPY employee TO STDOUT;
This returns the following:
1 JG100011 Jason Gilmore jason@example.com
2 RT435234 Robert Treat rob@example.com
3 GS998909 Greg Sabino Mullane greg@example.com
4 MW777983 Matt Wade matt@example.com
Trang 2To redirect this output to a file, simply specify a filename, like so:
psql>COPY employee TO '/home/jason/sqldata/employee.sql';
Keep in mind that the PostgreSQL daemon user will require the necessary privileges for
writing to the specified directory Also, an absolute path is required, because COPY will not
accept relative pathnames
■ Note On Windows, forward slashes should be used to specify the absolute path So, for example, to COPY
data to PostgreSQL’s data directory, the path might look like c:/pgsql/data/employee.sql
Copying Data from a Text File
Copying data from a text file to a table is as simple as copying data to it Let’s begin by importing the
employee data dumped to employee.sql in the earlier example into an identical but newly
named and empty employee table:
psql>COPY employeenew FROM '/home/jason/sqldata/employee.sql';
Now, SELECT the data from employeenew and you’ll see the following output:
employeeid | employeecode | name | email
1 | JG100011 | Jason Gilmore | jason@example.com
2 | RT435234 | Robert Treat | rob@example.com
3 | GS998909 | Greg Sabino Mullane | greg@example.com
4 | MW777983 | Matt Wade | matt@example.com
(4 rows)
Note that an absolute path must be used to refer to the file Additionally, the PostgreSQL
daemon user must be capable of reading the target file Finally, keep in mind that COPY will not
attempt to perform any processing on the file to determine whether the data in each field can
legally be placed in a particular table column; rather, it will simply incrementally match each
field in the text file to the table column of the same offset
COPY FROM presumes each field is delimited by a predefined character string, which is by
default a tab (\t) for text files, and a comma for CSV files (see the later section “Working with
CSV Files”) Furthermore, each row is presumed to be delimited by a similar predefined string,
which is by default newline (\n) These predefined characters can be changed if necessary; see
the later section “Changing the Default Delimiter” for more information
Binary
This clause tells PostgreSQL to copy data using a custom format, resulting in a slight increase
in performance However, executing COPY FROM BINARY can only be used when the data was
previously written using COPY TO BINARY Furthermore, this has nothing to do with storing
data such as Word documents or images It’s merely a slightly more efficient way to copy large files
Trang 3Exporting the Table OIDs
If the target table was created with OIDs (object identifiers), you can specify that they are output along with the rest of the table data by using the OIDS clause For example:
psql>COPY employee TO STDOUT OIDS;
This produces:
24627 1 GM100011 Jason Gilmore jason@example.com
24628 2 RT435234 Robert Treat rob@example.com
24629 3 GS998909 Greg Sabino Mullane greg@example.com
24630 4 MW777983 Matt Wade matt@example.com
Changing the Default Delimiter
Note the apparent white space found in between each column in the previous example’s output This is actually a tab (\t), which is the default delimiter By using the DELIMITER clause, you can change the default to, for instance, a vertical pipe (|):
psql>COPY employee TO STDOUT DELIMITER '|';
This returns the preceding output (minus the OIDs) in the following format:
psql>COPY employeenew FROM '/home/jason/sqldata/employee.sql' DELIMITER |;
Copying Only Specific Columns
If you wanted to copy just the employees’ names and e-mail addresses to standard output, specify the column names like so:
psql>COPY employee (name,email) TO STDOUT;
This produces the following:
Jason Gilmore jason@example.com
Robert Treat rob@example.com
Greg Sabino Mullane greg@example.com
Matt Wade matt@example.com
Trang 4Likewise, if a text file contains only some of the fields to be inserted in a table, you can
specify them as was done previously Keep in mind, however, that the other table columns
need to either be nullable or possess default values
Dealing with Null Values
While e-mail is a crucial communications tool for individuals working in an office environment,
suppose some of the employees work solely in the warehouse, negating the need for e-mail
Therefore, some of the e-mail values in the employee table might be null When exporting data
using COPY, the default for null values is \N, and when using CSV mode (discussed later in this
section), it’s an empty string However, what if you want to declare a custom string for such
instances, no email for example? You should use the NULL clause, like so:
psql>COPY employee TO STDOUT NULL 'no email';
This produces output similar to this (presuming some of the employee e-mail addresses
have been set to null):
Jason Gilmore no email
Robert Treat rob@example.com
Greg Sabino Mullane greg@example.com
Matt Wade no email
Similarly, if you are importing data from a text file and a NULL value is specified, anytime
that value is located, the corresponding column will be nulled
Working with CSV Files
A comma-separated value (CSV) file is a format accepted by possibly every mainstream
rela-tional database in existence today, not to mention a wide variety of products such as Microsoft
Excel You can easily create a CSV file from a PostgreSQL table by using COPY accompanied by
the CSV clause For instance, to create a file capable of immediately being viewed in Microsoft
Excel or OpenOffice.org Calc, execute the following command:
psql>COPY employee (name, email) TO '/home/jason/sqldata/employee.csv' CSV HEADER;
Specifying the HEADER clause as indicated above causes the names of the retrieved columns
to be listed in the first row as column headers For example, executing this command and
opening the employee.csv file in Microsoft Excel produces output similar to that shown in
Figure 37-1
Figure 37-1 Viewing the employee.csv file in Microsoft Excel
Trang 5If you are reading a CSV file into a table using COPY FROM and the HEADER clause is declared, the first line will be ignored.
Some data may be delimited by single or double quotes, which have special significance within PostgreSQL, so you need to be aware of them to make sure they are properly accounted for You can use the QUOTE clause to specify this character, which by default is set to double quotes The specified quotation character can then be escaped using the character identified
by the ESCAPE clause, which also defaults to double quotes
If you’re exporting data from a table and use FORCE NOT NULL, it is presumed that no value
is null; if any null value is encountered, it will be inserted as an empty string
If you’re importing data into a table and use FORCE QUOTE, then all non-null values will be quoted, either using the default double quotes or whatever value is specified if the QUOTE clause
is declared
Calling COPY from a PHP Script
While the COPY command as described previously is useful for developers and database administrators, certainly a more intuitive solution is required for end users To satisfy this need, the pg_copy_from() and pg_copy_to() functions (introduced in Chapter 30) are made available via PHP’s PostgreSQL extension Both functions operate identically to the previously introduced COPY FROM and COPY TO commands, respectively, except that they’re also easily executable from within your Web application
In this section, we’ll consider a real-world example in which pg_copy_to() is used to copy data from a PostgreSQL table to a text file
Copying Data from a Table to a Text File
Suppose you want to create an interface that allows managers to create CSV files consisting of employee contact information These files are saved by date to a folder made available to a directory placed on a shared drive The code for doing so is found in Listing 37-1
Listing 37-1 Saving Employee Data to a CSV File (saveemployeedata.php)
<?php
$pg = pg_connect("host=localhost user=jason password=secret dbname=corporate")
or die("Could not connect to db server.");
// Copy the employee table data to an array
$array = pg_copy_to($pg, "employee", ",");
// Retrieve current date for file-naming purposes
$date = date("Ymd");
// Open the file
$fh = fopen("/home/reports/share/employees-$date.csv", "w");
Trang 6// Collapse the array to a newline-delimited set of rows
$contents = implode("\n", $array);
// Write $contents to the file
You can also easily add a header to the CSV file by writing a line to it before outputting the
array contents, like so:
fwrite($fh, "Employee ID,Name,Email\n");
Importing and Exporting Data with phpPgAdmin
If you’re looking for a convenient and powerful administration utility that is capable of being
accessed from anywhere you have a Web browser, phpPgAdmin (http://www.phppgadmin.net/) is
the most capable solution around First introduced in Chapter 27, phpPgAdmin is capable of
managing your database with ease, in addition to both importing and exporting data in a
variety of formats
■ Note At the time of writing, using this phpPgAdmin feature with Windows is not supported
To export data, navigate to the target table and click the Export link located in the top-right
corner of the page Doing so produces the interface found in Figure 37-2
Trang 7Figure 37-2 phpPgAdmin’s export interface
As you can see, you can export data in three ways:
• Only the table data: If you want to export only the data, you can do so in six different
formats, including COPY, CSV, SQL, Tabbed, XHTML, and XML
• Only the table structure: If you want to export just the table structure, then the table
creation SQL syntax is exported Checking the corresponding Drop checkbox causes table DROP commands to be inserted at the top of the output file so that any preexisting tables of the same name are dropped before being re-created
• Both the data and structure: If you want to export both the table structure and the table
data, you can choose to export it in both COPY and SQL formats Checking the sponding Drop checkbox causes table DROP commands to be inserted at the top of the output file so that any preexisting tables of the same name are dropped before being re-created
corre-Note that in all cases, you can either output the information to the browser or download it Choosing to download it saves the information in a file with the extension sql before prompting you to download it to your local computer
Importing data is accomplished by navigating to the target table and clicking the Import menu item Doing so produces the interface found in Figure 37-3
Figure 37-3 phpPgAdmin’s import interface
Imported files are accepted in four formats: Auto, CSV, Tabbed, and XML The purpose of each format should be obvious, except for perhaps Auto Selecting Auto causes phpPgAdmin to
Trang 8choose one of the other three formats by examining the file extension (valid extensions are
.csv, tab, and xml) Also, if any null characters are found in the file, you can specify whether
they appear using the sequence \N, the word NULL, or as an empty string
Summary
As you learned in this chapter, you have several options at your disposal for importing data into
and exporting data from your PostgreSQL database You can do it manually via the command
line or through scripting by using the COPY command Or, you can incorporate these features into
a Web application by using PHP’s pg_copy_to() and pg_copy_from() functions Alternatively, you
can rely on applications such as phpPgAdmin to facilitate the process
This concludes the book We hope you enjoyed reading it as much as we enjoyed the process
of writing it Good luck!
Trang 10using full-text indexes, PostgreSQL, 757
401 (Unauthorized access) message
hard coded authentication, 329
HTTP authentication, 325
sending to user, 327
404 (File not found) message, 321
■ A
A (IPv4 Address Record) record type, DNS, 360
A6 (IPv6 addresses) record type, DNS, 360
AAAA (IPv6 Address Record) record type,
DNS, 360abstract classes, OOP, 168–169
abstract classes or interfaces, 169
configuring Apache lookback feature, 316
access privilege system, PostgreSQL, 651–662
accessibility, 475
accessors, 140
getter (_get) method, 142
Account Domain/Name parameters
installing PostgreSQL, 586
ACID tests, transactions, 765
actor parameterSoapClient constructor, 503SoapServer constructor, 508addDays method, 294
addFunction methodcreating SOAP server, 509adding data
ldap_mod_add function, 416adding entries
ldap_add function, 416addition (+) operator, 71addl_headers parametermail function, 368addl_headers parameter, mail()sending e-mail with additional headers, 369addl_params parameter
mail function, 368addMonths method, 295Addresses optioninstalling PostgreSQL, 587addslashes function, 34AddType directiveinstalling PHP on Linux/Unix, 13installing PHP on Windows, 15addWeeks method, 296
addYears method, 297adl attribute, messages, 379administration
PostgreSQL, 593–610Administrator Account optioninstalling PostgreSQL, 587affectedRows function, PostgreSQL, 691
Trang 11Afilias Inc
PostgreSQL users, 576
AFTER trigger, PostgreSQL, 740, 741
aggregate functions, PostgreSQL, 724
aggregate functions, SQLite
:alnum: character class, 194
:alpha: character class, 194
ALTER DATABASE command, 627
ALTER DOMAIN command, 646
ALTER GROUP command, 659
ALTER SCHEMA command, 628
ALTER SEQUENCE command, 633
ALTER TABLE command, 632
ALTER TABLESPACE command, 602
ALTER TRIGGER command, 740
ALTER TYPE command, 645
ALTER USER command, 658
always_populate_raw_post_data
parameter, 36amortizationTable function, 97
ampersand (&)
converting special characters into
HTML, 212ANALYZE command, PostgreSQL, 603
autovacuum parameter, 604
running with VACUUM, 603AND (&&) operator, 73answered attribute, messages, 379, 383ANY record type, DNS, 360
Apachedownloading, 9–10Apache manual, 18binary distribution, 10selecting Apache version, 10source distribution, 10hiding configuration details, 520–521installing
on Linux/Unix, 11–13
on Windows, 13–16problems, 18scope of discussion, 11lookback feature, 314configuring, 315–316rewrite feature, 315SSL support, 10testing installation, 16–17APPDATA
storing configuration information in startup file, 616
Archive_Tar package, PEAR, 260arg_separator.input parameter, 33arg_separator.output parameter, 32arguments
see also parameters
default argument values, 94escapeshellarg function, 526optional arguments, 94passing arguments by reference, 93passing arguments by value, 92PL/pgSQL functions, 731register_argc_argv directive, 34arithmetic operators, 70
array data types, PHP, 52
Trang 12at end of array, 109
at front of array, 110increasing array length to specified size, 110
array pointers, 105associative keys, 104breaking array into smaller arrays, 130counting number of values in, 116counting occurrences of values in, 117creating, 106–108
from structured data, 107range of numerical values, 108described, 104
keys, 104locating array elements, 111–112manipulating, 124–129
appending arrays together, 125combining array of keys to array of values, 124
removing and returning section of array, 126
returning common key/value pairs in arrays, 127
Trang 13returning key/value pairs not common
to arrays, 128returning section of array, 125
returning values common to arrays, 127
returning values not common to
arrays, 128multidimensional arrays, 104
first element of array, 110
key element at current pointer, 113
key/value pair at current pointer, 113
last element of array, 110
last element of array, pointer to end, 114
next array value beyond current
pointer, 114random values, 129
to client, 498
value at current pointer, 113
value before current pointer, 114
reversing key/value roles, 116
reversing order of elements, 116
searching, 111–112
all elements, 201
for specific key, returning true/false, 112
for specific value, returning key, 112
for specific value, returning
true/false, 111setting array pointer to end of array, 114
setting array pointer to start of array, 113
single-dimensional arrays, 104sizing, 116–117
sorting, 118–124
by ASCII value, 118
by keys NOT values, 122
by user-defined function, 123case insensitive, 120
in another language, 118key/value associations maintained, 120key/value associations not
maintained, 119multidimensional arrays, 121natural number order maintained, 119numerically, 118
ordering elements from lowest to highest value, 118
reverse (descending) order, 120reverse order, by keys NOT values, 123reverse order, key/value associations maintained, 122
sqlite_array_query function, 543sqlite_fetch_array function, 541starting position zero, 104testing if variable is an array, 108–109traversing, 112–116
uniqueness, 118working with multivalued form components, 307
arsort array function, 122
AS ON event_typeCREATE RULE command, 709asort array function, 120
ASP style tags (<% %>)delimiting PHP code, 45asp_tags parameter, 22assign parameterinsert tag, Smarty, 463assignment operators, 71assoc_case directive, sqlite, 538
Trang 14attributes method, SimpleXML, 488
attributes parameter, ldap_search(), 404
attributes_only parameter, ldap_search(), 404
auditing, 7
Auth package, PEAR, 261
authenticating against Samba server, 266
Auth_HTTP class, PEAR
authenticating against PostgreSQL
database, 335–337authentication methodologies, PHP,
334–337installing, 334–335
validating user credentials with
Auth_HTTP, 335authentication
Auth_HTTP class, PEAR, 334–337
database based authentication, 331–332
file based authentication, 329–331
hard coded authentication, 328–329
PostgreSQL access privilege system, 652authentication variables, PHP, 327–328determining if properly set, 328PHP_AUTH_PW, 327
PHP_AUTH_USER, 327authentication, PHPheader function, 327isset function, 328authentication, PostgreSQLmethods of, pg_hba.conf file, 655pg_hba.conf file, 654
authenticationFile.txtfile based authentication, 329location for security, 329PHP script for parsing, 330authorization
PostgreSQL access privilege system, 652pg_class table, 656
auto login examplesession handling, 437–439auto_append_file parameter, 35auto_detect_line_endings parameter, 39auto_prepend parameter, 100
auto_prepend_file parameter, 35auto_start parameter, 429autoloading objects, OOP, 155–156_autoload function, 155
require_once statement, 155autovacuum parameter, PostgreSQL, 604avg function, PostgreSQL, 725
■ B
backtick operatorsystem level program execution, 257backup and recovery, PostgreSQL, 605–609Bakken, Stig, 259
Trang 15testing, 397–398
base exception class
see exception class
base_convert function, 240
baseclass
class inheritance, OOP, 162
basename function, 230
bccaddress attribute, messages, 379
BEFORE trigger, PostgreSQL, 740, 741, 742
BEGIN command
example PL/pgSQL function, 736
beginTransaction method, PDO, 571
begintransaction method, PHP, 772
BETWEEN operator, PostgreSQL, 720
BIGINT datatype, PostgreSQL, 637
BIGSERIAL datatype, PostgreSQL, 639
binary data, SQLite, 549–550
binary distribution, Apache
downloading, 10
BINARY keyword, COPY command
copying data to/from tables, 779
bindColumn method, PDO, 570
binding
ldap_bind function, 402
ldap_unbind function, 403
bindir option
installing PostgreSQL from source, 583
bindParam method, PDO, 564, 565
block file type, 232body (of message), 385, 386Boolean data type, PHP, 50BOOLEAN datatype, PostgreSQL, 640bound columns
setting, PDO, 570–571boxing client/serverSOAP client and server interaction, 511brackets([]), regular expressions, 193breadcrumb trails
creating from database table data, 319–321
creating from static data, 318–319navigational cues, 317–321navigational trail illustrated, 317break statement, PHP, 85
BSD licenselicensing PostgreSQL, 579buffering
sqlite_unbuffered_query function, 541buffers
output_buffering directive, 23shared_buffers setting, PostgreSQL, 596business logic
separating presentational logic from, 448bytea type, PostgreSQL, 635
bytes attribute, messages, 382
■ C
c command, psql, 614
c option, psql, 612
c psql command, 626C#
C# SOAP client, 513using C# client with PHP Web Service, 512–514
cache directoryinstalling Smarty, 451
Trang 16PostgreSQL, 598feeds, MagpieRSS, 485
Calendar package, PEAR, 285–288
classes, 286
creating monthly calendar, 286–288
date and time classes, 286
decorator classes, 286
installing, 285
isValid method, 288
tabular date classes, 286
validating dates and times, 288
manipulating string case, 208–209CASE function, PostgreSQL, 725case sensitive/insensitive functions
see under string function actions
case-insensitive searchPerl regular expression modifier, 199casing
PDO_ATTR_CASE attribute, 560casting, 54
ccaddress attribute, messages, 379c-client library, 373
CHAR datatype, PostgreSQL, 639char file type, 232
character casingPDO_ATTR_CASE attribute, 560character classes
predefined character ranges, 194character encoding
ldap_8859_to_t61 function, 420ldap_t61_to_8859 function, 421character entity references, 210character sets, 211
default_charset directive, 36characters
counts number of characters in string, 224htmlentities function, 527
localized formats, 280CHECK attributePostgreSQL datatypes, 640check constraint, columns, 640checkboxes
working with multivalued form components, 307
checkdate function, PHP, 272checkdnsrr function, 360–361checkpoint_segments setting, PostgreSQL, 599
Trang 17checkpoint_timeout setting, PostgreSQL, 599
checkpoint_warning setting, PostgreSQL, 599
chgrp function, 240
child class
class inheritance, OOP, 162
children method, SimpleXML, 489
chown function, 239
CIDR-ADDRESS field, pg_hba.conf file, 654
class constants, 143
class inheritance, OOP, 162
child class (subclass), 162
constructors and inheritance, 164–165
autoloading objects, OOP, 155
class_exists helper function, 153
see also objects, OOP
assigning data to class field, 140
characteristics and behaviors, 136
checking if class exists, 153
class constants, 143
generalized class creation syntax, 136
getting fields of class, 154
getting list of defined classes, 154
getting methods of class, 154
getting name of class, 153
getting parent class, 154
objects and classes, 136
retrieving a class variable, 142
static class members, 152–153
client authentication, PostgreSQLpg_hba.conf file, 654
Client errorfaultstring attribute, NuSOAP, 500clients
PDO_ATTR_CLIENT_VERSION attribute, 560
PostgreSQL, 611–623clone keyword, OOP, 158clone method, OOP, 160cloning
OOP object cloning, 158–161closedir function, 251
closelog function, 182clusters
databases and, 625CNAME record type, DNS, 360:cntrl: character class, 194COALESCE function, PostgreSQL, 726code
code reuse, 259getCode method, exception class, 186coding consistency
PDO features, 557columnCount method, PDO, 567columns
check constraint, 640copying specific columns, 780default values, 641
primary key values, 642setting bound columns, PDO, 570–571sqlite_column function, 543
sqlite_fetch_column_types function, 548sqlite_fetch_single function, 544
COM/DCOM support, 3comma separated values
see CSV
command line optionsPEAR package for reading, 260
Trang 18command not found message
installing PostgreSQL from source, 582
command-line interface, PostgreSQL, 611
COALESCE function, 726NULLIF function, 726conditional statements, PHP, 79–81alternative syntax, 80
else statement, 80
if statement, 79ifelse statement, 80switch statement, 81config_load functioncreating Smarty configuration files, 465configs directory
installing Smarty, 451configuration directives, PHP
see PHP configuration directives see also PHP configuration directives, list of
configuration file, Apacheinstallation problems, 18configuration files
installing Smarty, 451referencing configuration variables, 466Smarty templating engine, 465–466configuration options, LDAP, 418ldap_get_option function, 420ldap_set_option function, 420configuration options, PostgreSQLinstalling PostgreSQL from source, 583configurations
configuring PHP securely, 516–520changing document extension, 522configuration parameters, 518–520expose_php directive, 521
hiding configuration details, 520–522safe mode, 516–518
stopping phpinfo Calls, 522
Trang 19PDO (PHP Data Objects), 558
phpinfo function, 522
configure command
customizing PHP installation on Unix, 17
installing PostgreSQL from source, 582
connections, 669pg_close function, 671
ACID tests for transactions, 765Console_Getopt package, PEAR, 260running info command for, 265constants, OOP, 143
constants, PHP, 68CONSTRAINT keyword, 641constraints
check constraint, 640defining, 641domains, 645, 646foreign keys, 643PRIMARY KEY attribute, 642constructors
declaration syntax, 148default exception constructor, 185invoking parent constructors, 150invoking unrelated constructors, 150overloaded constructors, 185overloading, 151
PHP 4, 148constructors, OOP, 148–151inheritance and constructors, 164–165containers
container not mailbox, 376contexts
stream wrappers, 391continue statement, PHP, 86Contrib Modules
installing PostgreSQL, 588control structures, 78–89conditional statements, 79–81execution control statements, 78–79file inclusion statements, 86–89
Trang 20allowing/restricting URL rewriting, 428
changing cookie name, 429
Coordinated Universal Time, 271
COPY command, PostgreSQL, 777–783
BINARY keyword, 779
calling from PHP script, 782–783
COPY FROM command, 778
delimited fields, 779
COPY TO command, 778
copying data to/from tables, 778–782
changing default delimiter, 780
copying data from a table, 778
copying data from a text file, 779
copying data from table to text file, 782
copying specific columns, 780
dealing with NULL values, 781
exporting table OIDs, 780
working with CSV files, 781
copying data to/from tables, 778–782copying messages, 389
copying tables, 630pg_copy_from function, 684pg_copy_to function, 683PGSQL_COPY_IN value, 674PGSQL_COPY_OUT value, 674count array function, 116count function, PostgreSQL, 725count_chars function, 224count_words function, Smarty, 455CrackLib extension, PHP
avoiding easily guessable passwords, 340installation, 340
minimum password requirements, 340PECL web site, 340
using, 340–341using dictionaries, 341cracklib_dict.pwd dictionary, 341CREATE DATABASE command, 626CREATE DOMAIN command, 646CREATE FUNCTION command, 727CREATE GROUP command, 659CREATE INDEX command, 753CREATE RULE command, 709CREATE SCHEMA command, 627CREATE SEQUENCE command, 633CREATE TABLE statement, 629, 630CREATE TABLESPACE command, 601CREATE TRIGGER command, 739CREATE TYPE command, 644CREATE USER command, 658CREATE VIEW command, 707, 708create_crumbs function
Trang 21creating breadcrumbs from database table
data, 320creating breadcrumbs from static data,
318, 319create_dropdown function
autoselecting forms data, 310
generating forms with PHP, 308
createdb command-line tool, 626
credentials
ldap_bind function, 402, 403
cross-site scripting, 524
cryptType element
Auth_HTTP class, PEAR, 337
CSS (Cascading Style Sheets)
literal tag, Smarty, 464
Smarty configuration files and, 465
using with Smarty templating engine,
467–468CSV (comma-separated value) files, 246
copying data from table to text file, 782
copying data to/from tables, 781
curly bracket syntax
change in PHP 5, 192
currency
localized formats, 280
current array function, 113
current_date function, PostgreSQL, 724
current_time function, PostgreSQL, 724
current_timestamp function,
PostgreSQL, 724currval sequence function, 634
cursor_offset parameter
fetch method, PDO, 568
cursor_orientation parameter
fetch method, PDO, 568
custom error handlers
d option, psql, 612Daemon Account parameterinstalling PostgreSQL, 586data
copying data from table to text file, 782copying data to/from tables, 778–782hiding sensitive data, 522–523importing and exporting data, 777–785phpPgAdmin, 783–785
retrieving and displaying data, PostgreSQL, 678–681rows selected and rows modified, 681sanitizing user data, 524–528
data encryption, 528–532Auth_HTTP class, PEAR, 337MCrypt, 531
mcrypt_decrypt function, 532mcrypt_encrypt function, 531md5 function, 529
mhash function, 529, 530PHP 4 features, 3PHP’s encryption functions, 528data handling
deleting LDAP data, 417inserting LDAP data, 415ldap_add function, 416ldap_delete function, 418ldap_mod_add function, 416ldap_mod_del function, 418ldap_modify function, 417ldap_rename function, 417PHP configuration directives, 32streams, 390–393
updating LDAP data, 417data integrity, PostgreSQL, 574data retrieval, PDO, 567–570
Trang 22Data Source Name
table, 332authenticating using login pair and IP
address, 333database class
see PostgreSQL database class
Database Cluster option
applications accessing, 555check constraint, 640cluster of, 625connecting to, 626creating, 626default databases, 625default values, 641deleting, 626domains, 645–647foreign keys, 643indexes, PostgreSQL, 749–759migrating between, 260modifying, 627
primary keys, 642referential integrity, 643renaming, 627
searching, PostgreSQL, 759–764template databases, 625datadir option
installing PostgreSQL from source, 583datatypes, PostgreSQL, 635–640
attributes of, 635, 640–644CHECK, 640
DEFAULT, 641NOT NULL, 642NULL, 642PRIMARY KEY, 642REFERENCES, 643UNIQUE, 644BOOLEAN, 640bytea, 635composite types, 635, 644–645date and time datatypes, 636–637DATE, 636
INTERVAL, 637
Trang 23validators, 293date and time datatypes, PostgreSQL, 636–637
DATE, 636INTERVAL, 637TIME, 636TIMESTAMP, 637date and time functions, PHP, 272–278calculating dates, 284
determining days in current month, 283displaying localized date and time, 279–282
displaying web page modification date, 283
functionscheckdate, 272date, 272–275getdate, 275getlastmod, 283gettimeofday, 276mktime, 277
Trang 24setlocale, 279
strftime, 281–282
strtotime, 284
time, 278
date and time functions, PostgreSQL, 723, 724
date attribute, messages, 380, 383
date classes
Calendar package, PEAR, 286
DATE datatype, PostgreSQL, 636
date function, PHP, 272–275
determining days in current month, 283
format parameters, 273
date method, 290
date_format function, Smarty, 455
date_part function, PostgreSQL, 724
dates
Calendar package, PEAR, 285–288
localized formats, 280
prior to Unix epoch, 272
standardizing format for, 271
DB database abstraction layer, 556
debug_str property, NuSOAP, 502
debugging
getLastRequest method, SOAP, 505
getLastResponse method, SOAP, 505
Calendar package, PEAR, 286decrement ( ) operator, 72decryption
see data encryption
default argument values, 94DEFAULT attributePostgreSQL datatypes, 641default exception constructorbase exception class, 185default function, Smarty, 456default values
columns, 641domains, 646default_charset parameter, 36default_mimetype parameter, 35default_socket_timeout parameter, 39define function, 68
define_syslog_variables function, 181define_syslog_variables parameter, 39delete rules, PostgreSQL, 711
DELETE statementmaking views interactive, 711deleted attribute, messages, 380, 383deleting data, PostgreSQL, 685deleting entries/values, ldap, 418delim parameter, 683, 684DELIMITER clause COPY commandchanging default delimiter, 780delimiters
templating engines, 448delimiting PHP code, 43–46ASP style tags (<% %>), 45default syntax (<?php ?>), 44embedding multiple code blocks, 45script tag, 45
short tags, 44
Trang 25dependencies, PEAR packages
automatically installing dependencies, 267
failed dependencies, 266
deref parameter, ldap_search(), 405
design, web sites
CrackLib extension using, 341
die statement, PostgreSQL, 691, 692
:digit: character class, 195
dir file type, 232
directives
see PHP configuration directives
see also PHP configuration directives, list
ofdirectives, SQLite, 537–538
directories
see also LDAP
closing directory stream, 251
retrieving directory component of path, 230
retrieving directory name, 231
retrieving size, 237
returning array of files and directories, 252
returning directory elements, 251
max_fsm_pages setting, PostgreSQL, 597random_page_cost setting, PostgreSQL, 598disk_free_space function, 236
disk_total_space function, 236disks
identifying partition free/total space, 236display method, Smarty, 453
display_errors parameter, 30, 179display_startup_errors parameter, 30, 179displaying data, PostgreSQL, 678–681Distinguished Name
see DN
division (/) operator, 71
DN (Distinguished Name)aliases, LDAP, 419LDAP working with, 421ldap_dn2ufn function, 421ldap_explode_dn function, 421ldap_get_dn function, 410DNS (Domain Name System), 360–364checkdnsrr function, 360–361checking for existence of DNS records, 360dns_get_record function, 362–363DNS_ prefix for dns_get_record, 362getmxrr function, 363–364
getting DNS records, 362host information record, 362name server record, 362record types, 360, 362verifying existence of domain, 361verifying if domain name is taken, 361DNS_ALL record type, 362
DNS_ANY record type, 362dns_get_record function, 362–363
Trang 26DNS_HINFO record type, 362
DocumentRoot directive, Apache
hiding sensitive data, 523
DOM (Document Object Model)
Google Web Service, 494
DOUBLE PRECISION datatype, PostgreSQL,
638double quotes
determining available PDO drivers, 559DROP CASCADE command, 645, 647DROP DATABASE command, 626DROP DOMAIN command, 647DROP GROUP command, 660DROP RULE command, 709DROP SCHEMA command, 628DROP SEQUENCE command, 635DROP TABLE statement, 632DROP TABLESPACE command, 602DROP TRIGGER command, 741DROP TYPE command, 645DROP USER command, 658DROP VIEW command, 708dropdb command-line tool, 626DSN (Data Source Name)Auth_HTTP class, PEAR, 336DSN parameter
PDO constructor, 559
dt commandviewing tables, 631
du command, 237durabilityACID tests for transactions, 766dynamic extensions
PHP configuration directives, 39
■ E
e option, psql, 614E_XYZ levelsPHP error reporting levels, 30, 178each array function, 113
echo statement, PHP, 48effective_cache_size setting, PostgreSQL, 598else statement, Smarty, 458
else statement, PHP, 80
Trang 27ELSEIF/ELSIF options
PL/pgSQL functions, 732
e-mail, 367–372
see also mail function
Mail package, PEAR, 260
sending attachments, 371, 372
sending e-mail with additional
headers, 369sending HTML formatted e-mail, 370–371
sending plain text e-mail, 369
see data encryption
end array function, 114
$_ENV superglobal variable, 67envelope, messages, 386environment variablessafe_mode_allowed_env_vars directive, 518safe_mode_protected_env_vars
directive, 518equality operators, 73equals operator, PostgreSQL, 720ereg function, 195
ereg_replace function, 196eregi function, 196eregi_replace function, 197error handling
see also exception handling
configuration directives, 177–180custom error handlers, 321–323displaying errors, 179
displaying initialization errors, 179error logging, 180–183
LDAP, 422ldap_err2str function, 422ldap_errno function, 422ldap_error function, 423logging errors, 180ignoring repeated errors, 180limiting maximum length, 180storing most recent error message, 180logging errors in syslog, 180
NuSOAP, 500–501PDO (PHP Data Objects), 561–562PDO_ERRMODE_EXCEPTION, 560, 561PDO_ERRMODE_SILENT, 560, 561PDO_ERRMODE_WARNING, 560, 561PHP configuration directives, 29PHP error reporting levels, 178PL/pgSQL functions, 733–735notifying errors, 734trapping errors, 733
Trang 28error mode, setting, 562
error reporting levels, PHP, 30
error reporting modes, PDO
errorCode method, PDO, 562
ErrorDocument directive, Apache, 321
errorInfo method, PDO, 562
log_errors_max_len, 31track_errors, 31PGSQL_ERRORS_DEFAULT, 678PGSQL_ERRORS_TERSE, 678PGSQL_ERRORS_VERBOSE, 678PGSQL_FATAL_ERROR, 675PGSQL_NONFATAL_ERROR, 675retrieving error information, 562ESCAPE clause, COPY commandcopying data to/from tables, 782escape formats
short_open_tag directive, 22escape sequences, PHP, 76escape strings
sqlite_escape_string function, 549escapeshellarg function, 255, 526escapeshellcmd function, 255, 527exception class, 185
default exception constructor, 185extending, 187
getXyz methods, 186methods, 186overloaded constructor, 185EXCEPTION clause
PL/pgSQL functions, 733exception handling, 183–189
see also error handling
brief introduction, 177catching multiple exceptions, 187–189PHP 5 features, 4
PHP’s exception-handling, 185raising an exception, 186steps to implement, 184throwing an exception, 183value of, 183–185
Trang 29checking if file executable, 241
execute method, PDO, 564, 565
features of language, 4–7feeds
aggregating feeds, MagpieRSS, 483description, 476
parsing feeds, MagpieRSS, 479, 481popular aggregators, 476
publication of RSS feeds, 477rendering retrieved feed, MagpieRSS, 481–482
feof function, 242fetch method, PDO, 567choosing fetch() or fetchAll(), 569cursor_offset parameter, 568cursor_orientation parameter, 568fetch_style parameter, 567PDO_FETCH values, 567fetch statement, Smarty, 462fetch_style parameterPDO_FETCH values, 567fetchAll method, PDO, 568choosing fetch() or fetchAll(), 569fetchArray function, PostgreSQL, 691fetchColumn method, PDO, 569fetchfrom attribute, messages, 380fetchObject function, PostgreSQL, 691fetchRow function, PostgreSQL, 691fetchsubject attribute, messages, 380fgetc function, 245
fgetcsv function, 245fgets function, 246fgetss function, 247fieldName function, PostgreSQL, 696
Trang 30getting fields available to object, 154
getting fields of class, 154
fifo file type, 232
file based authentication, PHP, 329–331
identifying EOF reached, 242
moving file pointer, 249, 250
newline character, 242
opening files, 243
outputting data to file, 250
reading from files, 244–249
reading a single character, 245
reading into a string, 245
reading into an array, 244
stripping HTML and PHP tags, 247
resources, 242retrieving file pointer position, 250returning array of files and directories, 252setting access level, 243
file inclusion statements, PHP, 86–89include statement, 87
include_once function, 88require statement, 88require_once function, 89file ownership
effect of enabling safe mode, 516safe_mode restrictions, 516file pointers
moving file pointer, 249, 250retrieving current position, 250file uploads
HTTP, 345–346HTTP_Upload class, PEAR, 355–357file uploads, PHP, 346–355
caution: permissions, 352examples, 351–355first file upload example, 351–352listing uploaded files by date, 352–353working with multiple file uploads, 353–355
file upload functions, 349–350is_uploaded_file function, 349move_uploaded_file function, 350
$_FILES array, 348PHP configuration directives, 37UPLOAD_ERR_XYZ error messages, 350–351
upload/resource directives, 346–347file_uploads, 346
max_execution_time, 346memory_limit, 347post_max_size, 347upload_max_filesize, 347upload_tmp_dir, 347file_get_contents function, 245
Trang 31File_SMBPasswd package, PEAR, 266
checking if file executable, 241
checking if file readable, 241
checking if file writeable, 241
creating symbolic link, 235
cross-site scripting, 524
file deletion risk, 524
getFile method, exception class, 186
renaming, 253
retrieving file extension, 231
retrieving file name, 231
retrieving file type, 232
retrieving filename component of path, 230
retrieving group ID of owner, 240
retrieving information about, 233, 234
retrieving last access time, 238
retrieving last changed time, 238
retrieving last modification time, 239
retrieving permissions for, 240, 241
retrieving size of, 235
retrieving user ID of owner, 240
setting access level, 243
setting modification/access times, 253
upload_max_filesize directive, 38
$_FILES array
handling file uploads with PHP, 348
$_FILES superglobal variable, 66
Files directiveconfiguring Apache lookback feature, 315files storage option
storing session information, 427save_path directive, 428filesize function, 235
filetype function, 232filters
stream filters, 391, 393final fields, 140
final methods, 147Firebird, 558firewallssecuring PostgreSQL, 650flagged attribute, messages, 380, 383Flex lexical analysis generatorinstalling PHP on Linux/Unix, 12Flex package
installing PHP on Linux/Unix, 11flexibility, PDO, 557
FLOAT datatype, PostgreSQL, 638floating point numbers, PHP, 51flushing
implicit_flush directive, 24followup_to attribute, messages, 380footers
auto_append_file directive, 35fopen function, 243
fopen wrappersallow_url_fopen directive, 38PHP configuration directives, 38FOR loops
PL/pgSQL functions, 733for statement, PHP, 83FORCE clause, COPY commandcopying data to/from tables, 782force_extra_parameters directivemail function, 368
Trang 32ForceType directive
configuring Apache lookback feature, 315
foreach statement, Smarty, 458
foreach statement, PHP, 84
foreachelse statement, Smarty, 459
foreign keys, 643
forms
see web forms
forms-based searches, PostgreSQL, 759–764
fputs function, 250
fread function, 247
free space
identifying on disk partition, 236
FreeBSD operating system, 596
freespace map
max_fsm_pages setting, PostgreSQL, 597
max_fsm_relations setting, PostgreSQL,
597FreeTDS
PDO supported databases, 558
from attribute
foreach statement, Smarty, 458
from attribute, messages, 383
full-text indexes, PostgreSQL, 755–759
full-text search, PostgreSQL, 763
function model, LDAP, 400
helper functions, 153–155name evaluated before execution, 99nesting functions, 96
OOP functions and methods compared, 143passing form data to, 306
Perl regular expression syntax, 200–205PHP’s encryption functions, 528POSIX regular expression functions, 195–198
recursive functions, 63, 97returning values from functions, 95returning multiple values, 96sqlite_create_function function, 550value of, 91
variable functions, 99functions, PostgreSQLinternal functions, 723–727pg_affected_rows, 681pg_close, 671
pg_connect, 668pg_connection_busy, 672pg_connection_status, 673pg_convert, 683
pg_copy_from, 684pg_copy_to, 683pg_delete, 685pg_execute, 686pg_fetch_array, 678pg_fetch_assoc, 680pg_fetch_object, 680
Trang 33installing PostgreSQL from source, 582
$_GET superglobal variable, 65
GET method
passing data between scripts, 304
get_class helper function, 153
get_class_methods helper function, 154
get_class_vars helper function, 154
get_config_vars method, Smarty, 466
get_declared_classes helper function, 154
get_html_translation_table function, 212
get_object_vars helper function, 154
get_parent_class helper function, 154
getArray method, 291getAttribute method, PDO, 561getdate function, PHP, 275getDay method, 291getDayOfYear method, 298getFiles method
HTTP_Upload class, PEAR, 357getFunctions method, SOAP, 504getISOWeekOfYear method, 299getJuliaan method, 292
getlastmod function, PHP, 283getLastRequest method, SOAP, 505getLastResponse method, SOAP, 505getMonth method, 292
getmxrr function, 363–364getProp method
HTTP_Upload class, PEAR, 356getQuote function
creating SOAP server, 509boxing client, 511getRandQuote functionusing C# client with PHP Web Service, 512getResultAsTable method
PostgreSQL database class, 696, 698, 699getservbyname function, 364
getservbyport function, 364getter (_get) methodcreating custom getters and setters, 142properties, 142
gettimeofday function, PHP, 276gettype function, 57
getWeekday method, 298getWeekOfYear method, 299getXyz methods, exception class, 186getYear method, 293
GID (group ID)retrieving group ID of file owner, 240Global Development Group
PostgreSQL, 575
Trang 34installing PostgreSQL from source, 582
Google Web Service, 494
GRANT command
securing PostgreSQL, 660
:graph: character class, 195
greater than (>) operator, 74
PostgreSQL, 720
group IDs
safe_mode_gid directive, 517
groups
changing group membership of file, 240
retrieving group ID of file owner, 240
groups, PostgreSQL
adding groups, 659
amending users in groups, 659
deleting groups, 660
managing privileges for, 659
GUI-based clients, PostgreSQL, 620–623
see error handling
hard coded authentication, PHP, 328–329hash mark
referencing configuration variables, Smarty, 466
hash_bits_per_character directive, 432hash_function directive, 431
hashingmhash function, 529HEADER clause, COPY commandcopying data to/from tables, 781header function
authentication, PHP, 327headers
see also message headers
auto_prepend_file directive, 35headline function
using full-text indexes, PostgreSQL, 758headlines
limiting number displayed, MagpieRSS, 484help option, psql, 612
help option, SQLite, 536helper functions, 153–155class_exists, 153get_class, 153get_class_methods, 154get_class_vars, 154get_declared_classes, 154get_object_vars, 154get_parent_class, 154interface_exists, 154is_a, 155
is_subclass_of, 155method_exists, 155heredoc syntaxstring interpolation, 77hexadecimal characterspredefined character ranges, 195
Trang 35host connection type
securing PostgreSQL connections, 662
host parameter
pg_connect function, 668
hostaddr parameter
pg_connect function, 668
HOSTNAME, $_ENV superglobal, 67
hostnossl/hostssl connection types
securing PostgreSQL connections, 662
.htaccess file
managing configuration directives, 21
HTML
converting into plain text, 214
converting plain text into, 210–213
sending HTML formatted e-mail, 370–371
file uploads, 345–346HTTP 404 File not found message, 321HTTP authentication, 325–326safe_mode restrictions, 517HTTP proxy, NuSOAP, 493HTTP session handling, 425–446PHP 4 features, 3
HTTP_AUTHORIZATION variablePHP authentication and IIS, 327HTTP_REFERER, $_SERVER superglobal, 65http_response_code parameter,
header functionauthentication, PHP, 327HTTP_Upload class, PEARfile uploads, 355–357installing, 355languages (foreign) supported, 357moving uploaded file to final destination, 356–357
retrieving information about uploaded files, 355–356
retrieving value of single property, 356uploading multiple files, 357
HTTP_USER_AGENT, $_SERVER superglobal, 65
httpd.conf fileinstalling PHP on Linux/Unix, 13installing PHP on Windows, 14, 16managing configuration directives, 21httpd.conf file, Apache
denying access to some extensions, 523Hutteman, Luke, 477
Trang 36■ I
i command, psql, 614
IBM DB2, 558
id attribute, messages, 382
ident authentication method
pg_hba.conf file, PostgreSQL, 655
fsync setting, PostgreSQL, 598
ifid attribute, messages, 382
ignore_repeated_errors parameter, 31, 180
ignore_repeated_source parameter, 31, 180
ignore_user_abort parameter, 27
IIS
PHP authentication and IIS, 327
IMAP (Internet Message Access Protocol),
372–389composing messages, 386
establishing and closing connections, 375
mailbox administration, 388–389
mailboxes and messages, 375–378
message administration, 389
NNTP protocol, 372
opening and closing connections, 374
opening connections to IMAP
mailboxes, 374POP3 protocol, 372
purpose and advantages, 372
IMMUTABLE functionsuser defined functions, PostgreSQL, 728implements keyword
interfaces, OOP, 166implicit_flush parameter, 24implode function, 217importing data, 777–785phpPgAdmin, 783–785in_array array function, 111in_reply_to attribute, messages, 380include directory
c-client library confusion, 373include statement
function libraries, 100PHP, 87
Smarty templating engine, 462include_once function, PHP, 88include_path parameter, 36installing Smarty, 451include_php function, Smarty, 464
Trang 37inet type, PostgreSQL, 635
Infinity special value
numeric datatypes, 638
info command, PEAR, 265
information model, LDAP, 400
information schema, PostgreSQL, 687–688
managing configuration directives, 21initdb command
installing PostgreSQL on Linux, 584Initialize Database Cluster optioninstalling PostgreSQL, 587input
system level program execution, 254input/output functions
safe_mode restrictions, 516INSERT INTO commandswap meet project, 768insert rules, PostgreSQL, 710INSERT statement
making views interactive, 711mass inserts, 683
insert tag, Smarty, 463inserting data, PostgreSQL, 682–684mass inserts, 683–684
pg_copy_from function, 684pg_copy_to function, 683pg_insert function, 682Install as a Service parameterinstalling PostgreSQL, 586install command, PEAR, 266installations
Apache/PHP, 18MagpieRSS, 479NuSOAP, 493PDO (PHP Data Objects), 558PEAR, 262–264
PEAR packages, 266PL/pgSQL functions, 730PostgreSQL, 581–589
on Linux and Unix, 582–585
on Windows 2000/XP/2003, 585–589
on Windows 95/98/ME, 589
Trang 38Smarty templating engine, 450–452
INSTEAD form of a rule, 715
integer data type, PHP, 51
INTEGER datatype, PostgreSQL, 637
Interbase
PDO supported databases, 558
interface_exists helper function, 154
interfaces, OOP, 165–168
abstract classes or interfaces, 169
caution: class members not defined within
interfaces, 165checking if interface exists, 154
description, 157
general syntax for implementing, 166
implementing a single interface, 167
implementing multiple interfaces, 168
date and time functions, 723
further information on, 727
IP spoofing, 334IP-ADDRESS field, pg_hba.conf file, 654IP-MASK field, pg_hba.conf file, 654
is equal to (= =) operator, 73
is identical to (= = =) operator, 73
is not equal to (!=) operator, 73is_a helper function, 155is_array array function, 108is_cached method, Smarty, 469is_name function, 57
is_subclass_of helper function, 155is_uploaded_file function, PHP, 349ISAPI support, PHP 4, 3
isexecutable function, 241isLeap method, 293ISO 8601 specification, 299isolation
ACID tests for transactions, 766transaction isolation, 766isreadable function, 241isset function
authentication, PHP, 328isValid method
Calendar package, PEAR, 288Date and Time Library, 294HTTP_Upload class, PEAR, 357iswriteable function, 241
item attributeforeach statement, Smarty, 458
Trang 39pg_hba.conf file, PostgreSQL, 655
krsort array function, 123
ksort array function, 122
retrieving attributes, 407–410retrieving LDAP data, 404–405searching for LDAP data, 404–405sorting and comparing LDAP entries, 410–412
updating LDAP data, 417using from PHP, 401–423working with Distinguished Name, 421–422
working with entries, 412–415working with entry values, 405–406ldap_8859_to_t61 function, 420ldap_add function, 416ldap_bind function, 402ldap_close function, 403ldap_compare function, 411ldap_connect function, 401ldap_count_entries function, 407ldap_delete function, 418ldap_dn2ufn function, 421ldap_err2str function, 422ldap_errno function, 422ldap_error function, 423
Trang 40less than (<) operator, 74
less than operator, PostgreSQL, 720
using CSS in conjunction with Smarty, 467linkinfo function, 233
links
see also connections
creating hard link, 232creating symbolic link, 235link rot, 321
pageLinks function, 704pgsql.allow_persistent directive, 666pgsql.max_links directive, 667retrieving symbolic link information, 233retrieving target of symbolic link, 235Linux
downloading PHP, 10installing Apache/PHP on, 11–13installing PostgreSQL on, 582–585post-installation steps, 583–585list array function, 107
returning multiple values, 96list function, PHP
sqlite_fetch_array function, 542listen_address, postgresql.conf filesecuring PostgreSQL, 651literal tag
Smarty templating engine, 464using CSS in conjunction with Smarty, 467local variables
variable scope, PHP, 60