To do this, go to the settings of your virtual machine and create a shared folder.
Settings dialog > Shared Folders
In this example name the shared folder as "Server". In the options let only marked "Make permanent".
Now run the virtual machine and install additional virtualbox programs on linux
Devices > CD/DVD Devices > VBoxGuestAdditions.iso
Mount the CD with the
sudo mount /dev/cdrom /cdrom
run the command below to download some packages needed to install the virtualbox tools
sudo apt-get install build-essential linux-headers-'uname –r'
Soon afterwards we go to the installation of the tools
Para 32bit: sudo /cdrom/VBoxLinuxAddition-x86.run
Para 64bit: sudo /cdrom/VBoxLinuxAddition-amd64.run
Restart the machine
sudo reboot
So that you do not have work to change or create virtualhosts in apache, mount your shared folder in / var / www
sudo mount -t vboxsf -o rw,uid=33,gid=33 Server /var/www;
Pay attention to the uid=33,gid=33
part that represents the user code and group in which the apache runs. Usually www-data
. Change if apache is set to use another user, otherwise you will have problems with permission when running your scripts.
So you do not need to mount your shared folder every time you start the virtual machine, add a startup script.
cd /etc/init.d/
sudo vi sharedfolder.sh
Paste the code below into the file and save it by pressing ESC
> :wq
> ENTER
#!/bin/bash
sudo mount -t vboxsf -o rw,uid=33,gid=33 Server /var/www;
You can now allow Netbeans to run your projects directly from a local folder. So it will not upload the project.
To configure XDebug on the virtual machine and enable Netbeans to run the debug normally, change the XDebug settings in php.ini
as follows
xdebug.default_enable=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host={IP da maquina virtual}
xdebug.remote_port=9000
xdebug.remote_autostart=0
Ready, configured environment.