Learning PHP 7 High Performance
eBook - ePub

Learning PHP 7 High Performance

  1. 202 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Learning PHP 7 High Performance

Book details
Book preview
Table of contents
Citations

About This Book

Improve the performance of your PHP application to ensure the application users aren't left waiting

About This Book

  • Make the optimum use of PHP coding to improve your programming productivity
  • Leverage the potential of PHP for server-side programming, memory management, and object-oriented programming
  • Packed with real-life examples to help the readers implement concepts as they learn

Who This Book Is For

This book is for those who have basic experience in PHP programming. If you are developing performance-critical applications, then this book is for you.

What You Will Learn

  • Setup high performance development and production environment for PHP 7
  • Discover new OOP features in PHP 7 to achieve high performance
  • Improve your PHP applications' performance
  • Attain improved database performance
  • Benchmark PHP applications to optimize them
  • Write quality code by learning to improve code reusability, simplicity, and expressiveness
  • Get rid of the bottlenecks in your PHP 7 applications by writing PHP code optimally
  • Tackle issues related to web applications, such as high user dependency and large datasets

In Detail

PHP is a great language for building web applications. It is essentially a server-side scripting language that is also used for general-purpose programming. PHP 7 is the latest version, providing major backward-compatibility breaks and focusing on high performance and speed.

This fast-paced introduction to PHP 7 will improve your productivity and coding skills. The concepts covered will allow you, as a PHP programmer, to improve the performance standards of your applications. We will introduce you to the new features in PHP 7 and then will run through the concepts of object-oriented programming (OOP) in PHP 7. Next, we will shed some light on how to improve your PHP 7 applications' performance and database performance. Through this book, you will be able to improve the performance of your programs using the various benchmarking tools discussed.

At the end, the book discusses some best practices in PHP programming to help you improve the quality of your code.

Style and approach

The book is a step-by-step guide to improve the quality of your code in PHP through real-time examples. The book takes a practical approach to improving the quality of your code.

Frequently asked questions

Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes, you can access Learning PHP 7 High Performance by Altaf Hussain in PDF and/or ePUB format, as well as other popular books in Computer Science & Programming in PHP. We have over one million books available in our catalogue for you to explore.

Information

Year
2016
ISBN
9781785882265
Edition
1

Learning PHP 7 High Performance


Table of Contents

Learning PHP 7 High Performance
Credits
About the Author
Acknowledgement
About the Reviewer
www.PacktPub.com
eBooks, discount offers, and more
Why subscribe?
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Setting Up the Environment
Setting up Windows
Setting up Debian or Ubuntu
Debian
Ubuntu
Setting up CentOS
Installing NGINX
Installing PHP 7
Installing Percona Server
Setting up Vagrant
Summary
2. New Features in PHP 7
OOP features
Type hints
Scalar type hints
Return type hints
Namespaces and group use declaration
Non mixed group use declarations
Mixed group use declarations
The compound namespace declaration
The anonymous classes
Old-style constructor deprecation
The throwable interface
Error
New operators
The Spaceship operator (<=>)
The null coalesce operator(??)
Uniform variable syntax
Miscellaneous features and changes
Constant arrays
Multiple default cases in the switch statement
The options array for session_start function
Filtered unserialize function
Summary
3. Improving PHP 7 Application Performance
NGINX and Apache
Apache
NGINX
HTTP server optimization
Caching static files
Apache
NGINX
HTTP persistent connection
Apache
NGINX
GZIP compression
Apache
NGINX
Using PHP as a separate service
Disabling unused modules
Apache
NGINX
Web server resources
NGINX
Content Delivery Network (CDN)
Using CDN
CSS and JavaScript optimization
Merging
Minifying
Minify
Grunt
Full page caching
Varnish
The infrastructure
Web servers
The database server
Load balancer (LB)
HAProxy load balancing
HAProxy installation
HAProxy load balancing
Summary
4. Improving Database Performance
The MySQL database
Query caching
Storage engines
The MyISAM storage engine
The InnoDB storage engine
innodb_buffer_pool_size
innodb_buffer_pool_instances
innodb_log_file_size
The Percona Server - a fork of MySQL
Installing the Percona Server
MySQL performance monitoring tools
phpMyAdmin
The MySQL workbench
Percona Toolkit
pt-query-digest
pt-duplicate-key-checker
Percona XtraDB Cluster (PXC)
Redis – the key-value cache store
Connecting with the Redis server
Storing and fetching data from the Redis server
Redis management tools
Memcached key-value cache store
Summary
5. Debugging and Profiling
Xdebug
Debugging with Sublime Text
Debugging with Eclipse
Profiling with Xdebug
PHP DebugBar
Summary
6. Stress/Load Testing PHP Applications
Apache JMeter
ApacheBench (ab)
Siege
Load testing real-world applications
Magento 2
WordPress 4
Drupal 8
Summary
7. Best Practices in PHP Programming
Coding styles
Test-driven development (TDD)
Design patterns
Service-oriented architecture (SOA)
Being object-oriented and reusable always
PHP frameworks
Version control system (VCS) and Git
Deployment and Continuous Integration (CI)
Summary
A. Tools to Make Life Easy
Composer – A dependency manager for PHP
Composer installation
Using Composer
Git – A version control system
Git installation
Using Git
Creating new branches and merging
Cloning a repository
Webhooks
Desktop tools to manage repositories
Grunt watch
Summary
B. MVC and Frameworks
The MVC design pattern
Model
Views
Controllers
Laravel
Installation
Features
Routing
Eloquent ORM
Artisan CLI
Migrations
Blade templates
Other features
Lumen
Apigility
Summary
Index

Learning PHP 7 High Performance

Copyright © 2016 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: April 2016
Production reference: 1190416
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78588-226-5
www.packtpub.com

Credits

Author
Altaf Hussain
Reviewer
Raul Mesa Ros
Commissioning Editor
Kunal Parikh
Acquisition Editor
Vinay Argekar
Content Development Editor
Priyanka Mehta
Technical Editor
Ravikiran Pise
Copy Editor
Shruti Iyer
Project Coordinator
Izzat Contractor
Proofreader
Safis Editing
Indexer
Rekha Nair
Graphics
Abhinash Sahu
Production Coordinator
Manu Joseph
Cover Work
Manu Joseph

About the Author

Altaf Hussain is a fullstack web and mobile app developer with over 6 years of experience in PHP development. He received his degree in electrical engineering and specialized in computer and communications from Pakistan. Altaf is an electrical engineer on paper and a software engineer by heart.
He worked as a system programmer in his team, developing control software for small test robots using assembly languages and C. After this, Altaf got interested in web technologies and never looked back. He has worked with numerous PHP frameworks, including Zend, Laravel, and Yii, and open source systems such as Drupal, WordPress, PrestaShop, and Magento. Altaf designed and built two proprietary CMS systems with full support for multiple languages and models, permissions, and transla...

Table of contents

  1. Learning PHP 7 High Performance