Wednesday, January 30, 2013

9 of the Best Free PHP Books

Learning the PHP: Hypertext Preprocessor (PHP) programming language from scratch can be an arduous affair. Fortunately, budding developers that want to code in this language have a good range of introductory texts available to read, both in-print and to download. There are also many quality books that help programmers that have reached an intermediate level deepen their understanding of the language.
PHP has been at the helm of the web for many years. It is an extremely popular, interpreted scripting language that is ideally suited for web development. This language powers millions of web sites on the net and is extremely well supported by its user community. It is released under a non-copyleft free software license / open source license. PHP can be deployed on most Web servers and also as a standalone shell on almost all operating systems and platforms.
The word "Preprocessor" means that PHP makes changes before the HTML page is created. The code is executed on the server, generating HTML which is then sent to the client. PHP therefore enables a static webpage to become dynamic. The language is dynamically typed and easy to use. PHP comes with many extensions offering all kinds of functionality from system operations to numerical processing. One of the reasons why PHP is so popular is that it is simple to learn for a newcomer to the language, but provides advanced features for professional developers. Other reasons for its popularity include its embedded relationship with HTML, it provides a good mix of performance and flexibility to developers, has a relatively shallow learning curve, easy to debug and good performance.
The focus of this article is to select some of the finest PHP books which are available to download for free. Many of the books featured here can also be freely distributed to others.
To cater for all tastes, we have chosen a good range of books, encompassing general introductions to PHP, as well as books that will help you to effectively use the many advanced features of PHP. All of the texts here come with our strongest recommendation. So get reading (and downloading).
1. PHP Cookbook
PHP Cookbook
Author David Sklar, Adam Trachtenberg
Format HTML
Pages 632
The PHP Cookbook is a collection of problems, solutions, and practical examples for PHP programmers. The book contains a unique and extensive collection of best practices for everyday PHP programming dilemmas. It contains over 250 recipes, ranging from simple tasks to entire programs that demonstrate complex tasks, such as printing HTML tables and generating bar charts -- a treasure trove of useful code for PHP programmers, from novices to advanced practitioners.
Chapters cover:
  • Strings - PHP strings differ from C strings in that they are binary-safe (i.e., they can contain null bytes) and can grow and shrink on demand
  • Numbers - integers and floating-point numbers
  • Dates and Times - looks at the mktime, date functions
  • Arrays - lists: lists of people, lists of sizes, lists of books. To store a group of related items in a variable, use an array
  • Variables - they are the core of what makes computer programs powerful and flexible
  • Functions - help you create organized and reusable code
  • Classes and Objects - a class is a package containing two things: data and methods to access and modify that data; Objects play another role in PHP outside their traditional OO position
  • Web Basics - focuses on some web-specific concepts and organizational topics that will make your web programming stronger
  • Forms - seamless integration of form variables into your programs. It makes web programming smooth and simple, from web form to PHP code to HTML output
  • Database Access - PHP can interact with 17 different databases, some relational and some not. The relational databases it can talk to are DB++, FrontBase, Informix, Interbase, Ingres II, Microsoft SQL Server, mSQL, MySQL, Oracle, Ovrimos SQL Server, PostgreSQL, SESAM, and Sybase. The nonrelational databases it can talk to are dBase, filePro, HyperWave, and the DBM family of flat-file databases. It also has ODBC support
  • Web Automation - there are four ways to retrieve a remote URL in PHP
  • XML - with the help of a few extensions, PHP lets you read and write XML for every occasion
  • Regular Expressions - a powerful tool for matching and manipulating text
  • Encryption and Security - including obscuring data with encoding, verifying data with hashes, encrypting and decrypting data, and more
  • Graphics - with the assistance of the GD library, you can use PHP to create applications that use dynamic images to display stock quotes, reveal poll results, monitor system performance, and even create games
  • Internationalization and Localization - PHP can create applications that speak just about any language
  • Internet Services - covers sending mail including MIME mail, reading mail with IMAP or POP3, posting and reading messages to Usenet newsgroups, getting and putting files with FTP, looking up addresses with LDAP, using LDAP for user authentication, performing DNS lookups, checking if a host is alive, and getting information about a domain name
  • Files - PHP's interface for file I/O is similar to C's, although less complicated
  • Directories - PHP provides two ways to look in a directory to see what files it holds. The first way is to use opendir( ) to get a directory handle, readdir( ) to iterate through the files, and closedir( ) to close the directory handle. The second method is to use the directory class. Instantiate the class with dir( ), read each filename with the read( ) method, and close the directory with close( )
  • Client-Side PHP
  • PEAR - the PHP Extension and Application Repository, a collection of open source classes that work together. Developers can use PEAR classes to generate HTML, make SOAP requests, send MIME mail, and a variety of other common tasks
