Case Study Lab V: Handling test and production web environment

Task Overview
Description of the task

We installed the Apache Web server, on which operates websites in PHP. We need to automate changes to files between production and test environments.

Whenever there is a change in the website, the following procedure: Accepting the request for modification, copying the production environment to the test, waiting for the acceptance of changes in the test environment and copying the changes in a test environment to productive operation.

If we do this process manually, it will cost us a lot of time wasted. Moreover, we could make mistakes that could cause failure of productive operation.

In this case, a document tree is set to /www. It splits into:

  • Production: /www/production
  • Testing: /www/testing

Write a script that will have two options:

  • start: copies contents production environment to a test environment
  • check: lists which files have changed as cp command so user can cut the output and run copy commands

Files index.php and project.php includes the production URL: These two files of production lines the change each URL to During the change control these two files ignore (do not write them as amended).

Technical instructions

For solving the problem follow these steps:

  • Write two functions that will correspond to the three arguments of the program. One will create a new test environment and one finds changes
  • sed command can help you change the URL