ServerPilot | Import Existing Laravel Project

Installing Your Laravel Project

So, it's time to install your Laravel project in your new app. How is that done with serverpilot?

SSH in to your server as serverpilot and run the following commands (where APPNAME is the name of your app):

cd apps
rm APPNAME/public/index.php
rmdir APPNAME/public
git clone https://UserName@bitbucket.org/UserName/project.git APPNAME

This final command will take several minutes to complete. You should see many packages download and install.

Next, we must configure our application.

composer install

This will install all of the necessary packages to make Laravel run. A common error you see when needing to run this is something like '', though it will sometimes merely say '500 error' which is entirely unhelpful. Sometimes (often times for me), after I run this command I get: 'file_put_contents() permission denied.' To fix this, I run this basic command which will fix the permissions for a laravel app (unless ownership is incorrect. Some folders, when uploading files to them, need ownership of the targeted directory).

# This command will fix permissions of your app under the serverpilot user
echo “Fixing folder permissions…” && find . -type d -exec chmod 0755 {} \; && echo “Successfully fixed folder permissions \n Fixing file permissions.” && find . -type f -exec chmod 0644 {} \; && echo “Successfully fixed file permissions. \n Fixing storage permissions…” && chmod -R 777 storage && echo “Successfully fixed permissions \n Clearing application cache to register new permissions…” && php artisan cache:clear

# If you see 'permission denied' while running the above command (most likely because you're not logged in as serverpilot), run this one
echo “Fixing folder permissions…” && sudo find . -type d -exec chmod 0755 {} \; && echo “Successfully fixed folder permissions \n Fixing file permissions.” && sudo find . -type f -exec chmod 0644 {} \; && echo “Successfully fixed file permissions. \n Fixing storage permissions…” && sudo chmod -R 777 storage && echo “Successfully fixed permissions \n Clearing application cache to register new permissions…” && php artisan cache:clear

Now, your app should be working!

NOTE: If you are still seeing a 500 error, there could be many reasons. Check your app's error log for what is causing the problem. A Problem I have had is in the .htaccess when I set php_value options to localize php changes, rather than changing them in php.ini.

P.S. DON'T FORGET YOUR .ENV FILE, and don't forget to generate a key: 'php artisan key:generate'