2. PHP 5 Power Programming
PHP 5 Power Programming
Author Andi Gutmans, Stig Saether Bakken and Derick Rethans
Format PDF
Pages 720
In PHP 5 Power Programming, PHP 5's co-creator and two leading PHP developers show you how to make the most of PHP 5's industrial-strength enhancements in any project, no matter how large or complex.
Their unique insights and realistic examples illuminate PHP 5's new object model, powerful design patterns, improved XML Web services support, and much more. Whether you are creating web applications, extensions, packages, or shell scripts, or migrating PHP 4 code, here are high-powered solutions you will not find anywhere else.
Review PHP's syntax and master its object-oriented capabilities, from properties and methods to polymorphism, interfaces, and reflection.
The book enables users to:
  • Master the four most important design patterns for PHP development
  • Write powerful web applications: handle input, cookies, session extension, and more
  • Integrate with MySQL, SQLite, and other database engines
  • Provide efficient error handling that is transparent to your users
  • Leverage PHP 5's improved XML support including parsing, XSLT conversions, and more
  • Build XML-based web services with XML-RPC and SOAP
  • Make the most of PEAR: work with the repository, use key packages, and create your own
  • Upgrade PHP 4 code to PHP 5, compatibility issues, techniques, and practical workarounds
  • Improve script performance: tips and tools for PHP optimization
  • Use PHP extensions to handle files/streams, regular expressions, dates/times, and graphics
  • Create original extensions and shell scripts
3. PHP Reference: Beginner to Intermediate PHP5
PHP Reference Book
Author Mario Lurig
Format PDF, ePub, HTML
Pages 163
PHP Reference Book: Beginner to Intermediate PHP5 is a collection of over 250 PHP functions with clear explanations in language anyone can understand, followed with as many examples as it takes to understand what the function does and how it works. One of the best PHP books to keep around as a PHP reference.
This PHP reference includes numerous additional tips, the basics of PHP, MySQL query examples, regular expressions syntax, and two indexes to help you find information faster: a common language index and a function index.
Topics include:
  • Operators
  • Control Structures
  • Global Variables
  • Variable Functions
  • String Functions
  • Array Functions
  • Date/Time Functions
  • Mathematical Functions
  • MySQL Functions
  • Directory & File System Functions
  • Output Control (Output Buffer)
  • Sessions
  • Regular Expressions
This book is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 2.0 License.

