Your Laravel project is already built. On cPanel the deploy usually fails in one of two ways: the whole tree lands in public_html, or the first visit is HTTP 500. Here is how to host a Laravel project on cPanel without either result. Point the domain at public/index.php, and keep every other file, including .env, outside the folder the web can read.
Run the account check before you zip anything. Layout, upload, database, and a single error table follow in that order.
Check the cPanel account before you upload anything
Yes. This account can run the project when the domain's PHP matches the app, the extensions below are enabled, and Domains can aim the site at public. A primary domain fixed to public_html still qualifies if a later fallback is allowed. Open MultiPHP Manager or Select PHP Version, then Domains, then Cron Jobs, before any upload.
Match PHP and extensions to the Laravel version you are shipping
Read the PHP line in composer.json. Laravel's deployment documentation currently requires PHP 8.3 or higher for Laravel 13, plus Ctype, cURL, DOM, Fileinfo, Filter, Hash, Mbstring, OpenSSL, PCRE, PDO, Session, Tokenizer, and XML. Older apps follow their own constraint. Check that page again on deploy day. The minimum moves with the release.
Set the version in MultiPHP Manager, or in Select PHP Version on CloudLinux. Enable missing extensions for this domain only. cPanel's install notes show Composer stopping when Fileinfo is absent.
Confirm Terminal, cron, and document-root control
php -v in Terminal must meet the version you selected. If it is older, copy the full binary path. On EasyApache it usually sits under /opt/cpanel/ea-phpXX/root/usr/bin/php. Confirm the path on this server. Cron will use the copy.
Cron Jobs is listed in the menu.
Domains shows whether this hostname can leave public_html. On many servers the primary domain cannot. An addon domain or a subdomain can.
HostCry has offered hosting since 2017. Ask whether the primary document root is locked before you pick a layout. Moving files will not unlock it.
Build the production files on your computer
Build on your computer when the account has no Node or no Composer. Use a PHP release on the same major line as the server.
Run composer install --no-dev --optimize-autoloader, then composer check-platform-reqs, then npm run build so public/build exists. Platform-reqs fails on the desktop if the server PHP would reject the lock file. Composer documents --no-dev and the optimised autoloader as the install you ship.
Dependencies can go on the server instead, but only where Composer and SSH already exist. HostCry's Laravel plans include both. Otherwise vendor belongs in the zip. With no Terminal, generate APP_KEY locally and save it for the server .env. Other environment values wait until upload.
Put in the zip | Leave out |
app, bootstrap, config, database, public (with public/build), resources, routes, storage, vendor, artisan, composer.json, composer.lock | node_modules, .git, tests, and a development .env |
The archive should open straight onto those folders. An extra parent directory is how the domain misses the project after extract.
Choose where the domain points so .env stays private
Point the domain at public. Symlink public_html only when the primary root is locked and the host allows links. Copy the files inside public only when symlinks are blocked. Leave app, vendor, and .env off the web. Laravel's deployment documentation says every request should reach public/index.php, and that moving index.php onto the project root exposes configuration files.
Layout | When you can use it | What the web can see | What goes wrong |
Addon or subdomain root is myapp/public | Domains lets you edit that hostname | Only public | A root of myapp exposes the whole project |
public_html symlinked to myapp/public | Primary root is locked, symlinks allowed | Only public | A blocked link breaks the hostname. Restore the renamed folder |
public files copied into public_html, app kept outside | Symlinks are blocked | Only the copied files | URLs fail without usePublicPath(), and upgrades must revisit the copy |
Whole project in public_html, rewrite on the project root | Popular, and the wrong choice | Project root, once the rewrite stops | .env can be requested directly |
Point an addon domain or subdomain at public
Put the project in the home directory, for example /home/username/myapp, beside public_html. Set that hostname's document root to myapp/public. Keep this layout whenever Domains allows it.
Symlink the primary domain when its document root is locked
Use the note from the account check. Where the primary root cannot move and symlinks are allowed:
Rename public_html to public_html_backup.
Link public_html to /home/username/myapp/public.
Restore the backup folder at once if the hostname is a broken link.
Stop when the host has disabled symlinks. This link is only the web root. The storage link comes later and is a different path.
Copy only the public files if symlinks are blocked
Leave the application outside the web root. Copy the contents of public, including .htaccess, into public_html, and point the copied index.php at the outside application. On current Laravel, call usePublicPath() so generated URLs use the folder visitors actually hit. Review that copy on the next framework upgrade. This is the last resort.
These accounts run on Apache or on LiteSpeed. Both honour a document root and the .htaccess file inside public.
Upload the project and connect MySQL
You host the Laravel project on cPanel by uploading that build, applying the layout already chosen, and connecting a database whose names match .env.
Upload the build and set the web root
Copy the live public_html and its database before you extract or rename. Prefer SFTP for a large archive. File Manager often stalls on vendor. Extract in the home directory, not over a site that is still live. Apply the document root, the symlink, or the public-file copy. Include vendor when it was built locally. Run Composer on the server only if that account already has it. Some plans offer Git as well. These steps stay on a zip or on SFTP.
Create the database and write .env
In MySQL Databases, create a database and a user, then grant that user all privileges on that database. cPanel prefixes both names with the account username. cPanel's Laravel notes show the pattern: the account cptest yields a name such as cptest_laravel. Copy both strings from your panel. In File Manager, show hidden files first. Dotfiles such as .env stay invisible until that toggle is on.
APP_ENV=production
APP_DEBUG=false
APP_KEY=base64:the-key-you-generated
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=account_dbname
DB_USERNAME=account_dbuser
DB_PASSWORD=the-password-from-the-panel
Use 127.0.0.1 for DB_HOST. On some cPanel servers localhost tries a socket the account cannot open. Laravel's deployment page says APP_DEBUG must be false in production, because true can show configuration to anyone who triggers an error. Import the SQL dump in phpMyAdmin, or run php artisan migrate --force from Terminal. An "access denied" reply means the prefix or the user grant is wrong. Fix those strings rather than creating another empty database.
Make the cache folders writable and open the homepage
Folders are 755 and files are 644. storage and bootstrap/cache must be writable by the PHP user. Skip 777.
Open the homepage, then open /up. Laravel's health route returns HTTP 200 when the application has booted cleanly. That 200 ends the upload. The certificate, public file URLs, and the scheduler are still separate.
Turn on HTTPS, public storage, and the scheduler
A working homepage still leaves three production settings.
Serve the site over HTTPS
Run AutoSSL or the host's Let's Encrypt action. Set APP_URL to the https origin, with scheme and hostname and no trailing path. Mixed content after a redirect usually means a link, or a compiled file in public/build, still says http. Rebuild the assets. More rewrite rules will not correct the URL baked into them.
Publish files from storage
From the project directory, run php artisan storage:link. It creates public/storage pointing at storage/app/public. If /storage returns 404 and disabled functions include symlink, ask the host to allow it. Do not replace the link with a redirect route. The web-root symlink does not create this one.
Run the scheduler every minute
Add one cron job, every minute, using the PHP binary saved in the account check:
/opt/cpanel/ea-php83/root/usr/bin/php /home/username/myapp/artisan schedule:run
Replace both paths. Laravel's scheduler expects that command once a minute. The bare command php is how the site runs on 8.3 while the task dies on an older command-line binary.
Then run php artisan optimize. Cached config ignores later .env edits until php artisan optimize:clear, and env() outside config files returns null after the cache. Edit, clear, then optimize again.
Shared hosts often block PHP's local mail. Set MAIL_MAILER from the SMTP details the host gives you, and finish the mailbox in the host's mail screen.
Trace the first error to one cause
Open cPanel's Errors log before storage/logs/laravel.log. Laravel cannot write its log until storage is writable, so that file stays empty on the outage you need to see. Match one row, change that cause, and reload /up.
What you see | Look here | One cause |
HTTP 500, blank page | cPanel Errors | Missing APP_KEY, or storage is not writable |
SoftException: index.php writable by group | That file's mode | suPHP rejects group write. cPanel documents it as a handler error. Remove the group-write bit |
Class or extension error | PHP screen from the account check | Wrong PHP, or an extension from that list is off |
Vite manifest not found | public/build | Front end was not built, or the domain is not on public |
CSS or images 404 | Document root and APP_URL | Web root is one folder off, or usePublicPath() was never called |
Database access denied | DB_DATABASE, DB_USERNAME | Prefixed names disagree with the panel, or the user was not added |
Homepage works, /storage does not | public/storage | Storage link missing, or symlink() is disabled |
One matching row is the whole repair. A second forum recipe usually moves the error sideways.
Know when shared cPanel cannot run the app
Shared cPanel can serve requests, run schedule:run, and drain a light queue with queue:work --stop-when-empty from cron. It cannot keep Horizon, Reverb, Echo, or Octane under Supervisor. Laravel's deployment notes talk about reloading those processes, which assumes a server allowed to leave one running.
Stays on shared cPanel | Needs a process manager |
Requests, the scheduler, a short cron burst for a database queue | Horizon, Reverb, Octane, or any worker that must stay up all day |
Redis is not the same thing as a daemon, and not every shared plan has it. Check before you set QUEUE_CONNECTION=redis. If you are still choosing an account, compare SSH, Composer, PHP versions, Redis, and cron with the published Laravel hosting list, and rely only on what that page includes.
Confirm the account can finish the job
Call the deploy finished when the domain, the database credentials, and production mode agree with the settings you already made. If this account cannot change PHP, point a domain at public, or run cron, choose a plan that provides those three. Confirm each one in the panel before you start the upload over. Readers who still need hosting or a domain can arrange both with HostCry.