Comments on: “Forbidden – You don’t have permission to access / on this server” Error https://www.tecmint.com/forbidden-you-dont-have-permission-to-access-on-this-server-error/ Tecmint - Linux Howtos, Tutorials, Guides, News, Tips and Tricks. Wed, 13 Dec 2023 04:12:22 +0000 hourly 1 By: Ravi Saive https://www.tecmint.com/forbidden-you-dont-have-permission-to-access-on-this-server-error/comment-page-1/#comment-1938417 Thu, 29 Dec 2022 04:52:57 +0000 https://www.tecmint.com/?p=38773#comment-1938417 In reply to Colin Wray.

@Colin,

You are right, it might be a problem with the single-quoted string or the variable in the PHP files…

I can’t help you out, I am not a PHP expert…

]]>
By: Colin Wray https://www.tecmint.com/forbidden-you-dont-have-permission-to-access-on-this-server-error/comment-page-1/#comment-1938028 Wed, 28 Dec 2022 13:57:28 +0000 https://www.tecmint.com/?p=38773#comment-1938028 In reply to Ravi Saive.

Hello Ravi,

I’m not sure what you mean by “SELinux“.

Here is an ‘ls -la‘ of /var/www:

-rwsr-xr-x  1 root     pi        8728 Nov 19  2017 MsgToLogger
drwxr-xr-x 12 root     root      4096 Dec 15 14:51 ..
drwxr-xr-x  6 www-data www-data  4096 Dec 22 20:24 .
drwxr-xr-x  2 root     root      4096 Dec 22 20:26 html
drwxr-xr-x  4 root     root      4096 Dec 28 13:33 greenchurch

Don’t forget the message in /var/log/apache2/error.log is:

sh: 1: /var/www/MsgToLogger: not found

“not found” instead of lack of permission seems like a bug, especially as php7.0 works OK.

]]>
By: Ravi Saive https://www.tecmint.com/forbidden-you-dont-have-permission-to-access-on-this-server-error/comment-page-1/#comment-1936272 Mon, 26 Dec 2022 05:37:31 +0000 https://www.tecmint.com/?p=38773#comment-1936272 In reply to Colin Wray.

@Colin,

Is SELinux disabled or have the correct context settings on the /var/www directory? Please check, it seems some permission issue…

]]>
By: Colin Wray https://www.tecmint.com/forbidden-you-dont-have-permission-to-access-on-this-server-error/comment-page-1/#comment-1934604 Fri, 23 Dec 2022 15:28:59 +0000 https://www.tecmint.com/?p=38773#comment-1934604 I tried a suggestion in this thread:

        AllowOverride None
        Require all granted

but it does not cure the exec problem.

There has never been a problem creating a file in /var/www, just running an existing one.

]]>
By: Colin Wray https://www.tecmint.com/forbidden-you-dont-have-permission-to-access-on-this-server-error/comment-page-1/#comment-1933855 Wed, 21 Dec 2022 12:20:32 +0000 https://www.tecmint.com/?p=38773#comment-1933855 I have an allied permissions problem that Stack Exchange can’t solve. Can anyone here help?

I have a fully working raspi3b + apache2 + php5 system on a 32-bit OS.

In a php block there is a simple statement:

$msg = "Save Schedule"; exec( "/var/www/MsgToLogger \"$msg\"", $r );

The executable MsgToLogger has root ownership and 4755 permissions, and the task is performed fine.

I changed to a raspi4b + apache2 + php7.4 on a 64bit OS.

I get “sh: 1: /var/www/MsgToLogger: not found” in apache/error.log

There is no problem writing a file in /var/www using file_put_contents($msgfname,$msg);.

I have tried putting MsgToLogger in three other places with no luck.

]]>