我設法讓我的laravel應用程序在共享主機上工作。Laravel 5共享託管pathinfo()和不可寫目錄的問題
在此之後tutorial,我搬到外面/public_html/
應用程序文件到一個/reddit/
目錄和裏面的文件/public/
到/public_html/
一切運作良好,直到我嘗試提交後,然後我得到這個錯誤
無法將圖像數據寫入路徑(/ images/Q4vQitDu。)
這是它引用的代碼塊克至
$orig = pathinfo($info->image, PATHINFO_EXTENSION);
$extension = substr($orig, 0, strpos($orig, '?'));
$newName = '/images/' . str_random(8) . ".{$extension}";
if (File::exists($newName)) {
$imageToken = substr(sha1(mt_rand()), 0, 5);
$newName = '/images/' . str_random(8) . '-' . $imageToken . ".{$extension}";
}
$image = Image::make($info->image)->fit(70, 70)->save($newName);
$embed_data = ['text' => $info->description, 'image' => basename($newName)];
正如你所看到的,它與點,但不是{$extension}
生成圖像的名字 - 我不知道爲什麼,因爲它是在本地工作。
它也說/images/
是不可寫的,但它是。它存在於/public_html/images/
和權限被設置爲777
UPDATE
我通過改變/images/
網址給整個服務器的URL /home/maghnatis/public_html/images/
但圖像仍然被保存,沒有他們的擴展固定的權限問題。
這是index.php
在/public_html/
require __DIR__.'/../reddit/bootstrap/autoload.php';
$app = require_once __DIR__.'/../reddit/bootstrap/app.php';
它是由/reddit/
目錄外/public_html/
我在PHP 5.5加載文件,這些都是已加載模塊