Skip to Content
PHP Cookbook, 3rd Edition
book

PHP Cookbook, 3rd Edition

by David Sklar, Adam Trachtenberg
July 2014
Intermediate to advanced
820 pages
17h 6m
English
O'Reilly Media, Inc.
Content preview from PHP Cookbook, 3rd Edition

Chapter 21. Software Engineering

Introduction

Typing out the expressions that form your computer program is only the beginning of building a healthy software system. This chapter discusses what should happen after you’ve written your initial code—tools for debugging and testing your software.

Using a Debugger Extension explores the use of Xdebug, an open source PHP extension that allows for line-by-line debugging in real time.

Recipes , , and explore the world of unit testing in PHP, and show you how to turn your fixed bugs into a test suite that can help you ensure that once a bug is fixed, it stays fixed.

Setting Up a Test Environment introduces you to easy ways to set up a testing environment on your local computer, so that you can work in a sandbox environment without fear of breaking a production website while you’re trying to determine what’s gone wrong.

Lastly, Using the Built-in Web Server explores the built-in web server that’s part of PHP 5.4.0 and later.

Using a Debugger Extension

Problem

You want to debug your scripts interactively during runtime.

Solution

Use the Xdebug extension. When used along with an Xdebug-capable IDE, you can examine data structure; set breakpoints; and step into, out of, or over sections of code interactively.

Discussion

This recipe focuses on Xdebug’s interactive debugging capability. To follow along, you need to be able to compile and install a Zend extension, which means permissions to edit php.ini on your system. PHP’s dl() extension-loading function ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

PHP Cookbook, 2nd Edition

PHP Cookbook, 2nd Edition

Adam Trachtenberg, David Sklar
Programming PHP, 4th Edition

Programming PHP, 4th Edition

Kevin Tatroe, Peter MacIntyre
MySQL Cookbook, 4th Edition

MySQL Cookbook, 4th Edition

Sveta Smirnova, Alkin Tezuysal

Publisher Resources

ISBN: 9781449363741Errata