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
You need to add: Options +FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine on
Options +FollowSymLinks
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
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
First, this answer here will help you with permissions. Second, you may need to add RewriteBase ~/carlo/public_html/laravel-develop
to your .htaccess since you're running it out of a home directory.
Hey I got this error too and changing the write permissions didn't seem to work either. It turned out I needed to change the User and Group settings in apache's httpd.conf file. Here's a good tutorial for it: Enable Write Permissions for the Native Built-In Apache in Mac OS X Lion
In my case I resolved this error by modifying in file /app/config/app.php the default setting:
'url' => 'http://localhost',
to my local custom virtualhost host url:
'url' => 'http://mydomain.local',
This seemed to be THE essential change that resolved the issue (I also chmod'ed the storage folder, as suggested here)
hope this helps some of you..
I ran into this problem a few minutes back and using sudo chmod -R 777 storage seemed to help make the storage/meta/services.json writable. Just to add to what everyone has been saying. This worked for me.
Checking on the Requirement for the LR4, your local server must have these: PHP >= 5.3.7 MCrypt PHP Extension
Otherwise, will fail. I am facing this trouble also and now looking for an updated PHP and its extension for my XAMPP.
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/
further to above, if you're using a virtualbox/vagrant VM type environment, then on my Mac I needed to issue the chmod on the host (mac) system but on my Windows box, it was fine issuing the chmod direcly on the VM.
You need to read the installation documentation:
http://laravel.com/docs/installation#configuration
Pay attention to the bit here:
Laravel requires one set of permissions to be configured - folders within app/storage require write access by the web server.
There is also other stuff thats useful in that document, so make sure you read it all.
I had the same problem, here is how I solve it: In your httpd-vhosts.conf files you need to add the configurations to your folders, this is what I have in mine
<VirtualHost *:80>
ServerAdmin your@mail.com
DocumentRoot "/home/carlospublic_html"
ServerName carlos.local
<Directory "/home/carlos/public_html">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>>
The webroot of your server should point to the /public
folder of your Laravel installation. This is where the index.html
file recides from where Laravel is initialized.
I like this method better than changing permissions to 777. Set Apache to run as you.
In terminal type id
to get uid=123(Myname)
.
Open /etc/apache2/httpd.conf and edit it to use your username.
<IfModule unixd_module>
User Myname
Group staff
</IfModule>
Back to terminal: sudo apachectl restart