Welcome Guest, Not a member yet? Register   Sign In
Permission denied in /public/index.php on line 28
#2

(This post was last modified: 02-17-2021, 04:13 AM by captain-sensible.)

permissions on Linux can be tricky . For instance i had a go at serving web content from a folder called "public_html" inside my home folder. I got forbidden you do not have permission ..blah blah. That was because along with other configuration an "executute" permission was needed on my home directory in order for apache to access public_html via my home folder. I did a chmod of 711 on my home folder and that fixed it.

generally you will see on live web hosting that files have chmod of 644 and directories 755. I once did a chmod of 777 on the index.php in public and that gave me a problem, that was fixed by changing permissions to 644.


So basically it looks like you are using apache on manjaro and you have sub directories inside /var/www/html

i did approach issues with editing code inside apache for slackware and approaches; don't know if it help you but its at : https://docs.slackware.com/howtos:misc:a..._slackware



i was also going to add that i start up my apache on slackware manually using # /etc/rc.d/rc.httpd start

Now as a Linux user you will note that root is firing up it seems apache daemon; however if i understand it correctly permissions are dropped from root and handed to user "apache" and group "apache" . That is confirmed in /etc/httpd/httpd.conf where it states user : apache and group : apache. Thats a started for knowing who owns stuff in apache.

These are my permissions for a CI4 web app directory called basic and located /var/www/htdocs:

Code:
bash-5.0$ ls -l basic
total 116
-rwxrwxr-x  1 apache apache  2827 Jul 16  2020 README.md
drwxrwsr-x 13 apache apache  4096 Oct 30 19:44 app
-rwxrwxr-x  1 apache apache  3760 Jul 16  2020 builds
-rwxrwxr-x  1 apache apache   692 Jul 16  2020 composer.json
-rwxrwxr-x  1 apache apache 67209 Oct 30 20:14 composer.lock
-rwxrwxr-x  1 apache apache  3497 Jul 16  2020 env
-rwxrwxr-x  1 apache apache  1159 Jul 16  2020 license.txt
-rwxrwxr-x  1 apache apache  2151 Jul 16  2020 phpunit.xml.dist
drwxrwsr-x 11 apache apache  4096 Oct 30 16:39 public
-rwxrwxr-x  1 apache apache  1865 Jul 16  2020 spark
drwxrwsr-x  6 apache apache  4096 Oct 22 09:45 tests
drwxrwsr-x 20 apache apache  4096 Oct 30 20:14 vendor
drwxrwsrwx  7 apache apache  4096 Nov  3 20:43 writable
bash-5.0$
and index.php inside public:

Code:
ash-5.0$ ls -l index.php
-rwxrwxr-x 1 apache apache 1540 Oct 26 09:11 index.php
bash-5.0$

you mentioned using composer. if you use composer as your user account and download to say your home directory, then basically you will have permissions. you can't access apache web root and use composer unless you are using root, in which case you will probably find that the downloaded stuff has root permissions which you don't want, since so as not to mess up apache content in apache, the owner should be apache and group apache. Does that make sense ?
Reply


Messages In This Thread
RE: Permission denied in /public/index.php on line 28 - by captain-sensible - 02-17-2021, 03:38 AM



Theme © iAndrew 2016 - Forum software by © MyBB