View previous topic :: View next topic |
Author |
Message |
StuRReaL Tux's lil' helper
Joined: 25 Oct 2003 Posts: 117
|
Posted: Mon May 31, 2004 11:03 am Post subject: PHP Compile problems |
|
|
Hi
I've just finished merging Apach2 and PHP, mod_php but I when I run a php page from the web server it gives me a 403 unauthorised. So i have a permissions problem, however I own the file and the directory that holds the default web site.
My guess is I need to add my user to another group if so what is it and how do I do it? and if anyone knows of any other groups I should add myself to let me know as i'm only added to defaults , users,wheel and audio |
|
Back to top |
|
|
andrewy l33t
Joined: 07 Apr 2004 Posts: 602
|
Posted: Mon May 31, 2004 11:34 am Post subject: Re: PHP Compile problems |
|
|
The files need to be owned by the user that the webserver runs as, not your username.
I believe Apache runs as the user apache, try using chown to change the file's ownership. |
|
Back to top |
|
|
StuRReaL Tux's lil' helper
Joined: 25 Oct 2003 Posts: 117
|
Posted: Mon May 31, 2004 1:05 pm Post subject: |
|
|
right ok... so if i won't be able to edit the files unless i'm logged in as the apache user or root then surely? |
|
Back to top |
|
|
andrewy l33t
Joined: 07 Apr 2004 Posts: 602
|
Posted: Mon May 31, 2004 1:52 pm Post subject: |
|
|
You can set the permissions so that other users can edit them. |
|
Back to top |
|
|
StuRReaL Tux's lil' helper
Joined: 25 Oct 2003 Posts: 117
|
Posted: Mon May 31, 2004 2:34 pm Post subject: |
|
|
:sigh: nothing is ever easy why can't PHP on linux do as its told and execute. My windows install is capable :X |
|
Back to top |
|
|
andrewy l33t
Joined: 07 Apr 2004 Posts: 602
|
Posted: Mon May 31, 2004 3:11 pm Post subject: |
|
|
Your Windows install is also inherently insecure, which is why you don't have trouble with permissions.
Just make the files be owned by apache, and by the group that your user is in.
e.g. chown apache:bobsgroup fileshere
and then set the permissions so members of that group can do whatever they want with them:
chmod 660 fileshere |
|
Back to top |
|
|
StuRReaL Tux's lil' helper
Joined: 25 Oct 2003 Posts: 117
|
Posted: Mon May 31, 2004 4:38 pm Post subject: |
|
|
ok so how do i set my username as a member of the apache group? |
|
Back to top |
|
|
andrewy l33t
Joined: 07 Apr 2004 Posts: 602
|
Posted: Mon May 31, 2004 11:01 pm Post subject: |
|
|
man usermod
for more information.
Make sure you "add" the user to the groups he's already apart of, as well as the apache group |
|
Back to top |
|
|
StuRReaL Tux's lil' helper
Joined: 25 Oct 2003 Posts: 117
|
Posted: Tue Jun 01, 2004 11:04 pm Post subject: |
|
|
i've added myself to group apache but i still can't get a PHP page or a HTML page for that matter!!!
I get a 403 forbidden
why doesn't it just bloody work!! its my machine only i use insolent bloody OS all of this is taking me ages to set up, I'm beginning to wonder if all this effort is worth it
And for some reason my ATi drivers aren't working correctly i'm in mesa indirect mode with kernel 2.6 i'm sure i removed xfree dri, in fact I did i've just checked or is it because I selected framebuffer devices and then compiled VESA generic drivers? if i remove that will it work? |
|
Back to top |
|
|
andrewy l33t
Joined: 07 Apr 2004 Posts: 602
|
Posted: Wed Jun 02, 2004 12:35 am Post subject: |
|
|
403 forbidden could mean apache can't view the page.
Make sure the page is owned by apache, and make sure you added -D PHP to /etc/conf.d/apache2, under the options argument. |
|
Back to top |
|
|
StuRReaL Tux's lil' helper
Joined: 25 Oct 2003 Posts: 117
|
Posted: Wed Jun 02, 2004 5:15 pm Post subject: |
|
|
ok i must be a complete tard or something heres what i've done.
1) emerge apache2
2) emerge PHP +mysql +gd +flash +ldap +postgres +some other bits
3) emerge mod_php
4) added -D PHP to /etc/conf.d/apache
5) edited /etc/apache2/conf/apache2.conf to give it a ServerName of localhost to stop it complaining about no domain name and repointed the htdocs to /home/httpd/htdocs
6) changed permissions so that apache owned httpd/htdocs and all directories and files below it
7) added my username to the apache group
and heres what apache still spits back at me. I wouldn't mind but i do have permission to access it. It even has the cheek to tell me i don't have permissions as root. What exactly have i done wrong? I'm not one to rant but i'm getting tired of it not working. I even tried add the mine type bit from the php manual to see if it was because it didn't know what to do with .php files
Code: |
Forbidden
You don't have permission to access /info.php on this server.
Apache/2.0.49 (Gentoo/Linux) mod_ssl/2.0.49 OpenSSL/0.9.7d PHP/4.3.6 Server at localhost Port 80
|
|
|
Back to top |
|
|
andrewy l33t
Joined: 07 Apr 2004 Posts: 602
|
Posted: Wed Jun 02, 2004 9:36 pm Post subject: |
|
|
Paste a 'ls -l' showing the permissions of info.php |
|
Back to top |
|
|
taech n00b
Joined: 29 May 2004 Posts: 3
|
Posted: Wed Jun 02, 2004 10:00 pm Post subject: |
|
|
try adding this to your /etc/apache2/conf/apache2.conf
Code: | <Directory "/webroot">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
|
of course, change the <Directory "/webroot"> to the appropriate directory |
|
Back to top |
|
|
StuRReaL Tux's lil' helper
Joined: 25 Oct 2003 Posts: 117
|
Posted: Wed Jun 02, 2004 10:03 pm Post subject: |
|
|
heres the permissions output on the files
-rwxrwxrwx 1 apache users 139 Jun 2 00:04 index.htm
-rwxrwxrwx 1 apache users 20 Jun 2 00:02 info.php |
|
Back to top |
|
|
StuRReaL Tux's lil' helper
Joined: 25 Oct 2003 Posts: 117
|
Posted: Wed Jun 02, 2004 10:07 pm Post subject: |
|
|
taech wrote: | try adding this to your /etc/apache2/conf/apache2.conf
Code: | <Directory "/webroot">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
|
of course, change the <Directory "/webroot"> to the appropriate directory |
Excellent that works thanks |
|
Back to top |
|
|
|