32 lines
1.2 KiB
PHP
32 lines
1.2 KiB
PHP
<?php
|
|
/**
|
|
* Script untuk membuat Symlink (Storage Link) di Shared Hosting
|
|
* Jalankan file ini sekali saja melalui browser: https://ta.myhost.id/E31230887/buat_link.php
|
|
*/
|
|
|
|
$target = __DIR__ . '/storage/app/public';
|
|
$link = __DIR__ . '/public/storage';
|
|
|
|
echo "<h2>🔧 Memperbaiki Jembatan Storage (Symlink)</h2>";
|
|
echo "<p>Target: <code>$target</code></p>";
|
|
echo "<p>Link: <code>$link</code></p>";
|
|
|
|
if (file_exists($link)) {
|
|
echo "<p>⚠️ Menghapus link/folder storage lama...</p>";
|
|
if (is_link($link)) {
|
|
unlink($link);
|
|
} else {
|
|
// Jika ternyata folder biasa (bukan link), kita amankan dengan ganti nama
|
|
rename($link, $link . '_backup_' . time());
|
|
}
|
|
}
|
|
|
|
if (symlink($target, $link)) {
|
|
echo "<h3 style='color: green;'>✅ Jembatan Storage Berhasil Dibuat!</h3>";
|
|
echo "<p>Sekarang gambar buku Anda seharusnya sudah muncul di website.</p>";
|
|
echo "<a href='./'>Kembali ke Website</a>";
|
|
} else {
|
|
echo "<h3 style='color: red;'>❌ Gagal membuat jembatan symlink.</h3>";
|
|
echo "<p>Beberapa hosting membatasi fungsi symlink(). Jika ini terjadi, beri tahu asisten AI Anda untuk menggunakan metode .htaccess redirect.</p>";
|
|
}
|