A free and open-source book on ZF3 for beginners

Translation into this language is not yet finished. You can help this project by translating the chapters and contributing your changes.

Installing Apache HTTP Server and PHP Engine

For Zend Framework 3 based website to run, you need to have a web server and the PHP engine installed. The next thing we plan to do is installing Apache Web Server and PHP.

First, it is recommended that you update the system by typing the following shell command:

sudo yum update

You do not have to type all commands manually, instead you can copy and paste them. Select the command in this window and copy it into the clipboard (CTRL+C), then click your mouse's right button over the PuTTY terminal window to insert the text.

To install Apache HTTP Server, type the following command:

sudo yum install httpd

Install the PHP engine:

sudo yum install php

And finally, install the PHP engine’s GD extension (this extension is required by the Hello World web application to run correctly):

sudo yum install php-gd

Add Apache HTTP Server to system autorun and start it:

sudo chkconfig --level 235 httpd on

sudo service httpd start

To check that Apache Web Server works, enter the IP address of your EC2 instance in your web browser’s navigation bar. If everything is OK, you should see the page like below:

Figure E.19. Apache default web page Figure E.19. Apache default web page

Next, we will edit the PHP config file to set the time zone settings (in this tutorial, we will use our favorite Midnight Commander editor for this purpose).

Install MC:

sudo yum install mc

Open the php.ini file with MC:

sudo mcedit /etc/php.ini

Set your time zone settings (replace YOUR_TIMEZONE placeholder with your time zone, for example, UTC or America/New_York):

date.timezone = YOUR_TIMEZONE

When ready, save your changes by pressing the F2 key and then press F10 to exit from Midnight Commander’s editor.


Top