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.
On this page
- What you’ll need
- Step 1: Match PHP versions
- Step 2: Build a production copy
- Step 3: Package the app
- Step 4: Upload outside the web root
- Step 5: Publish the public folder
- Step 6: Repoint index.php
- Step 7: Create the database
- Step 8: Configure .env
- Step 9: Load the schema
- Step 10: Storage and links
- Step 11: Schedule the task runner
- Check it worked
- If something goes wrong
- Level
- Advanced
- Time
- About 60 min
- Steps
- 11
- You’ll finish with
- A working result, checked
11 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)
Step 1: Match PHP versions
Check the PHP version in composer.json and set the domain to match in Account Manager › Domain Setup. How to change the PHP version in DirectAdmin
Step 2: Build a production copy
Locally:
composer install --no-dev --optimize-autoloader
npm ci && npm run buildStep 3: Package the app
Zip the project without node_modules, .git and your local .env.
Step 4: Upload outside the web root
Upload and extract to /home/USERNAME/apps/myapp. How to upload and extract a zip file
Step 5: Publish the public folder
Copy the contents of apps/myapp/public into domains/yourdomain.co.uk/public_html, including .htaccess.
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 ../.
Step 7: Create the database
Create a database and user. How to create a MySQL database in DirectAdmin
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
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
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.
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>&1How 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 happens | What to do |
|---|---|
| 500 error | Check 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 found | vendor/ wasn’t uploaded completely. “Call to undefined function” PHP error |
| Stale configuration | Delete 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.
Where this fits: DirectAdmin hosting explains the control panel every Traxio account uses, with a tour and tutorials.
Spotted something out of date or unclear? Tell us and we’ll fix it.