First Published 31/10/2019
Contents
Prerequisites
- A working Laravel/Homestead environment.
Installation
- In the Homestead.yaml file create a new site mapping to this directory:
to: /home/vagrant/[project_dir]/[project_name]/public/web
.
- Create new homestead site
composer create-project --prefer-dist laravel/laravel [project_name]
- Create a new database for the Homestead site called
craft_homestead
- Create a second database for the Craft installation called
craft
- Navigate to your new site’s public directory and edit the
.env
file. Add the credentials for the craft_homestead
database.
- Navigate to the Homestead directory and run
vagrant ssh
. Now move into the new project directory cd [project_dir]/[project_name]
and run the migration: php artisan migrate
. Once this has completed exit
the ssh connection.
- Navigate to your new site’s public directory and empty the contents
cd [project_name]/public then run sudo rm -rf *
- Move back to the root of the new site and install Craft in the public directory
composer create-project craftcms/craft public/
- You can now run the Craft setup wizard from the browser, go to
http://[project_name]/index.php?p=admin/install
. When prompted for the database details enter the credentials for the craft
database we created earlier.
- Once installed your site will be ready at
http://[project_name]/
.
Updating php.ini directives
- Once installed Craft may show some errors in the Requirements area of the System Report —
admin > Utilities > System Report
. To fix these we need to make changes to the php.ini file on the vm.
- Navigate to the Homestead directory and run
vagrant ssh
.
- The php version Craft is using can be found at the top of the System Report page.