Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.


timmmay

20574 posts

Uber Geek

Trusted
Lifetime subscriber

#184051 8-Nov-2015 21:30
Send private message

I do PHP development every couple of years, a bit of maintenance on a website I have. Seems that every time I want to do that I have to get the whole system working again, or even worse install WAMP, an IDE, etc.

I'd quite like to run a virtual machine like VirtualBox, so it stays stable. The question is how can I get Windows onto there to do PHP development? Or I guess I could do Linux too, if someone can recommend an easy distro and method to get it all work. I'm reasonably familiar with Linux, and I've developed in it before, but I don't want to have to mess about with it too much, I just want to fix the code.

Key thing - I want to be able to use Eclipse with a debugger without spending more than an hour or two setting it all up. It can take a while usually.

View this topic in a long page with up to 500 replies per page Create new topic
 1 | 2

gzt

gzt
17104 posts

Uber Geek

Lifetime subscriber

  #1423340 8-Nov-2015 21:44
Send private message

I expect the same as installing any other virtual machine. I last used it long ago but not impressed.

VMware player works under windows and linux. It is such a highly polished product, and I keep coming back to it. It is still streets ahead of anything else out there.



timmmay

20574 posts

Uber Geek

Trusted
Lifetime subscriber

  #1423342 8-Nov-2015 21:47
Send private message

Free virtualization. I've used virtual box at work for testing and it seemed fine. No idea how to install an OS from scratch but could probably find a Linux instance prebuilt easily enough.



Main question is around best OS for occasional php development in a vm.

marpada
475 posts

Ultimate Geek


  #1423344 8-Nov-2015 21:50
Send private message

You can use Vagrant to provision and setup Linux VMs (on Virtual Box or other hypervisor or cloud provider) for LAMP development. There're heaps of projects to automatize the setup , to name two of the most popular

https://box.scotch.io/
http://phansible.com/

Vagrant shares one or more folders with the VM so you can edit the code on your workstation and changes will be applied transparently on the guest. Not sure about how to run the debugger, but you can always ssh into the VM and run it from there.



Yabanize
2350 posts

Uber Geek


  #1423387 8-Nov-2015 23:14
Send private message

You could also use a raspberry pi

timmmay

20574 posts

Uber Geek

Trusted
Lifetime subscriber

  #1423422 9-Nov-2015 07:27
Send private message

Vagrant and those two other things seem pretty great, and it might be what I end up doing :) They're not quite everything I want though - getting debugging working on PHP is a real PITA, which is why I was thinking I'd have a VM that has the IDE installed as well. Does anyone know if something like that exists?

There is this Vagrant box, which I could try.

michaelmurfy
meow
13240 posts

Uber Geek

Moderator
ID Verified
Trusted
Lifetime subscriber

  #1423432 9-Nov-2015 08:09
Send private message

I'd recommend installing Debian in a VM - it is rather easy to get a PHP environment running that way.

apt-get update && apt-get install php5-cgi lighttpd
lighty-enable-mod php5-cgi cgi
Drop files into /var/www/lighttpd

Plenty of tutorials online and you can use anything for PHP (NGINX, Apache etc) but the Debian installer also has the setup for a LAMP server included. This way you can learn a bit of Linux at the same time. I'd recommend installing a Minimum Debian install and setting things up manually more for experience on your part.




Michael Murphy | https://murfy.nz
Referral Links: Quic Broadband (use R122101E7CV7Q for free setup)

Are you happy with what you get from Geekzone? Please consider supporting us by subscribing.
Opinions are my own and not the views of my employer.


timmmay

20574 posts

Uber Geek

Trusted
Lifetime subscriber

  #1423440 9-Nov-2015 08:30
Send private message

If I go with Linux I'd be more included to use Ubuntu, it's what we use at work so building up experience with one OS is probably better.

I'm having a shot with Vagrant. For the standard open boxes it's fine, but trying to download a box someone made with Eclipse already on it is giving me problems. I can probably work them out, or I can flag it and just install Ubuntu. How would I start if I wanted an Ubuntu VM in Virtualbox? I could Google it, but if someone can point me in the right direction, great.

 
 
 

Cloud spending continues to surge globally, but most organisations haven’t made the changes necessary to maximise the value and cost-efficiency benefits of their cloud investments. Download the whitepaper From Overspend to Advantage now.
timmmay

20574 posts

Uber Geek

Trusted
Lifetime subscriber

  #1423446 9-Nov-2015 08:47
Send private message

Thanks Rappelle, sounds pretty easy. VirtualBox isn't as easy as the website suggests, so I may just do it manually. I'll search for a tutorial to get an Ubuntu development machine set up, no doubt there are dozens of tutorials online :) Debugging using PHP though... that's a PITA to set up.

jhsol
102 posts

Master Geek


  #1423542 9-Nov-2015 10:46
Send private message

If you have windows 8 or higher and a compatible CPU install the Hyper-V feature (Programs -> Add Windows Features -> Hyper-V).

