Setup Digital Ocean - Part 9 Laravel

David Carr

VPS Tutorials Digital Ocean


The following steps are needed for running Laravel on Digital Ocean.

Laravel needs mbstring it’s not installed, don’t edit php.ini that causes more problems instead:

sudo apt install php-mbstring

Then activate it:

sudo phpenmod mbstring

To turn off modules you can use phpdismod 

Next install zip and dom

sudo apt install php-zip
sudo apt install php7.3-xml

Restart Apache2

systemctl restart apache2

Installing Laravel

composer create-project --prefer-dist laravel/laravel foldername

If you get the error:
proc_open(): fork failed - Cannot allocate memory_

A swap file is needed run this on the root:

sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

cd into the laravel folder and change permissions by running:

sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache

Copyright © 2006 - 2024 DC Blog - All rights reserved.