官术网_书友最值得收藏!

What you need for this book

To ensure a consistent development environment and prevent unnecessary alterations to your host operation system, it is highly recommended that you run all commands within a Linux virtual machine. This will ensure that your output both in your web browser and from your command line matches the output that is presented in this book. As setting up this environment on your own can be a daunting task, prebuilt virtual machines that use VirtualBox and Vagrant are provided to make this setup process easy.

To get started with this book, you should be running the latest version of either Microsoft Windows 7, 8, 8.1 or 10, Apple OS X 10.9 or higher, or a Linux operating system that can run virtual machines, such as Ubuntu 14.04 LTS. Additionally, you will need to install the latest version of VirtualBox (available at https://www.virtualbox.org/wiki/Downloads) and Vagrant (available at https://www.vagrantup.com/downloads.html).

Note

After installing these software dependencies, you may need to restart your computer for the changes to take effect.

After installing VirtualBox and Vagrant, you can then create a new dedicated development environment by opening a new command line or terminal window, creating a new directory for the chapter, and then running the following command to create your virtual machine development environment. These commands will download a prebuilt virtual machine containing all the software required to get you started and start your new development environment:

vagrant init charlesportwoodii/php56_trusty64
vagrant up --provider virtualbox
vagrant ssh

Note

More information on this specific Vagrant box can be found at https://atlas.hashicorp.com/charlesportwoodii/boxes/php56_trusty64.

Note that if you are on Windows, you may need a tool such as PuTTy to connect to your virtual machine over SSH. More information on how to connect to your new virtual machine over SSH on Windows can be found at http://docs-v1.vagrantup.com/v1/docs/getting-started/ssh.html.

Once your new Vagrant box has started, you can access the files of this virtual machine over SSH and access your webroot directory by opening a new browser window and navigating to http://localhost:8080. By default, when you open this web page, you will see the output of phpino().

Tip

Depending upon your operating system security settings, your computer may prompt or block you from accessing port 8080 on your computer. Ensure that you configure your firewall settings if you are facing issues and ensure that port 8080 is open on your computer and that VirtualBox can forward connections from your host operating system to your guest operating system.

As Yii2 is fully compatible with PHP7, it is strongly suggested that you develop and test your web applications against PHP7 as well. The following commands will allow you to provision a PHP7 Vagrant box:

vagrant init charlesportwoodii/php7_trusty64
vagrant up --provider virtualbox
vagrant ssh

Tip

As these virtual machines automatically configure port forwarding, it is recommended that you only run a single virtual machine at a time. Refer to the Vagrant documentation for a complete list of commands and configuration options at https://docs.vagrantup.com/v2.

主站蜘蛛池模板: 名山县| 岳阳县| 合水县| 揭西县| 微博| 伽师县| 鄂尔多斯市| 清远市| 扎赉特旗| 平度市| 金川县| 洛南县| 长岭县| 贵溪市| 东明县| 兖州市| 平山县| 克拉玛依市| 湘乡市| 略阳县| 通城县| 中牟县| 固镇县| 兰西县| 龙井市| 夹江县| 大悟县| 喀喇沁旗| 达拉特旗| 营山县| 项城市| 勃利县| 定日县| 新宁县| 广宗县| 江源县| 衡阳县| 鄂托克前旗| 贞丰县| 抚顺县| 望城县|