Apress published on August 2007 a great book on PHP and oracle by W. Jason Gilmore, and Bob Bryla. The book, with its 763 pages and 40 chapters, include a full coverage on working with PHP and oracle from novice to professional as the book title indicates. Since I’m working everyday with PHP and Oracle, I spent more time than usual to finish reading the entire book – but I defintely enjoy it.
beginning-php-oracle.gif
Getting started with PHP
The first three chapters include an introduction to PHP from the programming language history, to the differences between different version of PHP 4,5 and 6, then the general language features, and why is it an excellent choice for Oracle database. Many Oracle developers don’t consider the choice of PHP as a good one, or still confused between using .Net, Java, PHP or other web solutions. Getting your hands on this book will defenitely answer a lot of questions, and you can see by yourself if developing PHP and Oracle web applications is suitable for your needs.
The Second chapter is about configuring your environment on Linux and Windows platform. So you have the choice here for working on your favorite envrionment and you can make it fit with the production server. The book provides very general directives to configure PHP and Apache. No mention of Oracle until here, not even the oracle and oci extensions, or the pdo for PHP5 and later. Oracle is introduced at the chapter 26, so you probably have to jump there if you want to have the entire environment ready. What’s interesting in chapter two is the recommendation for a code editor – I personaly use Notepad++ – and how to choose a hosting provider. Practical information that you need to know, especially for novice users.
In the Third chapter you will learn the PHP basics : how to create a basic web page, print dynamic content, PHP datatypes, strings, loop structures, file inclusion … etc. All the necessary small tips that you need to know to get started. This is probably the best part of the book for beginners, because it explains clearly the PHP language, and help to get started creating small scripts before moving into the development of large web applications with oracle.


PHP in depth
After getting started with PHP, ten other chapters dedicated for PHP only where you will have to learn from intermediate to advanced features of the scripting language. Ten chapters here are probably not too much because there is always a lot to learn in PHP, but I think the authors have choosen here the right words to describe these features in about two hundred pages.
Chapter Four introduce PHP functions from simple usage to recursive functions, brief and simple. Then arrays are introduced in chapter Five from the array structure, creating arrays, output of data from it, working with elements, search, traverse, sorting and others useful usage. Very indispensable to know and deserver an entire chapter to cover it.
From chapter Six we dig into advanced object oriented programming with PHP. First, it started with basic object oriented features in PHP but of course using the latest PHP5 object oriented model – no need to go back to the old PHP4 time since it is no longer supported anyway. There is an advanced coverage of object oriented programming in Matt Zandstra’s PHP 5 Objects, Patterns and Practice, mentionned in this book and which I’m currently reading also. But in this book you have the basics you need to start coding in object oriented style : encapsulation, inheritance, and polymorphism.
Chapter Seven introduce advanced OOP features from object cloning, inheritance, interfaces, and abstract classes. The book does not cover Namespaces, which available since PHP 5.3.0, and it is listed in the missing OOP features in PHP. From chapter Eight you will learn error and exception handling in PHP. Errors are human, and you will have to learn how to handle it. Exception is very handy in PHP programming and you will learn how to use it in many different and real situations.
Chapter Nine is about strings and regular expressions, two topics that goes very well together. I’ll write an entire book for regular expressions only, but here you have the very basics things you need to know. The same for others string-specefic functions to compare, determine the lenght … etc. You will find also how to convert special characters to their HTML equivalents. It is hard to cover strings with all encoding charsets available, but I think the most recommended to use is the UTF-8 : at the database level and in the web-based interfaces. This will avoid you any issue especially when working with middle eastern or asian charsets. PEAR is mentioned here briefly with the Validate_US package, which will help you to validate many US-based data such zip code, telephone numbers, SSN … etc. PEAR is covered with more details in chapter 11.
In chapter Ten we start using files and working with the operating system, you will start to learn here many useful advanced and powerful features in PHP that will be very helpful later to build a robust web application. Then is introduced the biggest PHP project named “PEAR”, a repository of great PHP libraries. Pear is also very known for its installer and packages management solution, this could be very helpful later if you are interested to have your own channel to install and update your PHP projects. The chapter cover essentially how to work with PEAR packages : install, upgrade, downgrade, uninstall… As usual, you get the basics here and you can read for the example “Foundation of PEAR” from Apress or the “PEAR installer manifesto” from Packt, if you are looking for more details.
Chapter Twelve introduce time and date functions in PHP, including validations and convertions. You can take advantage of PEAR also to create a monthly calendar. Chapter cover also date and time functions introduced since PHP 5.1.Then you will learn everything about Forms in chapter Thirteen from simple to advanced including working with the PEAR package HTML_QuickForm which support validations and auto-completion. Chapter Forteen dedicated for Authentication and include differents techniques that could be used in PHP, you can find how to authenticate a user against an Oracle database. Finally, the handling of File uploadsin chapter Fifteen, introduce php.ini directives for file uploads and utility functions to upload, move uploaded files and handle error messages. Another PEAR package is introduced here HTTP_Upload, which handle file uploading in PHP including the possibility to upload multiple files.
Advanced PHP programming
From Chapter Sixteen we start working with Advanced features in PHP begginning with Networking. The chapter cover most common networking tasks such DNS, services, servers, socket connections, sending email, ping, port scanner, subnet converter, and testing user bandwidth. Very basic but also very useful in my opinion. Next chapters are more advanced.
Chapter Seventeen is an introduction on using LDAP feature in PHP, how to connect to an LDAP server, retrieve data, insert, delete, update and most common task that you need to know for LDAP. One of the great feature in PHP which could make your PHP web application work in conjuction with directory servers, and this could be used in advanced web-based applications in enterprise.
Session are introduced in chapter Eighteen from configuration directives, working with session … Sessions are very useful in PHP applications and the chapter include also practical session-handling examples which help understanding the internal sessions mechanism and provides ideas for advanced implementations, especially for oracle-based sessions handlers.
Chapter Nineteen cover templating with Smarty, even if it’s not the speedy solution for PHP, but it’s very complete to get started. Then you will find an introduction to web services in chapter Twenty, but don’t be confused because RSS are not part of web services, and it was better if the chapter covered more SOAP and XML-RPC and the server-client concept. SimpleXML here is just an utility to parse XML used in web service communication, so probably also not the right place to introduce it.
Finally from chapter Twenty one to chapter Twenty Five, you’ll start with secure programming and how to make your PHP and PHP application secure. There is two great books that you need to get on PHP security if you want something really advanced. Then since we are talking here about Oracle, I don’t really see the utility to introduce SQLite, while I see the PDO section very small, even if it’s more important to know. The last two chapters talks about internationalization and PHP frameworks such Zend framework. Today many frameworks can make your life easier by providing ready to use enterprise solutions, that could help to make robust PHP applications in really no time.
In about 462 pages, the book introduced PHP from the very beginning, and seriously if you are Novice I think you will get tired before reaching the Oracle section, but in my opinion many sections are very important to know before you start using Oracle database. This book is a two in one, the first one is PHP from Novice to Professional, and the second one is Oracle from Novice to professional.
Getting started with Oracle
From chapter Twenty Six, authors introduced Oracle database and the Oracle’s database family. The Oracle XE version is used in the rest of the book. You can find installation procedure for both Windows and Linux, the configuration is very easy to do in both. But there is more thing to learn in OracleXE, especially with its very easy web-based management interface.
Chapter Twenty Eight explains in a very clear and simple way the Oracle architecture and how Oracle database works. Then you will find the most common task to administer the database and using the administration tools. You will find also a quick guide for troubleshooting in Oracle.
The Oracle XE client is covered separetely in chapter Twenty Nine, with interaction with Oracle Database XE. The chapter introduce to XE client installation and how to use the SQL developper and Oracle Application Express. Chapter Thirty goes more in details on creating PHP and Oracle web application from databases to datatypes. Very important to know how to create the right tables with the appropriate datatypes. It’s also very important to know oracle datatypes and its equivalent in PHP, in addition to indexes and sequences.
Then a very detailed chapter on securing your Oracle Database XE, this include users managements, authorization methods, and finally using database auditing to better monitor security and privileges against your database. You get until here all the necessary to get started with OracleXE as database, even that I find it very short compared to the very large introduction to the PHP scripting language. The next and final chapter will cover more PHP and Oracle programming.
Oracle and PHP programming
Now that you have OracleXE installed and working correctly with PHP, you have the basic and the advanced functionnality of PHP, you should be able to connect both and start coding advanced web applications. Chapter Thirty Two introduce to the basic methods to connect and execute SQL commands on OracleXE DB, and notice that only oci is used here, PDO have been used only in Chapter 23.
From the basic queries we goes to transactions in chapter Thirty Three, one of the powerful features in Oracle if you understand how to use it properly. This include commit, savepoint, and rollback functionnalities and how to use them with PHP. Next chapter introduce a very useful PEAR package HTML_TABLE and how to use it with Advanced queries. If you find writing viewer code complex in PHP, this package can make your life easier by giving ready to use solution to display your data from OracleXE.
Views are introduced in chapter Thirty Five with the basic functionnalities to create and manage views from OracleXE in addition to displaying data. Now if you want more advanced Oracle applications, it’s interesting to read very carefully the next three chapters which cover respectively programming with Oracle PL/SQL, triggers and optimizations techniques. The advantage with OracleXE is that triggers management is easier using the administration interface. Finally, understanding Oracle index types is very important to avoid slow queries in your web application. You will learn also how to monitor your index to determine where you need to optimize.
In the end, two very interesting chapters to complete your knowledge to OracleXE databases concerning import/export of data and backup/recovery of your database.
I think the Oracle section should be expanded more compared to the PHP one. The book could be very useful not only for Oracle and PHP developers, but also for anyone interested to learn from the very basics of the PHP scripting language. Definetly a must have book !
Beginning PHP and Oracle book on Apress or Buy beginning PHP and Oracle book from Amazon