• Complain

Rasmus Lerdorf - PHP Pocket Reference, 2nd Edition

Here you can read online Rasmus Lerdorf - PHP Pocket Reference, 2nd Edition full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2002, publisher: OReilly Media, genre: Computer. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

No cover
  • Book:
    PHP Pocket Reference, 2nd Edition
  • Author:
  • Publisher:
    OReilly Media
  • Genre:
  • Year:
    2002
  • Rating:
    4 / 5
  • Favourites:
    Add to favourites
  • Your mark:
    • 80
    • 1
    • 2
    • 3
    • 4
    • 5

PHP Pocket Reference, 2nd Edition: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "PHP Pocket Reference, 2nd Edition" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

Simple, to the point, and compact-in fact, exactly what youve come to expect in an OReilly Pocket Reference-the second edition of Php Pocket Reference is thoroughly updated to include the specifics of Php 4. Written by the founder of the Php Project, Rasmus Lerdorf, Php Pocket Reference is both a handy introduction to Php syntax and structure, and a quick reference to the vast array of functions provided by Php. The quick reference section organizes all the core functions of Php alphabetically so you can find what you need easily; the slim size means you can keep it handy beside your keyboard for those times when you want to look up a function quickly without closing what youre doing. This valuable little book provides an authoritative overview of Php packed into a pocket-sized guide thats easy to take anywhere. It is also the ideal companion for OReillys comprehensive book on Php, Programming Php. The Php Pocket Reference an indispensable (and inexpensive) tool for any serious Php coder.

Rasmus Lerdorf: author's other books


Who wrote PHP Pocket Reference, 2nd Edition? Find out the surname, the name of the author of the book and a list of all author's works by series.

PHP Pocket Reference, 2nd Edition — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "PHP Pocket Reference, 2nd Edition" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make
PHP Pocket Reference, 2nd Edition
Rasmus Lerdorf
Editor
Paula Ferguson

Copyright 2009 O'Reilly Media, Inc.

OReilly Media SPECIAL OFFER Upgrade this ebook with OReilly for more - photo 1

O'Reilly Media

SPECIAL OFFER: Upgrade this ebook with OReilly

for more information on this offer!

Please note that upgrade offers are not available from sample content.

Chapter 1. PHP Pocket Reference
Introduction

PHP (PHP Hypertext Preprocessor) is a web scripting language. It wasspecifically designed to solve "the webproblem." PHP is easy to learn because it builds onthe bits and pieces that most people already know. The pieces thatyou don't know are filled in by excellent onlinedocumentation and many high-quality books. This simple approach tosolving the web problem has caught on with an amazing number ofpeople.

This pocket reference further simplifies things by focusing on theabsolute essentials. It provides an overview of the main conceptsneeded for most web applications, followed by quick referencematerial for most of the main PHP functions.

Installation and Configuration

PHP works with many different web servers in many different ways, butby far the most popular way to run PHP is as an Apache module withApache 1.3.x. Full installation instructions for all the differentways to install PHP can be found in the PHP documentation. Here, Icover the Apache module installation.

If you are compiling from the PHP source tarball, follow theinstructions in the INSTALL file found insidethe PHP distribution file. A tarball is a compressed tar file. tar stands fortape archive, but these days it has little to do with tapes. It issimply a way to lump multiple files and directories into a singlefile for distribution. Normally tarballs have the .tar.gz extension to indicate a tar file compressed with gzip . To untar a tarball, use:

tar zxvf foo.tar.gz

On Windows, many utilities (including WinZip) understand tarballs.

If you are installing from a precompiled binary package such as an rpm file, most of the work should be done foryou. But doublecheck that the Apache configuration described below iscorrect.

When you are using PHP as an Apache module, PHP processing istriggered by a special MIME type. This is defined in the Apacheconfiguration file with a line similar to:

AddType application/x-httpd-php .php

This line tells Apache to treat all files that end with the .php extension as PHP files, which means thatany file with that extension is parsed for PHP tags. The actualextension is completely arbitrary and you are free to change it towhatever you wish to use.

