Setting up Laravel on Dreamhost VPS.
I inevitably google these things in advance so here’s my chance to pay it forward. The good news is it’s incredibly easy.
Set up PHP 7.1 as the command-line binary:
- Create a fully-hosted, choosing your VPS as the destination server. By default it’s going to set the web directory to
/home/username/{domain}
and you’ll want to append/public
to the end of that. Use (or create) a user with shell access, the default is SFTP only. Make sure you set the PHP version to 7.0 or 7.1 if you’re using Laravel 5.3 or later. I’m using 7.1 for these examples. - That’ll take 5 or 10 minutes to get set up, and then it’ll email you with the address to use to SSH in.
- If you do a
php -v
you’ll notice that 5.6 is the default binary used (at the time of this writing). Change it to 7.1 by doing the following:
export PATH=/usr/local/php71/bin:$PATH
. ~/.bash_profile
Now your php -v
should show 7.1.
Enable PHAR:
nano ~/.php/7.1/phprc
- Add the following 2 lines and save:
extension = phar.so
suhosin.executor.include.whitelist = phar
Install Composer:
mkdir -p ~/.php/composer
cd ~/.php/composer/
curl -sS https://getcomposer.org/installer | php
mv composer.phar composer
chmod +x composer
export PATH=~/.php/composer:$PATH
Install Laravel:
rm ~/{domain}/*
(Composer won’t install anything to a non-empty directory.)cd ~
composer create-project --prefer-dist laravel/laravel {domain}
Composer will then do its thing and after a little while, you’ll be finished. Check your website and you should see the Laravel splash screen.
comments powered by Disqus