• 15

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191


File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

Starting with laravel on ubuntu

I'm trying laravel as a PHP framework, I have already extracted the laravel zip into ~/opt/xampp/htdocs/laravel but when I go to localhost/laravel or localhost/laravel I get a 403 error message saying:

Access forbidden!

You don't have permission to access the requested object. It is either read-protected or not readable by the server.

I read somewhere that I need to edit the storage folder inside of laravel so it can be readable and writable so I chmod -R 766 laravel/storage but still no luck, I'm doing this from Ubuntu 12.04 have anyone encountered this ?

I have chmod -R 0+w laravel/storage and now when i go to localhost/laravel i get an index of some files in there, but when i go to localhost/laravel/public/ still get the 403 error, instead of the expected result

I have set chmod -R 765 laravel/public and now when i get to localhost/laravel/public i get this message which leads me to believe i'm getting closer:

Warning: require(/opt/lampp/htdocs/learning-laravel/laravel/laravel.php): failed to open stream: Permission denied in /opt/lampp/htdocs/learning-laravel/public/index.php on line 34

Fatal error: require(): Failed opening required '/opt/lampp/htdocs/learning-laravel/laravel/laravel.php' (include_path='.:/opt/lampp/lib/php') in /opt/lampp/htdocs/learning-laravel/public/index.php on line 34

Final Update
I finally solved it, what happened was that the laravel folder was read protected, what i had to do was to set chmod 755 -R laravel and then chmod -R o+w storage and voila i had laravel up and running, thanks to everybody that contributed.

  • 68
Reply Report
    • I would rather use the solution from @Sirlate because by your solution you are basically doing chmod 757 -R storage which means that anybody can read and write to the storage folder where are sessions, logs.. also written. So basically I see it as security risk. So even your sister can read that folder if she has guest account on your computer.

for just getting start with laravel, I just do these following steps:

sudo chmod -R 770 /your/path/to/laravel/folder/

then add www-data group to your laravel

sudo chgrp -R www-data /your/path/to/laravel/folder/
  • 17
Reply Report

Your on the right track, after install of laravel you need to ensure the storage directory has the correct permissions:

sudo chmod o+w storage 

Then make sure you are serving your public folder and not your laravel folder in apaches document root

<VirtualHost *:80>
    DocumentRoot /Users/JonSnow/Sites/MySite/public
    ServerName mysite.dev

Both requirements are covered here

  • 5
Reply Report
      • 2
    • @IsaacGonzalez -you don't need to add a virtual host no. From the looks of it, it seems as if your permissions are all jacked up. Trash what you've done so far, download laravel again, extract to ~/opt/xampp/htdocs/laravel then run one permissions change to the storage directory
      • 2
    • I found it necessary to change permissions recursively on the storage directory. Ex: sudo chmod -R o+w storage

On the Laravel forum, Kaspien gave this usefull answers:

You do have to chmod 777, but only on the storage/views folder to use blade, which happens to be the view engine the default Laravel view uses. I usually chmod 777 all storage/* directories on a fresh install of Laravel before I start a project, since they have to be writable for views, sessions, etc.

From the thread: http://forums.laravel.com/viewtopic.php?id=1552

  • 0
Reply Report

Warm tip !!!

This article is reproduced from Stack Exchange / Stack Overflow, please click

Trending Tags

Related Questions