It’s a lovely day tomorrow: Installing Vagrant, Virtualbox, Homestead and Laravel, and integrating it with PhpStorm

The above is something I have been struggling with over the last couple of days. I have sent a bug report to JetBrains the author of PhpStorm regarding this and have I posted a query to Stack Overflow. In the meantime I am looking at yet another tutorial for installing Vagrant, Virtualbox, Homestead and Laravel. This time with the assistance of the Youtube channel Code Course a channel I have found to be helpful in learning to code better.

Anyway this note to myself, something to slow me down and something which may be useful to others to see how I have attempted to resolve what for me at the moment is a dead end.

At this point I have installed Vagrant, Virtualbox, Homestead and a base version of the Laravel website which I can view on my host machine. All good. However when I attempt to create a project based on the synced code PhpStorm crashes magnificently.

So what next? I will listen to the pleasant English tones of the chap at Code Course and let him explain to me how he goes about the task as seen in the title. Making brief notes re stuff I need to remember or which I didn’t previously know.

Video 1 Laravel / Homestead guide

  • Virtualbox is a hypervisor : software that allows you to create virtual machines on your host machine
  • Vagrant is a helper which assists Virtualbox to easily
  • Larvel/Homstead is a predefined environment which is recommended for Laravel

Video 2 Laravel / Homestead guide

  • Once Vagrant and Virtualbox are installed run the following command to add the Laravel/Homestead box

vagrant box add laravel/homestead

  • Next we need to clone the Homestead repository to manage websites change settings and to start up the Homestead server etc. For this we create a directory and run the following command from within this directory.

git clone https://github.com/laravel/homestead.git

  • On Ubuntu I now run

bash init.sh

  • The above command generates amongst other files the configuration file for Homestead: Homestead.yaml . This file has entries for configuring ssh, shared folders and nginx’s domain entry. Info on how to do this is here. Remember to add a related domain entry in the /etc/hosts
  • Once the required changes have been made to the yaml file we then bring up the Homestead machine by running the below from within the Homestead directory.

vagrant up

  • If all goes well we should now have a working machine which we can ssh to.
  • Looking back at the output of the command we can see the ports that the Homestead ports have been forwarded to.
    • http 80 -> 8000
    • https 443 -> 44300
    • MySQL 3306 -> 33060
    • ssh 22 -> 2222

Video 3 Laravel / Homestead guide

  • Homestead is now up and running and we can now ssh into our Homestead box. We do this from within the Homstead directory on our host machine.

vagrant ssh

  • We now need to install Laravel globally on our virtual machine. This is done within our main code directory

composer global require laravel/installer

  • And now create a new Laravel site

laravel new <sitename>

Later that day ……..

  • The site was created and could be seen on the host on the domain as entered in /etc/hosts and on port 8000
  • Now for the big kerfuffle could I create a PhpStorm project using the synced content as my project soure …….. NO WAY . The thing fell over as it did previously whilst indexing.
  • What next ah what has just turned up in my email box and email from JetBrains ….. this is a know issue ARGGHHHHHHHHH. Or to quote

As for the crash – that’s a known issue, our developers are looking into it: https://youtrack.jetbrains.com/issue/JBR-1223. You can vote for or comment it in order to get notified about its updates.
The crash happens inside Java 11 virtual machine. As a workaround we can suggest running IDE on Java 8. Here’s a link to latest PhpStorm version with Java 8 bundled: https://download.jetbrains.com/webide/PhpStorm-2019.3.2-jbr8.tar.gz – please unpack it into an empty directory.

I think all of this is an illustration of how things work – it is a lovely day tomorrow to quote a cheesey Broadway song. Not sure about today ; )

PhpStorm in a teacup

There is nothing more annoying in IT – but I’m sure there is – as having to do something manually that you know can be automated. A case in point is opening up PhpStorm as some one else in order to edit files which do not belong to you. The problem is that you have to go into command line mode to to this. This is my storm in a tea cup!

The problem: how to launch PhpStorm on the desktop to edit files not owned by yourself.

Assuming you have already installed PhpStorm.

First you will need to install gksu to use gksudo

sudo apt-get install gksu

And then you will need to edit the PhpStorm desktop launch file. I use the command line application ‘vi’ but you can use any editor.

sudo vi /usr/share/applications/jetbrains-phpstorm.desktop

Edit the line

Exec="/home/user/Desktop/PhpStorm/bin/phpstorm.sh" %f

And update with

Exec=gksudo -k -u <user> "/home/user/Desktop/PhpStorm/bin/phpstorm.sh" %f

When you launch PhpStorm from your desktop you will be requested to input the <user> password. You will now be able to edit files not owned by yourself.

The ups and downs of web development

Another day another bad pun. I have just obtained a standing desk which can be lowered and heightened using a handle. This handle winds the desk up and down: the desk is hence a standing and a sitting desk.

I have the one from IKEA which can reach a height of 120cm – which is tall enough for someone who is 196cm. The desk is branded with the name Skarsta . Why? who makes up these names?

I am just into my second day with the desk. What is interesting so far is that I am more aware of my energy levels when standing. Not being aware of energy levels I reckon means continuing to work when you really need a break; how much non-productive work happens when this happens.

I have just ordered a flat treadmill which will fit under the desk, it will help me to keep moving when I am working – remaining stationary is for me the curse of working with computers. I will get back with another blog when the treadmill is delivered. I might be tempted to do the unboxing thingy ma bob.

Write it and they will come

Create a blog if you want to advance your career in technology: so says Tania of https://www.taniarascia.com/ .

But why of all the literally millions of voices on The Web listen to anyone in particular. I guess this is what The Web is about choosing who we listen to.

In my particular case I estimate Tania to be a person who knows her stuff when it comes to web development, and she doesn’t scare me: she seems nice. It helps also that she a woman in what is in the main a mans technical universe. Writing a blog also lends itself to accountability.

And Tania though you might never see this blog and my notion of being accountable might be only in my head, still it helps. And see I’ve just written my first blog!