Laravel Homestead installation on Mac

Larval Homestead(0.33)  installation on Mac El Capitan.

Assuming that the latest Virtual Box is already installed, the following are the basic steps required to get the Laravel Homestead box up and running without any errors. Might save a bit of headache for others or for myself in the future.

1. The command as given in Laravel Official Installation docs

vagrant box add laravel/homestead

did not work for me. I downloaded the box from https://atlas.hashicorp.com/laravel/boxes/homestead/versions/0.3.3/providers/virtualbox.box

2. Run:

vagrant box add laravel/homestead <virtualbox zip file>

3. Make an entry in /etc/hosts file as

192.168.10.10  homestead.app

4. Do a vagrant up.

5. If step 3 fails with SSH timeout error, Create new ssh key-pair in a new    location : ssh-keygen -t rsa -C “you@homestead”

6. Set the SSH file locations in ~/.homestead/Homestead.yml

7. Do vagrant up – this time it should succeed.

8. Do a vagrant ssh (This should login the user to the vagrant VM)

9. Create folder structure to reflect the ‘sites’ to the section of the ~/.homestead/Homestead.yml file, typically /home/vagrant/Code/Laravel/public ( Initially, the Laravel/public folder is missing)

10. Ensure the ‘folders’ map section of the ~/.homestead/Homestead.yml file points to a legitimate directory. This will be synched with the vagrant box folder. This is the folder in the host OS( in this case Mac OS El Capitan).

11. Put a info.php with the content <?php phpinfo(); ?> inside the folder created in step 8.

Now, opening http://homestead.app/info.php should open up the php information page indicating that the setup is now complete.

Ahoy Sailor on your Laravel journey!

Setting up WordPress locally on Mac OS X

This is specifically for installing WordPress 4.0 and serving it locally using MacOS X built-in Apache.

My recent fascination with WordPress started with me heading to www.wordpress.org and downloading the zipped version. Once downloaded you have to unzip it using tar -xvf command (if unzipping from command line) – or just double click the file in Finder.

To setup WordPress, basically the following are required:

PHP ~ 5.4

MySQL

Apache HTTP server (NOT Tomcat – which is a Webserver)

These should already be available and can be easily checked.

Ensure PHP module is enabled

Go to /etc/apache2 and do a ‘vi httpd.conf’

This folder maybe write protected – so use a sudo if the it complains that the file is in read-only mode.

Uncomment the line:

#LoadModule php5_module libexec/apache2/libphp5.so

and ‘press Esc -> :wq’

That’s it. Now restart apache using ‘sudo apachectl restart’ and you’re good to go.

Just to check if PHP was enabled properly, create a file called info.php at /Library/WebServer/Documents folder and put the following in the file:

<?php phpinfo(); ?>

If you open a browser, and hit the URL : http://localhost/info.php, it should now spit out the entire PHP environment details thereby confirming that the PHP enablement in Apache had gone fine.

Prepare MacOS Apache to server the wordpress content.

The default location of the files being served is /Library/WebServer/Documents. If you can’t find the folder in Finder, Press Cmd + Shift + G, and then enter the location manually.

Next, either copy the unzipped WordPress folder in this directory OR make a new folder inside the above folder (say xyz) and paste the unzipped WordPress folder contents into this.

Now, head over to http://codex.wordpress.org/Installing_WordPress and follow the steps. Just make sure the DB connection details are correct.

WordPress is installed successfully. Enjoy !