If you are running PHP as a dynamic shared object (DSO) module, youalso need this line in your Apache configuration file:

LoadModule php4_module modules/libphp4.so

Note that in many default httpd.conf files youwill find AddModule lines. These reallyaren't necessary. They are only needed if you have aClearModuleList directive somewhere in your httpd.conf file. I would suggest simply deletingthe ClearModuleList directive and deleting allyour AddModule lines. The idea behindClearModuleList/AddModule is tomake it possible to reorder already loaded modules in case moduleorder is an issue. With most modules, the order that they areloaded -- which governs the order they are called -- is notimportant. And further, most binary distributions of Apache ship withmost modules compiled as dynamically loadable modules, which meansthat if order is an issue for some reason, you can simply change theorder of the LoadModule calls to fix it.

Don't forget to restart your server after makingchanges to your httpd.conf file. Once the serveris restarted, you can check to see if PHP is working by creating afile in your document root named info.php containing the single line:

Load this up in your browser using http://your.domain.com/info.php . You should seeall sorts of information about PHP. If you don't seeanything, try selecting "ViewSource" in your browser. If you see thephpinfo( ) line, you probably forgot (or mistyped)the AddType line in your httpd.conf file. If the browser tries todownload the file instead, it means that theAddType is there, but the PHP module is not beingtriggered -- perhaps because you forgot theLoadModule line.

Once you have verified that PHP is working, have a look at the PHPinitialization file called php.ini . Thephpinfo( ) page will tell you where PHP isexpecting to find it. PHP functions fine without this file, but withall the default settings. If you want to change the defaults, orperhaps more importantly, you want to be immune from any changes tothe defaults when you upgrade, you should create a php.ini file. The source distribution of PHPcomes with a php.ini-dist file that you canrename and copy into the location specified in the phpinfo() output. The php.ini file itself iswell-commented and self-explanatory for the most part.

You can also put configuration directives inside the Apache httpd.conf file, and, in certain cases, inindividual .htaccess files. This is very usefulfor setting things per-directory or per-virtual host. If you havethis line in the php.ini file:

include_path = ".:/usr/local/lib/php:.."

you can set this in your httpd.conf file with:

php_value include_path .:/usr/local/lib/php:..

There are four httpd.conf directives used forsetting PHP directives:

php_value

For setting normal strings and values

php_flag

For setting boolean values

php_admin_value

For setting administrative values

php_admin_flag

For setting boolean administrative values

In addition, the normal values and booleans can be set in your .htaccess files, but only if the ApacheAllowOverride setting (which sets what is allowedin a .htaccess file) includes"Options".

More information can be found at http://www.php.net/configuration.

Embedding PHP in HTML

You embed PHP code into a standard HTML page. For example,here's how you can dynamically generate the title ofan HTML document:

...

The portion of the documentis replaced by the contents of the $title PHPvariable. echo is a basic language statement thatyou can use to output data.

There are a few different ways to embed your PHP code. As you justsaw, you can put PHP code between and?> tags:

echo "Hello World"; ?>

This style is the most common way to embed PHP, but it is a problemif your PHP code needs to co-exist with XML, as XML may use thattagging style itself. If this is the case, turn off this style in the php.ini file with theshort_open_tag directive. Another way to embed PHPcode is within

This style is always available and is recommended when your PHP codeneeds to be portable to many different systems. Embedding PHP within tags is another style that isalways available:

echo "Hello World";

One final style, in which the code is between and %> tags, isdisabled by default:

You can turn on this style with the asp_tagsdirective in your php.ini file. The style ismost useful when you are using Microsoft FrontPage or another HTMLauthoring tool that prefers that tag style for HTML-embedded scripts.

Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «PHP Pocket Reference, 2nd Edition»

Look at similar books to PHP Pocket Reference, 2nd Edition. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «PHP Pocket Reference, 2nd Edition»

Discussion, reviews of the book PHP Pocket Reference, 2nd Edition and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.