How to install Laravel (5.6) on Uberspace (7)
Published 2018-07-16, 12:57
Laravel is a great PHP framework, and Uberspace is a great and nice PHP host. Why not mix both?
Installing Laravel on shared hosting – which Uberspace still is despite the shell access etc. – can be difficult, especially because of public
folder that is used to respond to requests instead of the project root.
Here are the basic instructions for getting a new Laravel project to respond to calls of your <username>.uber.space
domain:
- Switch folder to
/var/www/virtual/<username>
. composer global require "laravel/installer"
to install the Laravel Installer.- Create a new Laravel project:
laravel new <projectname>
. - Delete
/var/www/virtual/<username>/html
(make sure it is empty, or just rename it maybe) and replace it with a symlink fromhtml
to<projectname>/public
. - The default Laravel start page should now be available at your
<username>.uber.space
.
To be able to use the database in the project, you have to make some changes:
- Get your generated MySQL password from
~/.my.cnf
. - Update the
.env
file in your Laravel project:
Username and database should be changed to your username, the password to the one you just retrieved. - Caution: At the time of writing Uberspaces uses MariaDB 10.1.34 (find out by using the command
mysql -v
). Laravel needs some tiny changes if you work with MariaDB <10.2.2:- Edit the
app/providers/AppServiceProvider.php
file and add the following:use Illuminate\Support\Facades\Schema; public function boot() { Schema::defaultStringLength(191); }
(Add both the method call and the import!)
- Edit the
- Now you can run
php artisan migrate
in your Laravel project to create the default tables.
Of course you probably don’t want to host your project at your uber.space
domain, not create a new project but check out your already developed project from git, and also not use the default database – but I am sure you can find your way from here.
Zum Artikel How to install Laravel (5.6) on Uberspace (7) sind noch keine Kommentare vorhanden. Deine Meinung wäre jedoch willkommen!