4. The Underground PHP and Oracle Manual
The Underground PHP and Oracle Manual
Author Christopher Jones, Alison Holloway, and many contributors
Format PDF
Pages 362
The Underground PHP and Oracle Manual is written for PHP programmers developing applications for the Oracle Database. It shows programmers how to use PHP with Oracle, and provides the fundamental building blocks needed to create high-performance PHP Oracle Web applications.
Topics covered:
  • Getting Started With PHP - provides a very brief overview of the PHP language
  • PHP Oracle Extensions - covers OCI8 (PHP's main Oracle extension) and PDO_OCI driver for the PHP Data Object extension
  • Installing Oracle Database 11g Express Edition - contains an overview of, and installation instructions for, Oracle Database 11g Express Edition for Linux and Windows
  • SQL with Oracle Database - contains an overview of some SQL*Plus, Oracle Application Express and Oracle SQL Developer features you can use to perform database development
  • Netbeans IDE for PHP - gives a high level overview of the NetBeans IDE - this provides tools to make PHP development productive and effective
  • Installing Apache HTTP Server - gives you the steps needed to install and configure the Apache HTTP Server for use with PHP
  • Installing and Configuring PHP - discusses the main ways of installing PHP on Linux and Windows
  • Installing PHP and Apache on Oracle Solaris 11.1
  • Connecting to Oracle Using OCI8 - covers connecting to an Oracle database from your PHP application, showing the forms of Oracle connection and how to tune them
  • Executing SQL Statements With OCI8 - discusses using SQL statements with the PHP OCI8 extension. It covers statement execution, the OCI8 functions available, handling transactions, tuning queries, and some useful tips and tricks
  • Using PL/SQL with OCI8 - PL/SQL is Oracle’s procedural language extension to SQL
  • Using Large Objects in OCI8 - Oracle Character Large Object (CLOB) and Binary Large Object (BLOB) types can be used for very large amounts of data. They can be used for table columns and as PL/SQL variables
  • Using XML with Oracle and PHP - covers the basics of using XML data with Oracle and PHP. It also shows how to access data over HTTP directly from the database
  • PHP Connection Pooling and High Availability - discusses connection pooling and how it applies to connection management
  • PHP and TimesTen In-Memory Database - TimesTen is an in-memory database that can be used standalone or as a cache to Oracle database
  • PHP and Oracle Tuxedo - shows using Oracle Tuxedo 11.1 with PHP applications running under Apache. HTTP requests are forwarded from Apache to mod_tuxedo which then invokes the PHP script engine. Oracle Tuxedo is a transaction oriented application server which can be used for developing and deploying applications written in PHP, Python and Ruby, as well as in the traditional languages C, C++, and COBOL
  • Globalization - discusses global application development in a PHP and Oracle Database environment. It addresses the basic tasks associated with developing and deploying global Internet applications, including developing locale awareness, constructing HTML content in the user-preferred language, and presenting data following the cultural conventions of the locale of the user
  • Testing PHP and the OCI8 Extension - discusses running the PHP test suite on Linux. The PHP source code includes command-line tests for all the core functionality and extensions
The book has been updated for Oracle Database Express Edition 11g Release 2. It is not a complete PHP syntax or Oracle SQL guide.
5. Symfony - The Book
Symfony - The Book
Author SensioLabs
Format PDF
Pages 242
Symfony is a web application framework written in PHP that follows the model–view–controller (MVC) paradigm.
Topics covered include:
  • Symfony2 and HTTP Fundamentals
  • Symfony2 versus Flat PHP
  • Installing and Configuring Symfony
  • Creating Pages in Symfony2 - create a route, create a controller
  • Controller - a PHP function you create that takes information from the HTTP request and constructs and returns an HTTP response
  • Routing - the Symfony2 router lets you define creative URLs that you map to different areas of your application
  • Creating and using Templates - learn how to write powerful templates that can be used to return content to the user, populate email bodies, and more
  • Databases and Doctrine - learn the basic philosophy behind Doctrine and see how easy working with a database can be. Doctrine is a library whose sole goal is to give you powerful tools to make this easy
  • Databases and Propel - Propel is a free, open-source (MIT) object-relational mapping toolkit written in PHP
  • Testing - integrates with an independent library - called PHPUnit - to give a rich testing framework
  • Validation - Symfony2 ships with a Validator component that makes this task easy and transparent. This component is based on the JSR303 Bean Validation specification
  • Forms - build a complex form from the ground-up, learning the most important features of the form library along the way
  • Security - Symfony's security component is available as a standalone PHP library for use inside any PHP project
  • HTTP Cache - The Symfony2 cache system relies on the simplicity and power of the HTTP cache as defined in the HTTP specification
  • Translations - learn how to prepare an application to support multiple locales and then how to create translations for multiple locales
  • Service Container - this chapter is about a special PHP object in Symfony2 that helps you instantiate, organize and retrieve the many objects of your application
  • Performance - explore many of the most common and powerful ways to make your Symfony application even faster
  • Internals - an in-depth explanation of the Symfony2 internals
  • The Symfony2 Stable API - a subset of all Symfony2 published public methods (components and core bundles)
This book is licensed under the Attribution-Share Alike 3.0 Unported license.
6. PHP Essentials
PHP Essentials
Author Neil Smyth
Format HTML
Pages -
This online e-book covers all aspects of PHP programming. It begins with a brief history of PHP, then gives an overview of PHP, and why it is so useful to web programmers. Subsequent chapters cover all areas of PHP in detail: the basics of the language, file and filesystem handling, object oriented programming, MySQL and SQLite database access, handling of HTML forms, using cookies and PHP sessions. All chapters are accompanied by real world examples.
Topics include:
  • The History of PHP
  • An Overview of PHP - a high level look at PHP and provide a basic understanding of what it is, what is does and how it does it
  • Creating a Simple PHP Script - construct the most basic of PHP examples, and in so doing the author takes two approaches to creating PHP powered web content: embedding PHP into an HTML page, and embed the HTML into the PHP
  • Commenting PHP Code - involves writing notes alongside the code to describe what the code does and how it works
  • An Introduction to PHP Variables - covers naming and creating a variable in PHP, assigning a value to a PHP variable, accessing PHP variable values, changing the type of a PHP variable, and checking whether a variable is set
  • Understanding PHP Variable Types - looks at the PHP integer, string, float and boolean variable types
  • PHP Constants - the opposite of a variable in that once it has been defined it cannot be changed
  • PHP Operators - enable us to perform tasks on variables and values such as assign, multiply, add, subtract and concatenate them
  • PHP Flow Control and Looping - explores conditional statements, looping statements, and switch statements and creates some examples that show how to implement these mechanisms
  • PHP Functions
  • PHP Arrays - provides a way to group together many variables such that they can be referenced and manipulated using a single variable
  • Working with Strings and Text in PHP - explores a number of the functions and techniques provided by PHP to enable you, as a web developer, to perform tasks such as changing the case of a string, replacing one part of a piece of text with another piece of text, searching text and much more
  • PHP, Filesystems and File I/O - covers all aspects of interacting with files and the filesystem
  • Working with Directories in PHP - work with file system directories
  • An Overview of HTML Forms - provides a basic grounding of HTML forms before moving on to the more PHP specific areas of building a form
  • PHP and HTML Forms - create a simple HTML form to gather information from the user and then create a PHP script to process that data once it has been submitted to the server
  • PHP and Cookies - Creating, Reading and Writing - looks at the use of cookies to maintain state, and the use of PHP sessions as an alternative to the use of cookies. It also provides an overview of the difference between cookies and PHP sessions
  • Understanding PHP Sessions - explores the concept of PHP sessions in more detail and provide some examples of how to create and use sessions
  • PHP Object Oriented Programming - introduces the basic concepts involved in object oriented programming and explains the concept as it relates to PHP development
  • Using PHP with MySQL - how to access information stored in a MySQL database from a PHP script and present that data to a user's web browser
  • PHP and SQLite - SQLite is an embedded database that is bundled with PHP starting with PHP 5 and implements a large subset of the SQL 92 standard
7. Practical PHP Programming
Author Paul Hudson
Format HTML
Pages -
Practical PHP Programming is a concise, starting resource for individuals that want to learn PHP programming. It assumes no PHP programming at all.
The book contains lots of information for newcomers as well as information on advanced functionality in PHP for veterans. It includes information on advanced features such as IMAP, XML and Sockets, as well as tips and tricks on how to program effectively in PHP.
Topics covered include:
  • Simple variables and operators
    • Types of data that is availabe
    • References, typecasting, and variable variables
    • Script variables, pre-set-variables, script contstants, and pre-set constants
    • Operators such as plus, minus, multiply, and divide
  • Functions:
    • Working with date and time
    • Mathematical functions
    • String manipulation
    • Creating data hashes
    • Regular expressions
    • Extension handling
    • Writing your own functions
    • Recursive, variable, and callback functions
  • Arrays:
    • Reading arrays
    • Manipulating arrays
    • Multidimensional arrays (arrays of arrays)
    • Saving arrays
  • Objects:
    • Objects and classes defined
    • Class inheritance
    • Access control
    • Runtime type information
    • Abstract and final properties and functions
    • Constructors and destructors
    • Magic functions
  • HTML Forms
    • Form design using HTML
    • Sending and receiving form data with PHP
    • Splitting forms across pages
    • Validating input
  • Files:
    • Reading and writing files
    • Temporary files
    • How to make a counter
    • Handling file uploads
    • File permissions
  • Databases:
    • What makes a database
    • What databases are available
    • SQL commands using MySQL
    • Connecting to MySQL through PHP
    • Using PEAR::DB for database abstraction
    • SQLite for systems without a database system
    • Normalisation and table joins
    • Table design considerations
    • Persistent connections and transactions
  • Cookies and Sessions:
    • How cookies and sessions compare
    • Which to use and when
    • How to use sessions
    • Using a database to store your sessions
    • Storing complex objects
  • Multimedia:
    • The multimedia formats that are available and their advantages
    • Creating basic image formats
    • Working with the rich-text format (RTF)
    • Creating portable document format (PDF) files
    • Working with the Shockwave Flash (SWF) format
  • XML & XSLT:
    • Standard XML manipulation
    • "SimpleXML" - the fast and easy way to use XML
    • XSL and transforming XML
  • Output Buffering:
    • When to use output buffering
    • Manipulating multiple buffers
    • Incremental data flushing
    • Output compression
  • Java and COM:
    • How to use COM
    • Finding out what components you have installed
    • Advanced COM - controlling Internet Explorer, and even writing VBScript
    • Distributed COM: COM over a network
    • Running Java in your scripts
    • Creating interfaces with Swing
  • Networks:
    • What sockets are, and basic socket use
    • How to use sockets outside of HTTP
    • How to create a basic server using PHP
    • Creating a web server
    • Helpful network-related functions
    • HTTP-specific and FTP-specific functions
    • The Curl library
  • Miscellaneous topics
  • Security concerns: 
    • Why register_globals matters
    • How to program secure PHP
    • Considerations for people who host others' web sites
    • Safe mode PHP
    • Encryption, simple and advanced
  • Performance:
    • Increasing performance by optimising your scripts
    • Increasing performance by optimising your SQL
    • Increasing performance by optimising your server
    • Caching PHP scripts
    • PHP the CGI vs. PHP the Apache module
  • Writing PHP:
    • How to analyse your system requirements
    • Using a development tool to help you code
    • File layout schemes and group development
    • Documentation and testing
    • Distribution your code and licensing your work
    • How to debug your scripts
    • Troubleshooting hints and tips
    • Where to get help if you still have a problem
  • Writing extensions: 
    • When to write a custom extension
    • How to design, create, and test your extension
  • Alternative PHP uses: 
    • How to use PHP to write shell scripts
    • How the CLI SAPI differs from "normal" PHP
    • Interacting with the dialog program to create command-line user interfaces
    • Using GTK+ to create graphical user interfaces
    • Using Glade to automatically generate GTK+ GUIs
    • Making text-based games with PHP
    • Making graphical games with PHP and SDL
    • Creating your own miniature language with PHP
  • Practical PHP
  • Bringing it to a close
  • Answers to Exercises
  • The future of PHP
8. Zend Framework: Surviving the Deep End
Zend Framework: Surviving the Deep End
Author Pádraic Brady
Format HTML
Pages -
Zend Framework: Surviving The Deep End is written in the form of a detailed tutorial following a step by step approach to building a real life application.
The book walks you through the process of building a complete Web application with the Zend Framework, starting with the basics and then adding in more complex elements, such as data pagination and sorting, user authentication, exception handling, localization, and Web services. Debugging and performance optimization are also covered in this fast-paced tutorial.
The book was written to guide readers through the metaphorical "Deep End". It is the place you find yourself in when you complete a few tutorials and scan through the Reference Guide, where you are buried in knowledge up to your neck but without a clue about how to bind it all together effectively into an application. This take on the Zend Framework offers a survival guide, boosting your understanding of the framework and how it all fits together by following the development of a single application from start to finish.
Topics include:
  • The Architecture of Zend Framework Applications
  • The Model
  • Installing the Zend Framework
  • A Not So Simple Hello World Tutorial
  • Standardise the Bootstrap Class with Zend_Application
  • Handling Application Errors
  • Developing a Blogging Application
  • Inplementing the Domain Model: Entries and Authors
  • Setting the Design with Zend_View, Zend_Layout, HTML 5 and Yahoo! User Interface Library
The text of this book is licensed under a Creative Commons Attribution-Non-Commercial-No Derivative Works 3.0.
9. Practical PHP Testing
Practical PHP Testing
Author Giorgio Sironi
Format PDF
Pages 61
Practical PHP Testing is targeted at PHP developers. It features articles published on the author's blog site, together with new content. The book includes code samples and TDD exercises.
Topics covered include:
  • PHPUnit usage - a unit testing software framework for the programming language PHP
  • Write clever tests
  • Assertions - declarations that must hold true for a test to be declared successful
  • Fixtures - write the code to set the world up in a known state and then return it to its original state when the test is complete
  • Annotations - a standard way to add metadata to code entities, such as classes or methods
  • Refactoring and Patterns - changing of complex and complicated programming codes into simple and confusion-less ones
  • Stubs - a piece of code used to stand in for some other programming functionality
  • Mocks -used in behavior verification
  • Command line options
  • The TDD theory - describes the fundamentals of Test-Driven Development and its benefits
  • Testing sqrt() - the PHP sqrt() function calculates the square root mathematical function on its argument
The ebook is licensed under a Creative Commons Attribution Noncommercial-Share Alike 3.0 License.       


  1. Amazing , thanks a lot for all the info you provided on Php books even I am not a programmer but I have this C language subject this session and have to prepare for it. What all topics should be covered in it?
    And has anyone studied from this course of C tutorial online?? or tell me any other guidance...
    would really appreciate help

  2. awesome post thanks to sharing this informative post.