7

Background:

I'm new to PHP, but I've been asked to make some code changes to support an application hosted on our Intranet. The actual code changes don't look too bad. However, there is currently no development environment, so I have undertaken to create a duplicate server to develop and test my changes.

At this point, and not being well-versed in PHP, it looks like I may have to reverse engineer all the Apache HTTPD and PHP configuration settings/options/packages on the production machine unless I can strategically copy the existing production environment to the development machine.

My questions:

  1. Is it possible to do that? i.e. to FTP certain directories in the Apache/PHP installation over to replicate the original environment? If so, which directories? One complication may be that the original environment is SUSE Linux and the development machine is CentOS. Other than that, I have installed the matching HTTPD and PHP versions on the dev machine.
  2. If this isn't wise/possible, how should I go about duplicating the environment? What areas should I check?

Thanks in advance!

Steve T
  • 150
  • 1
  • 10
  • 2
    This may be a better fit for http://www.serverfault.com – Jeremy Harris Nov 06 '12 at 21:30
  • 1
    depending on the nature of the application an exact duplicate of the environment may not be needed. many sites\applications are developed on windows then uploaded to linux and all is well - but its impossible to say if that would be the case here. You may be able to put a copy in another directory on the server, then most things would be the same. –  Nov 06 '12 at 21:33
  • Using `Virtual Machine` or `Vmware` on the second machine could be a choice depending on your situation. – Xaqron Nov 06 '12 at 21:40
  • **Thanks** for your interest and answers, everyone! – Steve T Nov 07 '12 at 15:38

4 Answers4

2

Clone the entire thing into a VM, extract the code and put it into a source code repository (for example git).

After that develop on your machine, deploy to your VM (unless you can get another machine or you have time and patience to reverse engineer the configuration of your cloned machine).

You can start deploying by simply pulling the code from your VM, but if you think that your project might last longer consider setting up a Continous Integration environment and also putting your VM config files into a git repository co you can recreate it in production (or hook your production into CI).

Chris Hasiński
  • 2,620
  • 2
  • 23
  • 33
2

how should I go about duplicating the environment? What areas should I check?

You should definitely look into:

  • /etc/httpd/
  • /etc/php5/ (might be a different name)

In particular, start from the files php.ini, httpd.conf and apache2.conf, contained in those folders.

mrucci
  • 4,052
  • 3
  • 29
  • 33
2

An alternative to the already mentioned solutions would be to setup a virtual host on the production machine, something like test.yourdomain.com and copy the database to a test database.

Then you could test your site on the live server in a test environment and you would only have to change your db connection settings in the test version.

jeroen
  • 88,615
  • 21
  • 107
  • 128
1

It would be a lot easier and a lot less heartache to simply clone the server, you may need to speak to the guys who look after your servers to do this. The reason why I say this is because there could be various modules/libraries and a whole host of other stuff that is on the server, it would take you a really long time to figure out exactly what you need if you were to get the app to run exactly the same on the CentOS machine. Secondly it's best practice if both environments are identical, this way you know your tests are reliable.

Imran Azad
  • 1,354
  • 1
  • 19
  • 35
  • 1
    I don't know if this is a concern for @Steve T, but cloning a SuSE server would incur additional licensing cost. This may be part of the reason the production server is SuSE and the dev box CentOS. – Jim OHalloran Nov 06 '12 at 21:51