2. Getting Started with Dockerfiles
Activity 2.01: Running a PHP Application on a Docker Container
Solution:
- Create a new directory named
activity-02-01
for this activity:mkdir activity-02-01
- Navigate to the newly created
activity-02-01
directory:cd activity-02-01
- Within the
activity-02-01
directory, create a file namedwelcome.php
:touch welcome.php
- Now, open
welcome.php
using your favorite text editor:vim welcome.php
- Create the
welcome.php
file with the content provided at the beginning of the activity, and then save and exit from thewelcome.php
file:<?php $hourOfDay = date('H'); if($hourOfDay < 12) { $message = «Good Morning»; } elseif($hourOfDay > 11 && $hourOfDay < 18) { $message = «Good Afternoon»; } elseif($hourOfDay > 17){ $message = «Good Evening»; } echo $message; ?>
- Within the
activity-02-01
directory...