Question

I'm trying to install a fresh installation of Laravel on my nginx setup.

I get presented with a blank page, and my error log states the following:

PHP message: PHP Fatal error:  require(): Failed opening required '/srv/laravel/public/../bootstrap/autoload.php' (include_path='.:/usr/share/php:/usr/share/pear') in /srv/laravel/public/index.php on line 21" while reading response header from upstream, client: **.***.***.**, server: laravel.{domain}.nl, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fcgi-laravel-php-fcgi-0.sock:", host: "laravel.{domain}.nl"

I have checked if the file exists. From the cli it actually returns 1 if i use

php -r "echo file_exists(__DIR__.'../bootstrap/autoload.php');"

i have also checked if my PHP version is up to date. The version number is 5.4.4

I have also ran composer update in the application root folder, but to no avail.

I assume this has nothing to do with my nginx setup, as it does load the index.php. I don't have too much experience with nginx though so i might be wrong.

UPDATE: I'll post the nginx config here

server {
    listen *:80;


    server_name laravel.{domain}.nl;

    access_log /var/log/nginx/laravel.access.log;
    error_log /var/log/nginx/laravel.error.log;

    root /srv/laravel/public;
    index index.html index.htm index.php;

    # serve static files directly
        location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ {
                                access_log off;
                                expires max;
                }

        location / {
                index  index.html index.htm index.php; #try static .html file first
                ##try_files $uri $uri/ /index.php;  <<Wrong!! this will break bundles like OneAuth for example
                try_files $uri $uri/ /index.php?q=$uri&$args;
        }

    # catch all
        error_page      404 /index.php;



    location ~ [^/]\.php(/|$) {



        fastcgi_index index.php;
        include fcgi.conf;
        fastcgi_pass unix:/var/run/php-fcgi-laravel-php-fcgi-0.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

    }

}

I'm at a loss at this moment... Can anyone help me?

I'll provide more information if neccesary. Excuse me for any bad English, thank you.

Was it helpful?

Solution 2

I found out that the open_basedir was not set so i couldn't get access to that folder. Setting the open_basedir to %app%/public got it working for me.

OTHER TIPS

1 - How did you installed Laravel?

2 - Have you tried to dump the autoload files again? If not:

composer dump-autoload

Source: Laravel docs

You can alternative disable open_basedir for that specific domain ,follow these steps :

  1. In ispconfig3 tabs ,click on sites tab 2.Click on the laravel based site's domain 3.Now click on the options tab 3.put "none" in the PHP open_basedir field

    none

4.then in the nginx Directives , put this for urls to work :

 location / {
          try_files $uri $uri/ /index.php?q=$uri&$args;
        }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top