How to duplicate a PHP based website?

Background:

I'm new to PHP, but I was asked to make some changes to the code to support an application hosted on our intranet. Actual code changes don't look so bad. However, there is currently no development environment, so I decided 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 might have to redesign all the Apache HTTPD and PHP configuration settings / options / packages on a production machine if I cannot strategically copy the existing production environment to the development machine.

My questions:

  • Can this be done? for example, for FTP specific directories in an Apache / PHP installation to replicate the source environment? If so, which directories? One complication may be that the source environment is SUSE Linux, and the development machine is CentOS. In addition, I installed the appropriate versions of HTTPD and PHP on the dev machine.
  • If this is not reasonable / possible, how should I duplicate the environment? What areas should I check?

Thanks in advance!

+7
source share
4 answers

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

Then you can test your site on a real server in a test environment, and you only need to change the db connection settings in the test version.

+2
source

Clone the whole thing in the VM, extract the code, and put it in the source code repository (e.g. git).

After that, deploy to your computer, deploy to your virtual machine (if you cannot get another machine or you have the time and patience to reverse engineer the configuration of your cloned machine).

You can start the deployment by simply pulling the code from your virtual machine, but if you think your project can take longer, consider setting up a Continuous Integration environment and also put your VM configuration files in a git repository that you can recreate this in production (or hook your products in CI).

+2
source

How should I duplicate a medium? What areas should I check?

You should definitely study:

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

In particular, start with the php.ini , httpd.conf and apache2.conf contained in these folders.

+2
source

It would be much simpler and much less suffering for simple server cloning , you might have to talk to the guys who are monitoring your servers to do this. The reason why I say this is because the server can have different modules / libraries and a number of other materials, you will need a lot of time to figure out what you need if you want to get the application in order to work exactly also on a CentOS machine. Secondly, it is best practice if both environments are identical, so you know that your tests are reliable.

+1
source

All Articles