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.




15408 posts

Uber Geek

Trusted
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

10982 posts

Uber Geek


  # 1423340 8-Nov-2015 21:44
One person supports this post
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.



15408 posts

Uber Geek

Trusted
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.

 
 
 
 


315 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.

2178 posts

Uber Geek


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

You could also use a raspberry pi



15408 posts

Uber Geek

Trusted
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.

Mr Snotty
8940 posts

Uber Geek

Moderator
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.






15408 posts

Uber Geek

Trusted
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.

 
 
 
 




15408 posts

Uber Geek

Trusted
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.

92 posts

Master Geek


  # 1423542 9-Nov-2015 10:46
One person supports this post
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.





15408 posts

Uber Geek

Trusted
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 :)

981 posts

Ultimate 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.



15408 posts

Uber Geek

Trusted
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.

981 posts

Ultimate 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.





15408 posts

Uber Geek

Trusted
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.

981 posts

Ultimate 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



Twitter and LinkedIn »



Follow us to receive Twitter updates when new discussions are posted in our forums:



Follow us to receive Twitter updates when news items and blogs are posted in our frontpage:



Follow us to receive Twitter updates when tech item prices are listed in our price comparison site:





News »

Intel introduces cryogenic control chip to enable quantum computers
Posted 10-Dec-2019 21:32


Vodafone 5G service live in four cities
Posted 10-Dec-2019 08:30


Samsung Galaxy Fold now available in New Zealand
Posted 6-Dec-2019 00:01


NZ company oDocs awarded US$ 100,000 Dubai World Expo grant
Posted 5-Dec-2019 16:00


New Zealand Rugby Selects AWS-Powered Analytics for Deeper Game Insights
Posted 5-Dec-2019 11:33


IMAGR and Farro bring checkout-less supermarket shopping to New Zealand
Posted 5-Dec-2019 09:07


Wellington Airport becomes first 5G connected airport in the country
Posted 3-Dec-2019 08:42


MetService secures Al Jazeera as a new weather client
Posted 28-Nov-2019 09:40


NZ a top 10 connected nation with stage one of ultra-fast broadband roll-out completed
Posted 24-Nov-2019 14:15


Microsoft Translator understands te reo Māori
Posted 22-Nov-2019 08:46


Chorus to launch Hyperfibre service
Posted 18-Nov-2019 15:00


Microsoft launches first Experience Center worldwide for Asia Pacific in Singapore
Posted 13-Nov-2019 13:08


Disney+ comes to LG Smart TVs
Posted 13-Nov-2019 12:55


Spark launches new wireless broadband "Unplan Metro"
Posted 11-Nov-2019 08:19


Malwarebytes overhauls flagship product with new UI, faster engine and lighter footprint
Posted 6-Nov-2019 11:48



Geekzone Live »

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


Support Geekzone »

Our community of supporters help make Geekzone possible. Click the button below to join them.

Support Geezone on PressPatron



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.

Alternatively, you can receive a daily email with Geekzone updates.