Brieflyn
Navigation Menu
Home › Tutorials & How-To › How to Configure Laravel Storage on cPanel in 2026

How to Configure Laravel Storage on cPanel in 2026

How to Configure Laravel Storage on cPanel in 2026
By Brieflyn Editorial Team • Published: August 17, 2026 • 12 min read (2,363 words) • 31 views
Learn how to Configure Laravel Storage on cPanel in 2026, from setting file permissions to creating manual symlinks, using AWS S3, and troubleshooting common errors.

How to Configure Laravel Storage on cPanel in 2026 - terminal screenshot showing storage:link command

How to Configure Laravel Storage on cPanel comes down to three repeatable steps: create a working public/storage symlink, lock down folder permissions, and decide whether your uploads stay local or move to AWS S3. Most "broken image" tickets in Laravel trace back to one of those three points, and cPanel shared hosting makes the symlink step the trickiest. This guide walks through the exact 2026 workflow I use for client deploys on Hostinger, SiteGround, InMotion, GreenGeeks, DreamHost, and similar cPanel-based providers, with the manual, automated, and S3 paths covered in depth.

Overview: Quick Answer to the Core Question

What is Laravel Storage?

Laravel Storage is the framework's filesystem abstraction layer, built on top of the Flysystem library. It gives your app a single API (Storage::disk('public')->put(...)) that can write to local disk, S3, FTP, SFTP, or any custom backend without rewriting upload logic. Under the hood, every "disk" defined in config/filesystems.php maps to a driver and a root path, and the default public disk points to storage/app/public.

Definition: A storage link in Laravel is a symbolic link from public/storage to storage/app/public, created by the php artisan storage:link command. Without it, files written to the public disk remain inaccessible to the browser.

Why cPanel Hosting?

cPanel is still the dominant control panel for shared and managed hosting in 2026, and most small-to-mid Laravel shops deploy there. It gives you File Manager, phpMyAdmin, a built-in MySQL Database Wizard, an optional terminal, and one-click installers that handle the boilerplate. The catch: many shared plans ship without full SSH access, and some hosts block symbolic links at the OS level, which is exactly what makes the storage link step feel harder than it should.

Why Laravel Storage on cPanel Matters in 2026

Detailed image of a server rack with glowing lights in a modern data center.
Photo by panumas nikhomkhai via Pexels. Laravel Storage On Cpanel Technology.

2026 Hosting Trends

The "just use S3" advice has gotten stale. Storage costs on AWS have stabilized but egress fees still bite, and many 2026 cPanel plans now bundle LiteSpeed or NGINX front-ends with generous local NVMe storage. Local storage on a quality cPanel host is faster than S3 for sub-100KB assets, simpler to back up, and zero per-request cost. The pragmatic answer in 2026 is hybrid: keep small thumbnails and avatars on the local public disk, push large media and user-generated video to S3 or a CDN-backed bucket.

Security & Compliance

User-uploaded files are a top-three attack surface for PHP apps. Laravel ships private and public disks so you can keep sensitive uploads (invoices, KYC documents) under storage/app/private and only stream them through a controller. cPanel's public_html is web-accessible by default, so any file you place outside storage/ is publicly indexable. Combine the disk separation with a Laravel .htaccess deny rule for the storage/ directory, and you have a clean security boundary.

Performance Expectations

For a typical Laravel app on a 2026 shared cPanel tier (LiteSpeed, PHP 8.3+, OPcache enabled), local public disk reads return in single-digit milliseconds. S3 over the public internet averages 80-150ms per request, and an S3 read over a CDN-edge drops to 20-40ms. The performance gap only matters once you're serving media-heavy pages; for a SaaS dashboard with a few avatars, local wins.

Prerequisites & Hosting Environment Checklist

cPanel Access & SSH

You need at minimum File Manager access. SSH is strongly preferred because the storage:link command is a one-liner there. Confirm SSH is enabled in cPanel under SSH Access; if your plan doesn't include it, ask the host. Many providers (Hostinger, SiteGround, InMotion) include shell access on their Business and GrowBig tiers, while the cheapest single-site plans often don't.

PHP & Composer Version

Laravel 11 requires PHP 8.2 minimum, and Laravel 12 (the current 2026 line) prefers PHP 8.3. Verify your cPanel's PHP version under MultiPHP Manager or Select PHP Version. Composer must run on the same PHP binary. If you only have File Manager, you can still run composer install locally and upload the vendor/ directory via FileZilla.

Database & File System Permissions

