Hi, my name is David Carr and I'm a PHP Developer.


Blog Archives Categories Authors About Me Open Source Books Contact Me

Sponsor Me

Help support the blog so that I can continue creating new content!

My Latest Book

Laravel: The Modular way

Learn how to build modular applications with Laravel Find out more

Setup Digital Ocean - Part 9 Laravel

Digital Ocean | VPS | Tutorials

David Carr

Setup Digital Ocean - Part 9 Laravel


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 © 2009 - 2022 David Carr. All code MIT license. All rights reserved.