Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

mlazuardy's avatar

Laravel Nginx PHP FPM error, permission denied 13

I Have an issue while installing laravel on VPS with this error status

2018/11/03 04:10:33 [crit] 16140#16140: *8 stat() "/var/www/commit/public/index.php" failed (13: Permission denied),

the permission now is using www-data www-data can anybody help me? i guess this is a permission issue. im new using vps

0 likes
3 replies
bashy's avatar

Doesn't matter what the owner/group is really. What does this show?

ls -lah index.php

You can always do chmod 644 index.php if it's not readable for owner/group. Also make sure your webserver is running under www-data. Most of the time nginx uses nginx user.

1 like
ccampello's avatar

You can verify if the nginx is running with the www-data user onnginx.conf in /etc/nginx/nginx.conf. Try to locate user, usually is in the first line of the file.

warpig's avatar

Experiencing this issue. I checked the permissions for the index.php file and outputs:

-rw-r--r-- 1 www-data root 1.7K Jun 19 2023 sickofmetal/public/index.php

The user stated in www.conf file is

user = www-data
group = www-data
listen.mode = 0660

However, there is still a problem with this user being able to open or even do "cat" on index.php.

The browser shows "404 Not Found" and the error log is this:

2024/02/28 08:49:20 [crit] 3080#3080: *1 stat() "/root/sickofmetal/public/index.php" failed (13: Permission denied), client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost"

Running this: sudo -u www-data cat index.php won't open. cat: index.php: Permission denied So, while the file "index.php" belongs to user www-data, and this can read and write to the file, why can't it open it via the cat command?

I'd like to update permissions for www-data user to access the file. I'm also, learning as I'm researching on this topic so I'm not sure if I'm getting all of this.

Please or to participate in this conversation.