I'm trying Laravel for the first time after reading an announcement of the Laravel4 beta releasing.
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.
If I point to the browser to http://localhost/~carlo/laravel-develop/
, it just displays the content of the directory.
Then, while on the filesystem I had a laravel-develop/public
folder, it didn't appear on the browser.
I've found that changing the .htaccess
like this:
<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: 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
another one:
/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') in /home/carlo/public_html/laravel-develop/public/index.php line 53
Try to change the folder permissions for the storage
folder using the terminal:
chmod -R 777 storage
More info on this matter can be found here.
Your errors resulted because laravel couldn't write to the app/storage folder. The rest was just a stack trace. In order to make the storage folder writable, cd into your app folder and then run:
chmod -R 777 storage
Production way, moderate complexity for people not familiar with Unix, but more secure:
web
(groupadd web
)web
(suppose your user is cool_user
, so run usermod -a -G web cool_user
)web
group (for example, on CentOS php-fpm utilize apache
user name, so in most cases this will work: usermod -a -G web apache
)web
recursively (chgrp -R web /path/to/project/root/
)chmod -R g+w /path/to/project/root/
apache
(or some other) user files and folders be accessible from your user, make them receive group ownership same as their parent folder by setting groupid bit recursively on your project root directory (chmod -R g+s /path/to/project/root/
). Voila!.
Fast and dirty way, for those who doesn't care about security and want make it works at any cost, not secure:
chmod -R o=rwx /path/to/project/root/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With