Black Friday sale is now on! 50% off Laravel: The Modular Way. Learn more

Setup Digital Ocean - Part 9 Laravel

David Carr

Digital Ocean VPS Tutorials


    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

    Laravel Modules Book by David Carr

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

    Subscribe to my newsletter

    Subscribe and get my books and product announcements.

    © 2009 - 2022 DC Blog. All code MIT license. All rights reserved.