无法让 Laravel 4 在本地主机上工作

2022-01-08 00:00:00 localhost php laravel laravel-4

在阅读了 Laravel4 测试版发布的公告后,我第一次尝试 Laravel.

I'm trying Laravel for the first time after reading an announcement of the Laravel4 beta releasing.

我按照这些步骤安装了 composer 和 laravel 以及它所需的所有依赖项.我把 laravel 放在我的 ~/public_html 目录中——因为我习惯用 Codeigniter 来做,但我认为这里有问题.

I followed these steps I installed composer and laravel with all the dependencies it needed. I put the laravel inside my ~/public_html directory - as I'm used to do it with Codeigniter, but I think something's wrong here.

如果我将浏览器指向http://localhost/~carlo/laravel-develop/,它只会显示目录的内容.

If I point to the browser to http://localhost/~carlo/laravel-develop/, it just displays the content of the directory.

然后,当我在文件系统上有一个 laravel-develop/public 文件夹时,它并没有出现在浏览器上.

Then, while on the filesystem I had a laravel-develop/public folder, it didn't appear on the browser.

我发现像这样更改 .htaccess:

<IfModule mod_rewrite.c> 
RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php/$1 [L] 
</IfModule>

当我尝试访问公用文件夹时出现错误.错误:

resulted in an error when I try to access the public folder. The error:

ErrorException:警告:file_put_contents(/home/carlo/public_html/laravel-develop/app/config/../storage/meta/services.json):无法打开流:/home/carlo/public_html 中的权限被拒绝/laravel-develop/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php 第77行

ErrorException: Warning: file_put_contents(/home/carlo/public_html/laravel-develop/app/config/../storage/meta/services.json): failed to open stream: Permission denied in /home/carlo/public_html/laravel-develop/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php line 77

另一个:

/home/carlo/public_html/laravel-develop/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php 第77行

/home/carlo/public_html/laravel-develop/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php line 77

然后是一长串错误.最后一个是:

then a long list of errors. The last one is:

require_once('/home/carlo/public_html/laravel-develop/start.php') 在/home/carlo/public_html/laravel-develop/public/index.php 第 53 行

require_once('/home/carlo/public_html/laravel-develop/start.php') in /home/carlo/public_html/laravel-develop/public/index.php line 53

推荐答案

尝试使用终端更改storage文件夹的文件夹权限:

Try to change the folder permissions for the storage folder using the terminal:

chmod -R 777 存储

可以在这里找到更多信息.

相关文章