Create a MySQL or MariaDB database through the MySQL Database Wizard, then set the connection details in .env. For permissions, the safe default on shared hosting is directories at 755 and files at 644. The storage/ and bootstrap/cache/ directories must be writable by the web user (usually nobody or the cPanel username).

Preparing Your cPanel for Laravel: File Permissions & PHP Settings

Focused view of a modern data server rack with blinking lights in a blue-lit environment.
Photo by panumas nikhomkhai via Pexels. Laravel Storage On Cpanel Concept.

Setting Correct Ownership

cPanel assigns each account a unique user (e.g., myapp). Files uploaded via File Manager belong to that user; files pushed via git or composer on a different user create ownership mismatches that break the storage link. Run this from SSH before anything else:

chown -R $USER:$USER /home/myapp/public_html
find /home/myapp/public_html -type d -exec chmod 755 {} \;
find /home/myapp/public_html -type f -exec chmod 644 {} \;
chmod -R 775 /home/myapp/public_html/storage
chmod -R 775 /home/myapp/public_html/bootstrap/cache

Adjusting php.ini for File Uploads

PHP defaults in cPanel often cap uploads at 2MB, which kills any app that accepts images, PDFs, or short videos. Edit php.ini via MultiPHP INI Editor (or create one in public_html with user.ini support) and set:

upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 120
memory_limit = 256M

Configuring .htaccess for Storage

Drop this in public_html/storage/.htaccess to block direct browser access to the storage root while still allowing the public/storage symlink to work:

<IfModule mod_authz_core.c>
 Require all denied
</IfModule>

<IfModule !mod_authz_core.c>
 Order allow,deny
 Deny from all
</IfModule>

Manual Storage Link Creation via cPanel Terminal

Using SSH to Create Symlink

From the cPanel Terminal (under Advanced) or an SSH client, navigate into the project root and run the canonical command documented in the Laravel filesystem docs:

cd /home/myapp/public_html
php artisan storage:link

Expected output: The [public/storage] directory has been linked. If you prefer doing it by hand, the underlying command (from the NativeCode cPanel guide) is:

ln -s ../storage/app/public public/storage

Verifying Link Permissions

Run ls -la public/storage. You should see a symbolic link arrow pointing back to ../storage/app/public. If it points to a broken target, the project root isn't where you think it is. The web server reads links transparently, so as long as the target directory is world-readable (755), the symlink itself can stay at 777 on hosts that require it.

Workarounds When Symlinks Are Disabled

Some cPanel providers (mostly bottom-tier shared hosts) disable symlink() in php.ini with disable_functions. Two workarounds: ask the host to enable it (often a one-line support ticket), or skip the symlink entirely and serve uploads through a Laravel route:

Route::get('/storage/{path}', function (string $path) {
 $full = storage_path('app/public/' . $path);
 abort_unless(file_exists($full), 404);
 return response()->file($full);
})->where('path', '.*');

This adds a small PHP overhead per request but works on any host without shell access.

Automating storage:link with Cron Jobs & Artisan

Setting Up a Cron Job

Deployments that re-clone the repo can wipe the symlink. Add a cPanel cron entry under Cron Jobs to recreate it nightly:

0 3 * * * cd /home/myapp/public_html && php artisan storage:link >> /dev/null 2>&

The storage:link command is idempotent: it will re-create the link if missing and report success either way.

Testing the Artisan Command

After adding the cron, SSH in and run the command manually to confirm there are no permission errors. The command exits silently on success, so a missing link is the only real failure signal. Pair it with a quick curl -I https://mydomain.com/storage/ to confirm the directory resolves.

Handling Permission Issues

If the cron fires under the wrong user, the link will be created but Apache (running as nobody) may not be able to traverse it. Set the cron to run as the cPanel user by selecting the right account in cPanel's UI; this is the most common silent-failure cause.

Configuring Local Storage Driver on Shared Hosts

Updating config/filesystems.php

The default config/filesystems.php ships with three disks: local, public, and s3. The public disk is what most apps need. Confirm the root matches your actual project structure on the server:

'public' => [
 'driver' => 'local',
 'root' => storage_path('app/public'),
 'url' => env('APP_URL') . '/storage',
 'visibility' => 'public',
 'throw' => false,
],

Using the Public Disk

Save uploads with the public disk to make them web-accessible through the symlink:

$path = $request->file('avatar')->store('avatars', 'public');
$url = Storage::disk('public')->url($path);

Serving Files Through the Browser

Once the symlink exists, https://mydomain.com/storage/avatars/abc.jpg resolves directly. If the URL returns 404, the most common cause is that the APP_URL in .env doesn't match the actual domain, so Laravel generates URLs with the wrong host.

