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.




13071 posts

Uber Geek
+1 received by user: 2156

Trusted
Subscriber

Topic # 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.




AWS Certified Solution Architect Professional, Sysop Administrator Associate, and Developer Associate
TOGAF certified enterprise architect
Professional photographer


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

gzt

8992 posts

Uber Geek
+1 received by user: 1227


  Reply # 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.



13071 posts

Uber Geek
+1 received by user: 2156

Trusted
Subscriber

  Reply # 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.




AWS Certified Solution Architect Professional, Sysop Administrator Associate, and Developer Associate
TOGAF certified enterprise architect
Professional photographer


 
 
 
 


216 posts

Master Geek
+1 received by user: 62


  Reply # 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.

2033 posts

Uber Geek
+1 received by user: 489


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

You could also use a raspberry pi



13071 posts

Uber Geek
+1 received by user: 2156

Trusted
Subscriber

  Reply # 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.




AWS Certified Solution Architect Professional, Sysop Administrator Associate, and Developer Associate
TOGAF certified enterprise architect
Professional photographer


6536 posts

Uber Geek
+1 received by user: 2943

Moderator
Trusted
Subscriber

  Reply # 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
Want to be with an epic ISP? Want $20 to join them too? Well, use this link to sign up to BigPipe!
The Router Guide | Electric KiwiCommunity UniFi Cloud Controller | Ubiquiti Edgerouter Tutorial


469 posts

Ultimate Geek
+1 received by user: 135

Subscriber

  Reply # 1423434 9-Nov-2015 08:12
Send private message

michaelmurfy: 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.


While debian is a pretty solid pick, it's packages are usually dated. A simple ubuntu installation would work better IMO



13071 posts

Uber Geek
+1 received by user: 2156

Trusted
Subscriber

  Reply # 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.




AWS Certified Solution Architect Professional, Sysop Administrator Associate, and Developer Associate
TOGAF certified enterprise architect
Professional photographer


469 posts

Ultimate Geek
+1 received by user: 135

Subscriber

  Reply # 1423441 9-Nov-2015 08:39
Send private message

timmmay: 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.


For an ubuntu VM running in virtualbox in windows.. Simply download the ubuntu iso, create a new VM in virtualbox, give it however much RAM you think is necessary (probably 2gb at least if you can spare it). It'll prompt you to set up a disk, you can either choose a file which will grow as you actually use the disk, or a file that is static in size on your host machine. Either will work for your needs, but give it at least 20-30gb so you have enough space for the linux install, all php related packages and your php environment + apps.

When you start up the VM for the first time it'll ask for the ISO you downloaded

It's actually very simple, mostly just follow the on screen setup. You'll be fine laughing



13071 posts

Uber Geek
+1 received by user: 2156

Trusted
Subscriber

  Reply # 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.




AWS Certified Solution Architect Professional, Sysop Administrator Associate, and Developer Associate
TOGAF certified enterprise architect
Professional photographer


74 posts

Master Geek
+1 received by user: 14


  Reply # 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.





13071 posts

Uber Geek
+1 received by user: 2156

Trusted
Subscriber

  Reply # 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 :)




AWS Certified Solution Architect Professional, Sysop Administrator Associate, and Developer Associate
TOGAF certified enterprise architect
Professional photographer


853 posts

Ultimate Geek
+1 received by user: 254

Trusted

  Reply # 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.







13071 posts

Uber Geek
+1 received by user: 2156

Trusted
Subscriber

  Reply # 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.




AWS Certified Solution Architect Professional, Sysop Administrator Associate, and Developer Associate
TOGAF certified enterprise architect
Professional photographer


853 posts

Ultimate Geek
+1 received by user: 254

Trusted

  Reply # 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.







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



Twitter »

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 »

FUJIFILM introduces X-E3 mirrorless camera with wireless connectivity
Posted 18-Sep-2017 13:53


Vodafone announces new plans with bigger data bundles
Posted 15-Sep-2017 10:51


Skinny launches phone with support for te reo Maori
Posted 14-Sep-2017 08:39


If Vodafone dropping mail worries you, you’re doing online wrong
Posted 11-Sep-2017 13:54


Vodafone New Zealand deploy live 400 gigabit system
Posted 11-Sep-2017 11:07


OPPO camera phones now available at PB Tech
Posted 11-Sep-2017 09:56


Norton Wi-Fi Privacy — Easy, flawed VPN
Posted 11-Sep-2017 09:48


Lenovo reveals new ThinkPad A Series
Posted 8-Sep-2017 14:37


Huawei passes Apple for the first time to capture the second spot globally
Posted 8-Sep-2017 10:45


Vodafone initiative enhances te reo Maori pronunciation on Google Maps
Posted 8-Sep-2017 10:40


Voyager Internet expand local internet phone services company with Conversant acquisition
Posted 6-Sep-2017 18:27


NOW Expands in to Tauranga
Posted 5-Sep-2017 18:16


Windows 10 Fall Creators Update coming Oct. 17
Posted 4-Sep-2017 14:10


Garmin introduce Garmin vivoactive 3
Posted 1-Sep-2017 18:38


Kiwibank wastes $90 million on software – Reseller News
Posted 1-Sep-2017 13:45



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.

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