Duplicating server environment offline

Hi everyone,

I have a live website and i need to work on features and bugs but as you can think it’s not a good idea to work on a live site while people buy stuff because if you mess up your clients will see and that will make people move to another site.

So i have thought that i would google what i can do for a dev area that i can work on and when done copy the changes to the live site, what i found was Git and version control but i don’t have the time to setup everything plus the command line scares me :slight_smile: i love the idea of having a dev area then when the features are good to go live you just merge the branch.

Now i would like to use Git but i don’t now where to start and i don’t want to set things up and then in the end delete some files without knowing what just happened :frowning: anyway back to my question, is there a way that i can clone or duplicate my server offline on a localhost so that i can work offline and when i’m done just upload the updated files?

Absolutely. Take a look at XAMPP (other software packages are available, but XAMPP is the one i use). It’ll set up a local Apache/MySQL/PHP/Perl (AMPP) stack on your local environment with a click of a button. Then you can FTP up and down as necessary.

Try / research this stack

GitBash
WampServer
Ruby Command Prompt

Ruby runs Grunt
Wamp for the localhost
GitBash for push/pulling

I have this setup and it’s so very nice once set up. Does exactly what you need.

I also have WinSCP/PuTTy on here but I’m not sure if that’s needed. I doubt it. When I go push/pull files I only need wamp/git/ruby up.

If your production server is linux based you can set-up a linux vm using vagrant. You could even create a distro of linux and install it on the vm that is an exact server match. As simple as xampp is it will never get you the *closest representation as something like a vm with the same os. There are several articles here on Sitepoint on using vagrant. With the power of the vagrant ecosystem xampp is really for kids these days.

1 Like

i will have a look into the things you guys said :slight_smile: i have WAMP on my system because i made the site on localhost then uploaded it to the server, but the problem is that the server is way different then the WAMP setup (i tried getting it as close as i can with the php,phpmyadmin…etc versions)

The biggest problem i have is when something works 100% on localhost then upload it to the server then i found out that the php version is different and i have to change the code again - that way i need a “as close as possible” dev area.

I had the idea of working online with a subdomain but the problem is that google finds everything on you server - i know that i can use robot.txt to keep them out but that will not stop them from indexing

Wamp shows you what version you are running. Mine has 5.4.3. Can’t you just use phpMyAdmin to match it?

Hey @RyanReese

can you change the php version in phpmyadmin?

I’m not sure. I would assume it’s possible to get them matching. Upgrade/downgrade one or the other.

i will have a look into it thank

plus i would like to get the mysql version to the same version as the one i have on the server so i will have a look into that

o and the list you gave me Wow Git Bash looks great

It does everything you want. Even version control. It tracks what changes you made and if you want them all removed you can “checkout” it and it’ll restore the file to the most recent pulled version. I love it.

I’m surprised nobody talked about https://puphpet.com/
You can setup a PHP box with vagrant and vritual box easily. Install Vagrant and Virtual Box, go to puphpet.com, select what you need, download what puphpet.com sends you. Go in command line and type vagrant up.
That’s it, you have virtual box with PHP installed.

Also, you can try GitHub. They have a client that is really basic…

2 Likes

Hey @xMog

i found a site yesterday called phptherightway and they talk about vagrant and puphpet and it looks really good but i felt overwhelmed with everything that i just come here and asked, everything i look up online makes me feel like it’s a mountain that i need to clime and i’m only in short with a water bottle and no chance :slight_smile:

i will have a look at puphpet about my local setup maybe it will get me the closeted to my server - thank

Like I said Sitepoint has some very thorough articles on the topic.

thank @oddz for the link will have a look :smile:

hey @RyanReese can you point me in the right direction with the Ruby part of your list? what do i need to know or do you have a link that will help me understand how to use all the things you mentioned together?

thanks

Just download Ruby and you’ll get a command prompt. Then you setup grunt and run grunt from Ruby. Google is your friend here :blush: