Level 122
I would
- undo changes to index.php
- restore the public folder contents
- delete the public_html folder
- create a symlink called public_html pointing to laravel's public folder
- run the artisan storage:link command
im using laravel 11 in local host image showing successfully, but after upload image not showing.
after upload i devide project into tow folder code public_html //move content of public folder inside it
when i go to public_html im not found storage simlink that created using
php artisan storage:link
i edited index.php
<?php
// // Specify the paths
$sourcePath = __DIR__ . '/../code/storage/app/public';
$targetPath = __DIR__ . '/../public_html/storage';
// Check if the symlink doesn't exist before creating it
if (!file_exists($targetPath)) {
symlink($sourcePath, $targetPath);
}
// Continue with the rest of your index.php code
use Illuminate\Http\Request;
define('LARAVEL_START', microtime(true));
// Determine if the application is in maintenance mode...
if (file_exists($maintenance = __DIR__.'/../code/storage/framework/maintenance.php')) {
require $maintenance;
}
// Register the Composer autoloader...
require __DIR__.'/../code/vendor/autoload.php';
// Bind the public path...
$app = require_once __DIR__.'/../code/bootstrap/app.php';
$app->bind('path.public', function() {
return __DIR__.'/../public_html';
});
// Bootstrap Laravel and handle the request...
$app->handleRequest(Request::capture());
then simlink recreated but image still now showing
Please or to participate in this conversation.