Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Building a Web Application with PHP and MariaDB: A Reference Guide

You're reading from   Building a Web Application with PHP and MariaDB: A Reference Guide Build fast, secure, and interactive web applications using this comprehensive guide

Arrow left icon
Product type Paperback
Published in Jun 2014
Publisher
ISBN-13 9781783981625
Length 200 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Sai S Sriparasa Sai S Sriparasa
Author Profile Icon Sai S Sriparasa
Sai S Sriparasa
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. CRUD Operations, Sorting, Filtering, and Joins 2. Advanced Programming with MariaDB FREE CHAPTER 3. Advanced Programming with PHP 4. Setting Up Student Portal 5. Working with Files and Directories 6. Authentication and Access Control 7. Caching 8. REST API 9. Security 10. Performance Optimization Index

Advanced caching techniques


In the last two sections, we discussed database caching and memory caching to store data for faster retrieval. In this section, we will go over caches such as OpCache and Varnish. PHP is an interpreter language and the code has to be executed every single time. The process of execution happens in two steps, where the code is converted into operational byte code and is then executed. PHP 5.5 arrives with OpCache that caches the precompiled bytecode present in the memory and executes it. Though OpCache arrives by default with PHP 5.5, it is not enabled by default. To enable OpCache, we have to modify our php.ini file, as shown in the following code from /etc/php5/apache2/php.ini:

opcache.enable=1
opcache.memory_consumption=64
opcache.use_cwd=1

In this snippet, we enable OpCache and allocate 64 MB of memory for storing the bytecode. We also enable the use_cwd setting to append the current working directory to the script key. This will avoid any collisions between our...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at £16.99/month. Cancel anytime