Search icon CANCEL
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
Mastering The Faster Web with PHP, MySQL, and JavaScript

You're reading from   Mastering The Faster Web with PHP, MySQL, and JavaScript Develop state-of-the-art web applications using the latest web technologies

Arrow left icon
Product type Paperback
Published in Jun 2018
Publisher Packt
ISBN-13 9781788392211
Length 278 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Andrew Caya Andrew Caya
Author Profile Icon Andrew Caya
Andrew Caya
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Faster Web – Getting Started FREE CHAPTER 2. Continuous Profiling and Monitoring 3. Harnessing the Power of PHP 7 Data Structures and Functions 4. Envisioning the Future with Asynchronous PHP 5. Measuring and Optimizing Database Performance 6. Querying a Modern SQL Database Efficiently 7. JavaScript and Danger-Driven Development 8. Functional JavaScript 9. Boosting a Web Server's Performance 10. Going Beyond Performance 11. Other Books You May Enjoy

To get the most out of this book

In order to run the source code included in this book, we recommend that you start by installing Docker on your computer (https://docs.docker.com/engine/installation/). Docker is a software container platform that allows you to easily connect to your computer’s devices in an isolated and sophisticated chroot-like environment. Unlike virtual machines, containers do not come bundled with full operating systems, but only come with the required binaries in order to run some software. You can install Docker on Windows, Mac, or Linux. It should be noted, however, that some features, such as full-featured networking, are still not available when running Docker on macOS (https://docs.docker.com/docker-for-mac/networking/#known-limitations-use-cases-and-workarounds).

The main Docker image that we will be using throughout this book is Linux for PHP 8.1 (https://linuxforphp.net/) with a non thread-safe version of PHP 7.1.16 and MariaDB (MySQL) 10.2.8 (asclinux/linuxforphp-8.1:7.1.16-nts). To start the main container, enter the following command:

# docker run --rm -it \
> -v ${PWD}/:/srv/fasterweb \
> -p 8181:80 \
> asclinux/linuxforphp-8.1:7.1.16-nts \
> /bin/bash

If you prefer using multithreading technologies while optimizing your code, you can do so by running a thread-safe version of Linux for PHP (asclinux/linuxforphp-8.1:7.0.29-zts).

Moreover, you should docker commit any changes you make to the container and create new images of your container that you can docker run at a later time. If you are not familiar with the Docker command line and its run command, find the documentation at https://docs.docker.com/engine/reference/run/.

Finally, the three following commands must be run inside the Linux for PHP container whenever you start an original Linux for PHP image and wish to start working with most of the code examples contained in this book:

# /etc/init.d/mysql start
# /etc/init.d/php-fpm start
# /etc/init.d/httpd start

Download the example code files

You can download the example code files for this book from your account at www.packtpub.com. If you purchased this book elsewhere, you can visit www.packtpub.com/support and register to have the files emailed directly to you.

You can download the code files by following these steps:

  1. Log in or register at www.packtpub.com
  2. Select the SUPPORT tab
  3. Click on Code Downloads & Errata
  4. Enter the name of the book in the Search box and follow the onscreen instructions

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR/7-Zip for Windows
  • Zipeg/iZip/UnRarX for Mac
  • 7-Zip/PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Mastering-the-Faster-Web-with-PHP-MySQL-and-JavaScript. In case there's an update to the code, it will be updated on the existing GitHub repository.

All the code examples given in this book can be found, within the code repository, in a folder named according to the chapter's number. Thus, it is expected that you change your working directory at the beginning of each chapter in order to run the code examples given within. Thus, for chapter 1, you are expected to enter, on the container's CLI, the following commands:

# mv /srv/www /srv/www.OLD
# ln -s /srv/fasterweb/chapter_1 /srv/www

And, for the next chapter, you are expected to enter these commands:

# rm /srv/www
# ln -s /srv/fasterweb/chapter_2 /srv/www

And, so on for the following chapters.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "Whenever possible, the developer should always prefer using const over let or var."

A block of code is set as follows:

function myJS()
{
function add(n1, n2)
{
let number1 = Number(n1);
let number2 = Number(n2);

return number1 + number2;
}

}

Any command-line input or output is written as follows:

# php parallel-download.php 

Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "If you scroll towards the end of the page, you should now see an xdebug section."

Warnings or important notes appear like this.
Tips and tricks appear like this.
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 $19.99/month. Cancel anytime