To install a Guest OS you need the ISO for it which can easily be downloaded from their corresponding website (ie http://www.ubuntu.com/). With windows you need a Windows iso files. Here is a guide to obtaining the media files http://www.howtogeek.com/186775/how-to-download-windows-7-8-and-8.1-installation-media-legally/. Do note you will need a separate windows key for it to activate (your current one wont work). Hence why I recommend to install a Linux distro as its free (ive personally used Centos and Ubuntu in Hyper-v and it has worked flawlessly).

Attach the ISO to the virtual machine and turn it on and it will boot from the iso file.



timmmay

20574 posts

Uber Geek

Trusted
Lifetime subscriber

  #1423608 9-Nov-2015 12:14
Send private message

I've got VirtualBox going with Ubuntu, lots of packages installed, and Eclipse running. Just a few details to work out now, like how to give the VM a static IP and get the code over. Thanks for the suggestions all :)

darylblake
1162 posts

Uber Geek

Trusted

  #1424119 10-Nov-2015 08:32
Send private message

#1 Install Git (If you on a windows machine you want to turn on the conversion to unix End of Line Characters - second option in the installer)
#2 Download Vagrant http://www.vagrantup.com
#3 Download virtualbox
#4 Find a github repo with a chef/puppet provisioned build on centos/debian/ubuntu (whatever you want) there are LOADS of them on github. And load it using git clone https://github.com/blah /dst/folder

Move to destination folder
/dst/folder$ vagrant up

Job done. Machine will be provisioned.

Alternatively you can build your own provisioning script.

timmmay

20574 posts

Uber Geek

Trusted
Lifetime subscriber

  #1424125 10-Nov-2015 08:47
Send private message

I'm doing it by hand - it's taking many hours. I'm mostly there though. Vagrant didn't work so well on Windows, but I didn't try it on Linux.

Why would I need Vagrant and Puppet? I thought the idea of Vagrant was to set up a machine from scratch to done? What does Puppet/Chef do that's extra? I'm familiar with what they're generally for, but haven't used them myself.

darylblake
1162 posts

Uber Geek

Trusted

  #1424127 10-Nov-2015 08:53
Send private message

So how it works is vagrant gives you headless control over virtual box. It also manages mapping network adapters and network shares (without pooing around with things like samba).

When you run vagrant up if you are not using puppet or chef it will just download the vm (.box) file. And then map your shared folders (which you can specify in the vagrant file) and then do port forwards (if you are using NAT). 

If you are using a provisioner like Chef then it will download a clean vm (.box) and boot it, map up all the stuff like i wrote above then it will fire off the provisioner. The provisioner will install whatever you have it configured it to install.    E.g. mine installed nginx/php5.6/php-fpm all the php extension modules I need + any other apps i have specified. But you dont have to use nginx you can use apache. 
You can also get the provisioner to set up boot scripts, create users, setup things like config files (I use it to set my php.ini and my vhosts up). 

If my VM gets damaged or deleted or i install somehting on it and screw it up, I can just type vagrant destroy, and then vagrant up. 

To shut it down you use vagrant halt
and if you change the provisioner you can re-run the provisioning script by using vagrant provision. 

It takes about 5 minutes to build my VM.

EDIT: HERES a link, this one has the installed modules in its readme.md

 

All you need to do is load git bash. Make a clean folder, go into it.

 

Then type: 

 

git clone https://github.com/dirkaholic/vagrant-php-dev-box
When its done type vagrant up.



timmmay

20574 posts

Uber Geek

Trusted
Lifetime subscriber

  #1424134 10-Nov-2015 09:01
Send private message

Interesting, thanks. I want to actually develop on the box, using Eclipse or something. If I can get a PHP dev env working with debugging enabled out of the box that would be great. I could give that a shot in a new VM - sounds like a good option.

darylblake
1162 posts

Uber Geek

Trusted

  #1424198 10-Nov-2015 10:43
Send private message

So what I do i set up my IDE on my windows or mac machine, then make a projects folder.

I map through /home/webhosts/ directory through to say...  c:\webprojects\ folder. Using vagrant file sharing.

Don't try and run a VM and then run a linux version of the IDE inside virtual box. It will be annoying, I have tried this in the past. I find windows and mac have the best development tools available.

By doing this, if the VM poops itself (which virtual box sometimes does) then your files are actually on your pc. (if you have been pushing them to a git/svn/mercurial repo then even better).

FYI I find VMware to be extremely solid by comparison to virtual box, but you need a licensed version of vagrant and vmware workstation to get it going properly on vmware. 

 1 | 2
View this topic in a long page with up to 500 replies per page Create new topic





News and reviews »

Air New Zealand Starts AI adoption with OpenAI
Posted 24-Jul-2025 16:00


eero Pro 7 Review
Posted 23-Jul-2025 12:07


BeeStation Plus Review
Posted 21-Jul-2025 14:21


eero Unveils New Wi-Fi 7 Products in New Zealand
Posted 21-Jul-2025 00:01


WiZ Introduces HDMI Sync Box and other Light Devices
Posted 20-Jul-2025 17:32


RedShield Enhances DDoS and Bot Attack Protection
Posted 20-Jul-2025 17:26


Seagate Ships 30TB Drives
Posted 17-Jul-2025 11:24


Oclean AirPump A10 Water Flosser Review
Posted 13-Jul-2025 11:05


Samsung Galaxy Z Fold7: Raising the Bar for Smartphones
Posted 10-Jul-2025 02:01


Samsung Galaxy Z Flip7 Brings New Edge-To-Edge FlexWindow
Posted 10-Jul-2025 02:01


Epson Launches New AM-C550Z WorkForce Enterprise printer
Posted 9-Jul-2025 18:22


Samsung Releases Smart Monitor M9
Posted 9-Jul-2025 17:46


Nearly Half of Older Kiwis Still Write their Passwords on Paper
Posted 9-Jul-2025 08:42


D-Link 4G+ Cat6 Wi-Fi 6 DWR-933M Mobile Hotspot Review
Posted 1-Jul-2025 11:34


Oppo A5 Series Launches With New Levels of Durability
Posted 30-Jun-2025 10:15









Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.