I am reading about the PHP VM set up for vagrant and I used to use XAMPP so I was wondering is it neccessary to set it up for small projects such as simple form controls etc, If so should it be on a decent Device spec,
Is there anything I should know regarding the software like would I need to set it up on a fresh instal of windows or having it in place of other software such XAMPP or WAMPP etc.
I don’t know if anyone sent a similar question feel free to link the question so I can find the details since the pagew regarding the VM does explain why and how to set it up but doesn’t really tell me what are the conditions or any user feedback for assurance since the last thing I want to do is destroy my pc because I was careless.
VMs generally can’t destroy your computer because they work on their own. The reason to use that setup is getting familiar with the command line. The command line is pretty much the important aspect part of web development because once you have a host that supports SSH, you won’t know what to do.
Though I actually disagree with using VMs as they are super slow. We use VMs almost in all IT classes at my school. The thing that bugs me the most is that I get double key strokes in those VMs when I am at home. But they work fine on school computers. And there is no way to remove this problem because the solution is to configure my VM which there is a policy in place. That means I have no way of configuring my school VMs so I have to deal with it.
That’s the reason why I install my own setup. If you know how to serious your own development environment, you won’t screw anything up.
but how would I go about setting up my own development environment because I always used XAMPP for that but I always had conflicts with it but coding always advances and as they say those software are a little outdated because it takes awhile to set up everything but it has large amount of options for cross-platform testing etc
I guess I am new to this as apart of setting up something other than relying on software like XAMPP but due to a lot of HTTPS site set ups doing research etc I found I need to find ways to manually set up these things to get familiar and it’s just scary as it is new to me so I want to know how would a web developer or designer set up an environment as I have been learning how to code alone I didn’t have technical subjects at my school
Pretty far from perfect but I know enough to get around with layout design just the back-end code that bothers me, needing to set up these things any help would be best appreciated to head in the right direction with these set up’s and stuff please
If you don’t mess around with too much files that deal with the system files, then you should be ok. The only real file you want to edit is the hosts file if you want to have custom domain names. You’re basically pointing those domains to 127.0.0.1. Since you point those domains to 127.0.0.1, anything you do in your localhost, no one can see it. It also does not effect the live domain so if you were thinking of trying to mess someone’s website up, that won’t happen.
For development, you shouldn’t need to do a lot inside the VM. If you’re using a vagrant box the experience isn’t much different to using XAMPP. You just save files in a certain location which is accessible by both the VM and the host OS.
So in your opinion what would be different between using Xampp and VM in terms of coding? other than being able to reset VM or restoring some files before things happen In other words in terms of website coding in development side can it effect a pc in anyway unintentionally.
I personally wouldn’t use a VM. With my experience using VM, I’d like to disagree. I’m not saying that everyone is going to have the same issues and experience that I had dealing with VMs. But I am saying that it’s unnecessary in my point of view because if you just want to run a Vagrant box. Why not just do it on a regular partition?
By far if you were to compare using a regular partition with a VM, regular partitions are so much faster because you aren’t running it in a VM. What I mean by “regular partitions” is you carve a piece of storage size from your actual HD or SSD. Say all you really want to do is develop and not anything else on that partition. Then you can carve your actual HD or SSD to say 100GB. You install any OS that fits your needs. If you want to install Vagrant on it, fine. Go a head. If you want to install XAMPP on it. Fine, go a head. If you want to install it manually, that’s not a problem. The point I am getting at is using a VM when you could just partition your HD or SSD to use a chunk of storage space for development makes no sense. From my experience; VMs are slow, the double key stroke with no permission granted to stop it, and so much more. The slowness and performance is what gets on my nerves a lot.
I’d rather partition my HD to create the same exact effect that the VM does, but with better performance and better speed. Now you may say that you don’t want to do that because it might screw up your PC. But it really doesn’t. You’re just carving a piece of the whole HD or SSD. So a 1 TB HD or SSD should be far then enough to carve say 200GB and still be ok.
I don’t mean to say that VMs don’t have their use. I am saying that with what I am experiencing, I’d say that performance wise and speed of a VM makes me not want to use it at all. But I am also saying that not everyone’s experience here is going to be the same using VMs.
But surely at the expense of having to choose which partition / OS to boot from? Where the whole point of a VM is to allow a single host OS to run one or more guest OS of the same or different type at the same time. So if your work environment requires that you run in MS Windows, when you use a partition running some flavour of *nix, then your MS environment is inaccessible. If you have the space for multiple physical boxes, then of course the partition option works fine.
I can see what you are saying, but the speed and performance may be even more costly. Imagine slow VMs for 3 hours. You could of finished your work hours ago, but you only got half way due to the slowness of the VM.
Thanks for all the comments I respect everyones oppinions so to sum it up:
Spaceshiptrooper says no to VMS to the exception of it being slow and can cause delays of work performance and hair pulling because of slowness.
Droopsnot says Maybe due to VMS having accessable to different OS available at just a few clicks instead of entire reboot and loading of different resources.
Dormilich says yes to the use of less database which I don’t quite understand what that would mean?
So overall everyone does say it’s easy to use effective in terms of accessiblity and maybe slow under certain circumstances which may cause delays of projects or work load.
Is there anything else you guys can tell me about the way VM’s work, I have read that page from sitepoint regarding VM’s thats how I ended up here. But what i’d like to know would alot of resources be required to set it up or any risk of it damaging your device unintionnaly for instance create unnessecary open ports or risk of crashing the actual device or chances of having bloatware etc I am just throwing examples out not really a case where all these would be used.
I just want to know like overall the things I listed 1 of you say yes and 1 of you wouldn’t mind either way and the other says less need of database?
In my current VM I have three MySQL and a Redis database. A sendmail that doesn’t actually send mails (since for testing I don’t want emails to leave my test system no matter what) and I certainly don’t want that my node.js installation interfers with the one on the test system (which is a debian and not a macOS).
So your saying it can be insecure or abit of security risk to use databases on a local machine?
What do you mean to not let sendmail leave the system if you don’t really use it? and I was curious what stuff do you use for the sendmail as I had trouble setting up PHPMailer since Gmail doesn’t want to agree with me using it?
would it be considered bad to use database on the local machine as opposed to using it on a VM because I understand VM’s disconnect it’s self entirely from the main Device making it more secure but in terms of code editing would there be possibilities to having that connection where it could harm the device?
One of the primary reasons I use VMs is to provide a consistent environment across my team and production. Inconsistent local set-ups across a team lead to more bugs. Furthermore, I use puphpet to create a config that can stand up a box in a matter of minutes with all the dependencies php or others for a project. In the last 5 years I haven’t worked on a project where the only dependency is a simple xamp like install. The projects I work on involve several others dependencies including other software and extensions that can be very difficult to install on a none Linux based host OS. I’ve seen developers go your route and waste a week on just trying to install stuff when a vm could have had them up in running in a matter of hours. Not to mention I’ve worked at places where there are multiple projects that require different environments. Managing multiple versions of php and environment configurations is very easy with separate VMs. I also use and highly encourage PHPStorm usage which integrates very well with a vagrant set-up. Also developers aren’t always the best at installing everything from the ground-up. There is a lot of time that can be wasted in doing so. Providing a reusable vm or docker box makes on-boarding new devs much easier. I think learning to use and configure a vm for local development is a very valuable skill. Its one which I’m always interested in when I have interviewed candidates in the past. I typically see the people who have that skill are also the ones using the most modern tool sets and debugging practices where as the people who are using xamp are still using notepad and var_dump to debug.
A VM is actually more secure because any code executed only runs on the VM. If you accidentally wrote a PHP script that deleted all files on the machine, it would only delete files on the virtual machine.
With VMs, you can have different installations running so you can have PHP 5.6 installed in one VM and PHP 7.2 in another, then test your code works with both. You can test your code on linux when using a windows machine, etc and it’s more like using a real web server. You don’t need to install anything other than vagrant and virtualbox on your real PC because everything is contained within the VM and it’s actually easier. You can run vagrant up and all the software for your chosen box is downloaded and installed as part of the VM: PHP, MySQL, NGINX, Git, PHPUnit, Composer, etc.
A VM is actually less secure, because it’s just another peace of software that interfereces with your system, and brings it’s own bugs along. Maleware may break out of the VM environment. Also, e.g. if public internet access is available, you have the combined vulnerabilities of multiple operating systems. And if you configured shared access to your filesystem, that may also lead to lost data. It’s a matter of configuration to get a secure setup.
This is off topic but I use MailHog for local dev. That way you never have to worry about accidentally sending emails out but can see all the mail that would have gone out. Phphpet as I mentioned earlier makes this really easy to install.
I am convinced that what you guys say is true that VM’s is very usefull for Testing projects and come hand in hand with large project management and that it can be usefull for quick set ups and very secure as it is disconnected from the main devices.
So if I was to set it up… would it be worth it to set it up even if you only have small projects because I understand at the start it can be abit frustrating to set up as you have to get all the software ready and working etc but afterwards it’s like carrying around a USB with already installed and ready to use software.
But would someone need a device big enough to start up enough VM;s to run the debugging and error checking etc because at the moment my PC may not be able to run that much resource at one time? and if it doesn’t use up alot how many VM’s would be neccessay for testing and all of the that?
A VM is as or more secure (depending on the vulnerability) as the host system. The VM is running on the host so can’t do anything that the host can’t. On the other hand, if malware affects the VM, it can only affect files in the VM (or any directories shared between them, which in most setups is one or two directories which contain only your website). It can’t access, for example, the web browser on the host machine.