You are previewing Building a Web Application with PHP and MariaDB: A Reference Guide.
O'Reilly logo
Building a Web Application with PHP and MariaDB: A Reference Guide

Book Description

Build fast, secure, and interactive web applications using this comprehensive guide

In Detail

Starting with a quick refresher of the PHP language and MariaDB database, readers will explore concepts such as unit testing, session authentication and management, permissions engine, caching, security, and performance optimization. Building a Web Application with PHP and MariaDB: A Reference Guide begins with basic and advanced programming techniques in both PHP and MariaDB, followed by specialized operations such as working with files and directories. Next, you will be introduced to the concept of REST, and how principles of REST are applied to host XML and JSON feeds for others to consume. This book will show readers how to build a web application that will be an online book store. This would leverage a logging system that keeps a track of the activity that is going on in the application.

This book will help a beginner to learn the basics of object-oriented programming with PHP and help a seasoned expert to understand the intricacies of securing and speeding up their web applications.

What You Will Learn

  • Grasp basic as well as advanced programming techniques with PHP and MariaDB
  • Perform CRUD operations, aggregations, filtering, and joins
  • Execute DDL operations and work with stored procedures, stored routines, and triggers
  • Employ concepts of object-oriented programming in PHP
  • Get acquainted with the latest features offered by PHP 5.4 and 5.5
  • Work with unit testing
  • Conduct file operations and logging with PHP
  • Implement authentication and ACLs
  • Improve performance optimization and security
  • Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at If you purchased this book elsewhere, you can visit and register to have the files e-mailed directly to you.

    Table of Contents

    1. Building a Web Application with PHP and MariaDB: A Reference Guide
      1. Table of Contents
      2. Building a Web Application with PHP and MariaDB: A Reference Guide
      3. Credits
      4. About the Author
      5. About the Reviewers
        1. Support files, eBooks, discount offers, and more
          1. Why subscribe?
          2. Free access for Packt account holders
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      8. 1. CRUD Operations, Sorting, Filtering, and Joins
        1. String datatypes
        2. Number datatypes
        3. Date datatypes
        4. The students table
          1. The courses table
          2. The students_courses table
        5. Inserting data
        6. Retrieving data
        7. Sorting data
        8. Filtering data
        9. Updating data
        10. Deleting data
        11. Joins
        12. Summary
      9. 2. Advanced Programming with MariaDB
        1. Enhancing the existing tables
        2. Working with stored procedures
        3. Working with stored routines
        4. Working with triggers
        5. Summary
      10. 3. Advanced Programming with PHP
        1. New features in PHP 5.4 and 5.5
          1. Updated array declaration
          2. The array dereferencing function
          3. The list() function in the foreach statement
          4. Availability of $this in closures
          5. Class member access on instantiation
          6. Generators
          7. Traits
          8. Addition of the finally block to exception handling
        2. Unit testing
          1. Installing PHPUnit
        3. Working with MariaDB
          1. PHP – mysqli
          2. PHP – PDO
        4. Summary
      11. 4. Setting Up Student Portal
        1. Setting up the nuts and bolts of our application
          1. Setting up URL rewrite
        2. Setting up MVC
        3. Adding a student
        4. Listing all students
        5. Adding a course
        6. Listing all courses
        7. Registering a student to a course
        8. Viewing all registrations
        9. Summary
      12. 5. Working with Files and Directories
        1. Data imports
        2. Data exports
        3. Logging
        4. Summary
      13. 6. Authentication and Access Control
        1. Authentication
        2. Access controls
        3. User roles
        4. Summary
      14. 7. Caching
        1. Introduction to caching
        2. Caching in the database
        3. Caching in the application
        4. Advanced caching techniques
        5. Summary
      15. 8. REST API
        1. What is REST?
        2. Generating XML feeds
        3. Generating JSON feeds
        4. Summary
      16. 9. Security
        1. Securing the Apache web server
          1. Hiding server information
          2. Server configuration limits
        2. Securing MariaDB
          1. Password-protected access
          2. Building views to restrict access
          3. Creating users and granting access
        3. Securing PHP
        4. Summary
      17. 10. Performance Optimization
        1. Performance optimization for the Apache web server
          1. Disabling unused modules
          2. Using compression
          3. Caching
        2. Performance optimization for MariaDB
          1. Best practices for data retrieval
          2. Understanding query execution
          3. Query optimization and indexing
        3. Performance optimization for PHP
        4. CDN, reverse proxy, and database replication
        5. Summary
      18. Index