Integrating AWS S3 with Laravel on cPanel

Installing Flysystem AWS S3 Package

Composer pulls the official adapter:

composer require league/flysystem-aws-s3-v3 "^3.0" --with-all-dependencies

The flag at the end is from the Laravel News S3 walkthrough and ensures peer dependencies get installed cleanly.

Adding .env Variables

Generate an IAM user with the AmazonS3FullAccess policy (or a tighter custom policy), then add four variables:

FILESYSTEM_DISK=s3
AWS_ACCESS_KEY_ID=AKIA...
AWS_SECRET_ACCESS_KEY=...
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=my-laravel-uploads

Testing File Uploads to S3

Switch FILESYSTEM_DISK to s3 in .env, then run php artisan tinker:

Storage::disk('s3')->put('test.txt', 'hello s3');
Storage::disk('s3')->url('test.txt');

If the URL resolves in the browser, your IAM credentials, region, and bucket policy are aligned. A 403 means the bucket policy is blocking the user; a 404 means the region or bucket name is wrong.

Real-World Tradeoffs: Shared vs VPS vs Cloud for Storage

Target PersonaRecommended OptionKey Reason & Real-World Benefit
Solo developer / small businessShared cPanel (Hostinger Business, SiteGround GrowBig)Cheapest path; local storage handles most apps; SSH included for storage:link.
Growing SaaS / agencyVPS (Hostinger KVM 2 at $4.99+) with cPanelDedicated resources, root access, no fair-use throttling on disk I/O.
Media-heavy production appHybrid: cPanel for app, S3 + CloudFront for assetsScales independently of the web tier; offloads bandwidth from origin.
Enterprise / multi-regionCloud hosting (AWS, GCP) with managed LaravelMulti-region replication, fine-grained IAM, integrated CDN edge.

Shared Hosting Constraints

Shared cPanel tiers run with fair-use I/O limits. A 2026 shared plan with weekly backups and DDoS protection (as offered by Hostinger, GreenGeeks, and DreamHost) is fine for under 50GB of total storage and modest upload traffic. The InMotion Hosting Business tier adds SSH, more PHP workers, and NGINX-backed caching.

VPS Flexibility

With a VPS, you control php-fpm, OPcache, Redis, and the file system. You also stop fighting symbolic link restrictions. The tradeoff is that you maintain the server: OS patches, control panel updates, and firewall rules become your problem.

Cloud Hosting Advantages

AWS, GCP, and Azure offer unlimited storage scaling and global edge caching via CloudFront / Cloudflare. They're also overkill for most Laravel apps and bring a steep operational cost if not configured carefully.

Best Practices & Performance Tips

Caching File Metadata

Every Storage::disk(...) call hits the disk. Wrap repeated reads in Cache::remember for file existence checks. This matters more on S3 than local, where each call is a network round-trip.

Using CDN with Storage

Point a CDN at your public/storage URL or at the S3 bucket. Many 2026 cPanel plans include a built-in CDN toggle. Laravel's Storage::url() returns the local URL by default; you can swap in a CDN hostname by overriding the disk's url field.

Regular Backup of Storage

Enable the host's automatic backup (weekly or daily depending on tier) and add a custom cron that tars the storage/ directory to an off-site S3 bucket. Restore drills matter: a backup you've never restored from is a backup you don't have.

Common Mistakes & Troubleshooting Guide

Permission Denied Errors

Symptom: Permission denied when writing a file. Cause: storage/ is not writable by the web user. Fix: chmod -R 775 storage and confirm ownership matches the cPanel account user.

Missing Symbolic Links

Symptom: 404 on every file under /storage. Cause: the symlink was never created, was deleted by a re-deploy, or points to a non-existent target. Fix: rerun php artisan storage:link.

Incorrect .env Config

Symptom: S3 uploads fail with 403. Cause: missing or wrong AWS_BUCKET, AWS_DEFAULT_REGION, or credentials. Fix: re-check the IAM policy and regenerate access keys if compromised.

Frequently Asked Questions

Log into cPanel, open the Terminal feature (if available) or use the File Manager to create a symbolic link manually: ln -s ../storage/app/public public/storage. If Terminal is not available, use an SSH client or ask your host to run the command for you.

No comments yet. Be the first to share your technical feedback!

Leave Technical Feedback / Discussion

B

Brieflyn Editorial Team

Senior cybersecurity researchers, DevOps engineers, and technical editors at Brieflyn.

EXPERTISE: CYBERSECURITY, CLOUD INFRASTRUCTURE, & SOFTWARE SYSTEMS

Related Guides & Documentation