I first started using DreamHost shared hosting in college, as an affordable means of hosting web projects. It includes domain management, no hassel SSL certs, MySQL databases, and more. It’s a great solution for most PHP projects.
My largest frustration was being unable to host more interesting projects; due to the restrictive nature of shared hosting, I had no installation privileges on the server. Without these, running composer is next to impossible. I recently pieced together the process for getting Laravel on DreamHost, and I wanted to share my findings.
Note: I’m assuming that you, the reader, have experience with DreamHost and Laravel, and I won’t bog down this walkthrough with every minute step of the process.
Create a new domain/subdomain.
Add /public
to the end of the web directory field. This is because Laravel’s index.php
file is located here, and is the entry point for all requests.
If you’re not using another database provider, create a database through DreamHost (it’s included). On the DreamHost admin menu, under “Advanced”, you’ll see “MySQL Databases”. Create a new database, and note the Hostname URL, database name, database username, and database user password.
N.B. If you’re doing local development, you’ll have to add your IP address to the database user’s allowed IP address field. You can find it by clicking the username in the table at the bottom of the databases page. Any DreamHost domains are added by default.
Create a new Laravel project locally, or get into the parent directory of your existing project.
Zip the directory, and upload it to DreamHost. For Mac/Linux users, you can use SCP to quickly upload from the command line. Otherwise, use DreamHost’s in browser FTP service.
Unzip on the server. You can do this via DreamHost’s in browser FTP service.
Configure your .env file with the APP_URL and database values you noted down earlier.
Initialize a git repository in your Laravel project if you don’t have one already. I would recommend using Laravel’s .gitignore to filter out sensitive files, but it’s your choice. Publish your repository.
Clone that git repo in your domain directory on DreamHost. git clone https://url-to-git-repo.git .
That
period is important, as it tells git to pull files to current directory, and not create a new
directory.
Upload any missing files via SCP or DreamHost’s in browser FTP. You might find a hint as to what files are missing in your repo’s .gitignore file.
app/Providers/AppServiceProvider.php::boot()
with
public function boot()
{
Schema::defaultStringLength(191);
}
This will allow migrations to work with DreamHost’s older MySQL database system.
And that’s it! Now you’re ready to start developing and deploying Laravel applications for dirt cheap.
I’d like to thank Alesh Houdek for the well written article that allowed me to get up and running on DreamHost.
homeI'm a software developer, philanthropist, biker, cyclist, hiker, gamer, drone pilot, photo bug, and all around DIY enthusiast. I like to think I can cook, and enjoy a good game of PUBG/WarZone every now and then.
Yell at me on twitter,
github,
and at home.
Typically present with the handle @dengsauve
on most sites.