Setting up Laravel with MAMP and Shared Hosting

For web applications, as opposed to public facing web sites, for which we use WordPress, we usually use Laravel for our php framework.  I am in love with Laravel.  It just makes programming and web development fun again.

It also allows me to focus on the business logic without starting from scratch for every project.

To install Laravel, I follow the Laravel documentation for installation with a few changes.

The first time I used Laravel for a project, I installed Laravel on my Mac using composer.  I just followed the instructions in the Laravel documentation.  I only had to do that once.  I keep it updated through composer.

Now, when I’m ready to start a new project, I can just go to my terminal, change to the directory where I want my new project to be located (I use /code for my projects) and type:


laravel new {project}

where {project} is the name of the project I want to create.

A new folder with the project name I used in that command now appears in my code directory with the Laravel framework installed.

The Laravel instructions recommend using Homestead or Valet for your development environment, but I prefer to use MAMP for a number of reasons.

  • I find MAMP easier to use overall.
  • I work in other platforms and although I could get Valet (I prefer it over Homstead) to work with my other projects, I’ve found it more difficult to set up than MAMP.
  • Valet uses nginx for the server and since most of my live sites are on servers with cPanel, they use Apache instead of nginx.

I could just set up MAMP to use the public directory as it is installed, but since my live sites use cPanel, the public directory should be named ‘public_html’ instead of ‘public’ to make the transfer easier.

All I have to do to make this work is rename the folder named ‘public’ in the fresh Laravel install to public_html, set the document directory in MAMP to the public_html folder and restart MAMP.

Works like a charm.  Now I can just upload the files in the same directory structure to my shared hosting account.

I know many hardcore Laravel programmers advise against using shared hosting, but I’ve been doing it for years with no problems.  Of course, I use our shared hosting accounts here at Cullen Web Services where I have more control.

I would not use Laravel on the cheap shared hosting accounts that you can get (i.e. GoDaddy, HostGator, etc.) for several reasons.  But, then again, I wouldn’t host anything on those cheap hosting accounts.  A lot of my clients come from those environments because they have problems.

Get your shared hosting for Laravel with Cullen Web Services here.

So, to recap, when I start a new Laravel project, all I have to do is (assuming Laravel has been installed on my Mac):

  • type ‘laravel new {project}’ in my Mac terminal (where {project} is the name of my new project)
  • change the ‘public’ folder name to ‘public_html’
  • add the new project to MAMP, setting the document root to the public_html folder I renamed.
  • restart MAMP

It’s that easy.

Need help setting this up?  Contact us!

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top