Deploy a Laravel application to Traxio

Build a Laravel app locally, upload it with the code outside public_html, configure .env, import the database and schedule the task runner.

AdvancedAbout 60 minutes11 steps

What you’ll need

  • A working Laravel app locally with Composer and Node
  • DirectAdmin access
  • Your DirectAdmin username

Laravel expects only its public/ folder on the web. This layout keeps application code, .env and storage outside public_html. The same approach works for Symfony and other Composer-based frameworks. Deploying a PHP application (Composer, Laravel and frameworks)

Steps

  1. Step 1: Match PHP versions

    Check the PHP version in composer.json and set the domain to match in Account Manager then Domain Setup. How to change the PHP version in DirectAdmin

  2. Step 2: Build a production copy

    Locally:

    composer install --no-dev --optimize-autoloader
    npm ci && npm run build
  3. Step 3: Package the app

    Zip the project without node_modules, .git and your local .env.

  4. Step 4: Upload outside the web root

    Upload and extract to /home/USERNAME/apps/myapp. How to upload and extract a zip file

  5. Step 5: Publish the public folder

    Copy the contents of apps/myapp/public into domains/yourdomain.co.uk/public_html, including .htaccess.

  6. Step 6: Repoint index.php

    Edit public_html/index.php so the vendor/autoload.php and bootstrap/app.php paths reach /home/USERNAME/apps/myapp/. Use absolute paths to avoid counting ../.

  7. Step 7: Create the database

    Create a database and user. How to create a MySQL database in DirectAdmin

  8. Step 8: Configure .env

    Create apps/myapp/.env with APP_ENV=production, APP_DEBUG=false, APP_URL, APP_KEY from your local app, and the database details with DB_HOST=localhost. Storing configuration and secrets outside public_html

  9. Step 9: Load the schema

    Run migrations locally against a fresh database, export it, and import on Traxio with phpMyAdmin. Export a database and import it somewhere else

  10. Step 10: Storage and links

    Ensure storage and bootstrap/cache folders are writable (755). For public uploads, copy or create public_html/storage pointing at your storage files, or serve them through a route.

  11. Step 11: Schedule the task runner

    Create a cron job every minute:

    /usr/local/bin/php /home/USERNAME/apps/myapp/artisan schedule:run >> /dev/null 2>&1

    How to create a cron job in DirectAdmin

Check it worked

The app loads at your domain with APP_DEBUG=false, database-backed pages work, and .env is not reachable at any URL.

If something goes wrong

What happensWhat to do
500 errorCheck the domain error log and storage/logs/laravel.log. Usually a path in index.php or .env. 500 Internal Server Error: how to fix it
Class not foundvendor/ wasn’t uploaded completely. “Call to undefined function” PHP error
Stale configurationDelete cached files in bootstrap/cache/ after changing .env.

New to Traxio? The PHP hosting page lists the PHP versions, database and tools every account gets, free for the first 30 days.

Popular

Tip: press / to search from any pageSee all results