FAQs

How do I stop the box?

Run vagrant halt to stop the box.

How do I destroy a box?

To completely destroy the virtual image, run vagrant destroy.

To create the image again run vagrant up.

How can I update the box to the latest version?

If a new version of the box is released, Vagrant will let you know when you run vagrant up. It’s important to note that Vagrant stores the original box separately. Your running Vagrant environment is actually a copy of that box. From the Vagrant docs:

Finally, you can update boxes with vagrant box update. This will download and install the new box. This will not magically update running Vagrant environments. If a Vagrant environment is already running, you’ll have to destroy and recreate it to acquire the new updates in the box. The update command just downloads these updates locally.

In short: if you have important data on the box, be sure to back it up first. As of version 1.4.0 the box will automatically backup your virtual hosts and MySQL databases before you destroy it. Your code will remain on your host machine (in the www directory) even after destroying the box, so these will not be included in the backup file.

Once you start the box up again, it will restore the backup. After you have verified everything is working again, you should manually remove the joomla-box-backup.tar file.

In summary, you need to run these commands in the following order to update a box:

vagrant destroy
vagrant box update
vagrant up

How can I access the command line on the box?

You can always run commands via the web terminal, accessible at the joomla.box dashboard as soon as the box is up.

Alternatively, you can SSH into the box by using the command:

vagrant ssh

How can I access the MySQL databases?

The MySQL server on the box runs with these default user credentials:

  • User: root
  • Password: root

So to connect via PHP you would pass in these details:

$connection = mysqli_connect('localhost', 'root', 'root', 'mydatabase');

If you prefer to, you can use phpMyAdmin at phpmyadmin.joomla.box if you setup your hosts file correctly, as described in the installation steps.

We highly recommend the Sequel Pro desktop client on Mac OS X over the use of phpMyAdmin however. You can connect to the database using a desktop client with the following details:

  • Host: 33.33.33.58
  • User: root
  • Password: root

Where are the error logs and access logs?

You can access Apache, MySQL and system logs via the browser at joomla.box/pimpmylog.

How to test e-mails?

We have installed MailCatcher on the box. You can access it via the dashboard.

PHP is configured to automatically send any mail to MailCatcher. You can test this real quick by creating a new Joomla site, creating a contact form and submitting it. Your message will show up in MailCatcher immediately.

If your applications use SMTP, you can configure your SMTP server as follows to send everything to MailCatcher:

  • IP: 127.0.0.1
  • Port: 1025

Can I mount more shared directories?

Yes, you can mount as many shared directories as you like. You can do so by creating a config.custom.yaml (example) file in the same directory that contains your Vagrantfile.

To mount the /Users/johndoe/MyProjects directory on the box, put the following configuration in config.custom.yaml:

synced_folders:
    /home/vagrant/MyProjects: /Users/johndoe/MyProjects

Save this file and restart the Vagrant box using the vagrant reload command.

The MyProjects directory from your host machine will now be available inside the Vagrant box at /home/vagrant/MyProjects.

Where can I find phpMyAdmin?

After you modify /etc/hosts as shown above you can use phpMyAdmin at

http://phpmyadmin.joomla.box

How can I use PhpMetrics?

To gather various metrics about your PHP project, you can invoke PhpMetrics from the command line. Please note that PhpMetrics uses a lot of memory and so it is best to increase the allowed memory limit first.

Let’s say you want to analyze the mysite site which you installed using joomla site:create mysite:

  1. Open up the web terminal
  2. Increase the memory limit:
box php:ini memory_limit 1024M
  1. Now run phpmetrics:
phpmetrics --report-html=/var/www/mysite/report.html /var/www/mysite
  1. Revert the memory limit to its original value:
box php:ini memory_limit 256M
  1. Read the generated report at joomla.box/mysite/report.html.

How to use Webgrind?

After you modify /etc/hosts as shown above go to webgrind.joomla.box.

Enable the Xdebug profiler with the terminal command box xdebug:profiler start and reload the page you want to profile. Every page you visit will now generate a cachegrind file in /var/www.

Refresh the list of files by pressing the refresh icon in Webgrind (top-right corner of the page), select the file you want to investigate and hit the Update button.

See the box documentation for more info.

I don’t like the command line! Is there another way to manage the Vagrant box?

There’s a great tool we use to start and manage our Vagrant boxes once you’ve installed them, called Vagrant Manager. It is currently available on OS X only, though!

If the Vagrant box is running, you can execute commands on the box using just your browser. All you need is to browse to the dashboard. You can also edit files on the filesystem directly using the file browser.

No need to connect via the command line at all.

Can I SFTP into my box?

Use following details to connect:

  • Host: 127.0.0.1
  • Port: 2222
  • User: vagrant
  • Password: vagrant

Unable to connect Vagrant Guest VM’s in a private network?

Can’t reach the virtual network from your host at all (not even ping) although vagrant ssh works? You will need to have VirtualBox recreate the private hosts.

Luc Russell wrote a great tutorial on this matter.

How can I change PHP ini settings?

You can change PHP’s configuration using the box php:ini command. For example, to disable display_errors, run this command:

box php:ini display_errors Off

This also works for custom PHP builds. For more information on this command, please refer to the documentation.

If you need to make changes directly to the .ini files, you can find php.ini at /etc/php/7.1/fpm/php.ini and additional config files at /etc/php/7.1/fpm/conf.d.

If you switched to a non-default PHP version, you can find php.ini at /opt/php/php-x.y.z/lib/php.ini and the additional configuration directory at /opt/php/php-x.y.z/etc/conf.d/.

How can I run other PHP versions?

It’s possible to build both older and newer PHP versions using the box command. For example, if you wish to test the upcoming PHP 7.2 release, run:

box php:use 7.2.0RC5

Note that on your first run, the script will need to download and install additional build dependencies. This can take up to 15 minutes.

For more information on this command, please refer to the documentation.

Warning: switching the PHP version can potentially leave the box in a broken state. Use at your own risk. If something goes wrong and the box command stops working, you should be able to revert to the default PHP version using the phpmanager restore command.

Need Help?

Let our developers personally assist you. You can ask development related questions in our Support Center. Only for Business or Agency subscribers.