Professional Documents
Culture Documents
The Development Environment: Figure 1-5. Yaml Files For Your Project
The Development Environment: Figure 1-5. Yaml Files For Your Project
For example,
<code>
sudo ln -s /usr/local/bin/docker-compose /usr/bin/
docker-compose
</code>
Optionally, install command completion for the bash and zsh shells.
Test the installation.
<code>
$ docker-compose --version
</code>
11
Chapter 1 Getting Started
Once you have the ZIP file downloaded, unzip it in a directory of your
choosing. We used ~/ (my users home directory) ~/coding. Once
unzipped, your directory structure should look something like Figure 1-6.
Inside this directory will be all the information needed for Docker to
start the development environment.
Go ahead and run
<code>
docker-compose up
</code>
<code>
http://localhost:8000
</code>
12
Chapter 1 Getting Started
and you should see the table of contents page for this book and
verification that the database has connected successfully. Go to the
command prompt and type
<code>
docker ps
</code>
<code>
docker exe -ti php-app bash
</code>
This connects you, much like ssh, to the container itself. From here, go
into the Chapter1 directory.
<code>
cd Chapter1
</code>
Type
<code>
php first_script.php
</code>
<code>
Output here
</code>
13
Chapter 1 Getting Started
Summary
In this chapter, you learned in general the why, what, and how of using the
PHP programming language in the development world. We introduced
why you want to use PHP, Nginx, and MySQL and their benefits. As
next steps, you learned how to install the Docker tool, which is an open
platform for developing, shipping, and running applications. Finally,
you saw why you needed the YAML files for your project to set up your
development environment.
In the next chapter, we will explain how programming languages use
variables to store and manipulate data and to build useful tools in PHP.
14
CHAPTER 2
PHP Fundamentals
In order to build useful tools in PHP, you need to know how to manipulate
data. Programming languages use variables to store and manipulate data.
In this chapter, you will learn how programming languages use
variables to store and manipulate data and to build useful tools in PHP.
Additionally, you’ll explore the following topics:
• Objects
Variables
PHP has a few rules when it comes to variables:
• A variable must start with the $ sign, followed by the
name of the variable.