New to VM, Vagrant errors

For so long now, I’ve just been using WAMP for PHP development. It does the job, but I thought it’s about time I experimented with setting up a VM on Windows.
Following instructions here I downloaded Git, VirtualBox and Vagrant, then ran the commands in Git Bash. But it is giving me errors when I try vagrant up.

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'laravel/homestead'...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["import", "\\\\?\\C:\\Users\\Sam\\.vagrant.d\\boxes\\laravel-VAGRANTSLASH-homestead\\11.5.0\\virtualbox\\box.ovf", "--vsys", "0", "--vmname", "ubuntu-20.04-amd64_1638703353337_94961", "--vsys", "0", "--unit", "11", "--disk", "C:/Users/Sam/VirtualBox VMs/ubuntu-20.04-amd64_1638703353337_94961/ubuntu-20.04-amd64-disk001.vmdk"]

Stderr: 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Interpreting \\?\C:\Users\Sam\.vagrant.d\boxes\laravel-VAGRANTSLASH-homestead\11.5.0\virtualbox\box.ovf...
Progress state: E_INVALIDARG
VBoxManage.exe: error: Appliance import failed
VBoxManage.exe: error: Code E_INVALIDARG (0x80070057) - One or more arguments are invalid (extended info not available)
VBoxManage.exe: error: Context: "enum RTEXITCODE __cdecl handleImportAppliance(struct HandlerArg *)" at line 1119 of file VBoxManageAppliance.cpp

It seems to be something about invalid arguments, but other than that I does not mean much to me.
I can’t find the file VBoxManageAppliance.cpp anywhere.
Also where it mentions:-

"C:/Users/Sam/VirtualBox VMs/ubuntu-20.04-amd64_1638703353337_94961/ubuntu-20.04-amd64-disk001.vmdk"]

I can’t find that file, the folder is there but empty.
Does anyone have an idea what the problem is?


I can’t help with the actual error. Sorry about that :frowning:

However, the article you link to is several years old and I would imagine that a fair few things have moved on since it was published.

Earlier this year, we published an article by Tom Butler (of PHP & MySQL: Novice to Ninja fame) on setting up a PHP dev environment.

If you’re not very invested in Vagrant, I would suggest giving that a go. Docker is a lot more popular nowadays (there is even a section in that article detailing why not to use Vagrant) and you’ll likely find more up-to-date resources and more ways to get help when using it.

FWIW, I also ran through all of the code in that article and could get everything running without any hassle.


P.S. If you decide to go the Docker route, we also have some up-to-date resources over on Premium (link).


Yes, that was another part to the question I forgot to add. I saw it was a few years old and was going to ask if it is still relevant (or the best way) today. The 6th edition of N2N uses the same thing and points to the article. Has the new one updated that?
I’ll have a read of those and decide what I want to do next.

Strangely, the paperback version 7th edition seems to be available everywhere but on Sitepoint - and Premium is still offering the 5th and 4th editions :upside_down_face:

It is not available in paperback-- we haven’t released it yet. It is in the final stages of editing. It’s overdue, which is why the release date has ben pushed back with retailers.


An update on this first. I could not get Vagrant or Docker working on either Windows or Ubuntu.
Though eventually I did manage to get Docker working on Ubuntu, following Tom’s instructions (linked above).
I think the problem in Windows is I’m still using Win7 at home, I’ve just always been reluctant to install 10. But probably will have to accept the inevitable at some point and get a newer version, but that’s another topic.
I did have a go at installing Docker at work yesterday on my Win10 machine there, and it works.

Now getting to my next question. Tom puts the case for using NGINX over Apache. Points taken, but I have a few sites up and running already that use Apache and my aim is to more closely replicate their environments locally, which I believe Docker can do. But I need a bit of help in how to set that up in the docker-compose.yml file.
Swapping nginx:latest for httpd:latest was easy enough, but it needs a bit more set up. Like it probably needs telling what to do with PHP and telling where the “public” folder is. I imagine that’s simple when you know how, but I’m quite new to server config, having not done much beyond messing with .htaccess files.
Needles to say, I have already been searching around for an answer, but have yet to find anything that works.
If I change the version to 2.4 I can find the root directory with a volume set like this:-

- ./app/public:/usr/local/apache2/htdocs

But on latest, (which appears to be 2.4.51) it seems to be a different place, as I just see the “It works!” message, not what’s in my index file.
When I do see the correct location (on 2.4) I get “Index of /” instead of showing the index file.
If I view the index.php, it does not know what to do with the PHP.
So I’m guessing I need to do something with httpd.conf.

I saw @veocode offering Docker help in another thread. Maybe they have an idea?

It’s /var/www/html if I remember correctly

Here are some samples:


Thanks, I’ll take a look at that later.
If I’m wanting to use PHP 8.0 instead of 7.2, is it as simple as changing that first line?

Probably yes, but some extensions may not be compatible. Just watch logs while building and update Dockerfile if something went wrong.

1 Like

Just wanted to follow up here.

PHP & MySQL: Novice to Ninja, 7th Edition is now available in our library :tada:


I saw that the new version was released.
On this topic, I did (temporarily) shelve the idea because after very slowly making progress, I reached a point where I was hitting a brick wall every way I turned and though it best to leave it alone for a while and come back later. It is not that urgent yet, but I do need to get a PHP 8 environment running some time before PHP 7 is EoL towards the end of the year, if at least to test existing sites are ready for the change.

I did get a few varying set-ups installed in Docker with various combinations of PHP8, MySql, MariaDb, Apache and NGINX.
Where I fell down was actually doing anything with a database, such as import data from my existing Wamp set-up. MySql Workbench wasn’t playing. I tried installing PhpMyAdmin, that failed to run with an error. I don’t recall specifics now, it was a while back and I’ve been working on other projects since then.
I did just take a quick look at the new book to see how Tom sets up the database. As expected he’s using Docker this time, but I didn’t get past the intro preview, I appear to have lost access to Premium. BTW I did read the Docker book by Craig Buckler at the time.

You could always try Laragon, @SamA74

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.