Forum Moderators: travelin cat

Message Too Old, No Replies

set up apache php

forbidden

         

jasperx

9:01 pm on Jul 17, 2003 (gmt 0)

10+ Year Member



I have got php and apache up and running. To be able to view an index of my sites and pages I followed some directions on one of my machines and when I browse to [localhost...] it works perfectly.

On a new set up on a second machine I get a forbidden error when I browse to [localhost...] though if I do [localhost...] it works just fine.

the hppd.config files are identical.... I copied it over.
also I have checked the permissions on the Sites dir... no difference

I am stumped.

aaronjf

4:44 am on Jul 18, 2003 (gmt 0)

10+ Year Member



Double check the permissions. That should be the only thing that would be causing that. However, that you can't go .../~users but you can go .../~users/test.php is very strange.

jamesa

7:02 am on Jul 18, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try putting an index.html file in your users directory and then go to http;//localhost/~user. If that works then you just need to set Options -indexes for the directory in the httpd.conf or .htaccess file.

Otherwise accessing the directory with the trailing slash (http;//localhost/~user/) and see if that makes a difference.

jasperx

12:44 pm on Jul 18, 2003 (gmt 0)

10+ Year Member



Try putting an index.html file in your users directory and then go to http;//localhost/~user. If that works then you just need to set Options -indexes for the directory in the httpd.conf or .htaccess file. Yes it has been working just fine with an index.html file in it and to repeat the httpd.conf is the exact file which is working on my other machine. So maybe it is the .htaccess file...where is it and how is the change made?

Otherwise accessing the directory with the trailing slash (http;//localhost/~user/) and see if that makes a difference. Makes no difference.

jamesa

5:15 pm on Jul 18, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



>> So maybe it is the .htaccess file...where is it and how is the change made?

Check to see if there is a file called .htaccess in the folder (files that start with a dot are invisible to the finder, so you could use terminal or check out the tips in this thread [webmasterworld.com]). If it's not there, create it. Put this line it (you might to double check [httpd.apache.org] my syntax here):

Options Indexes

The webserver will read that (if AllowOverride is set in your httpd.conf). Or you can do this in your httpd.conf:

<Directory /path/to/folder>
Options Indexes
</Directory>

jasperx

7:20 pm on Jul 18, 2003 (gmt 0)

10+ Year Member



OK I got it! What is important is what it didn't have anything to do with!

Fixing Forbidden for ~/username had nothing to do with
.htaccess
httpd.conf

Inside of /private/etc/httpd/users is a set of files for every user on the machine. When I looked in there I found that I was missing one of my users teresa.conf. So I copied pam.conf and renamed it teresa.conf. Did a sudo apachectl graceful. And Bob was my uncle.

Dang... this was hard. I will bet that buried in that httpd.config file there is some info about the server checking /private/etc/httpd/users/username.conf but I never saw it... don't know how I got so lucky to discover the missing file.

BjarneDM

12:14 am on Jul 22, 2003 (gmt 0)

10+ Year Member



at the very very buttom of httpd.conf you'll find this:
Include /private/etc/httpd/users

This little innocuous and undocumented line takes care of loading all of the special httpd.conf files for the users. A new file with standard settings is added to this folder whenever you create a new user profile.

Another way to make use of this feature is if you've got virtual host. Then you can keep the specific settings for these in separate files in a special folder.

jasperx

3:08 am on Jul 22, 2003 (gmt 0)

10+ Year Member



Bjarne,

I want to believe you... I really do. It seems like it makes so much sense. BUT I have no httpd.conf files... zero, nada, zip , goose egg. None of my users had httpd.conf files in their Sites dir so I did a system wide search [ find / -name httpd.conf -print ]and found two httpd.conf files sitting in some ancient GoLive projects that I had buried in the bowels of my documents dir. Near as I can tell my system is doing just fine without httpd.conf but it got ill when donna.conf went missing... donna.conf must have been getting called from somewhere other than httpd.conf.

Have I missed the obvious? Or is it that there is some other apple created file which is serving the same role as httpd.conf?

BjarneDM

4:25 am on Jul 22, 2003 (gmt 0)

10+ Year Member



Apache doesn't run without a httpd.conf file

1) start Terminal
2) type : cd /etc/httpd
3) type : ls -aloF

4) type : cd users
5) type : ls -aloF
6) type : pwd

These files are normally hidden and can normally only be accessed through the Terminal. To get at them otherwise get hold of TinkerTool and set Finder up to show hidden files and folders.

jamesa

5:25 pm on Jul 22, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The config file doesn't have to be called httpd.conf if you give Apache the name of a different config file when it's launched. To see what config files that Apache is actually using type
httpd -V
at the command line.

jasperx

12:44 am on Jul 23, 2003 (gmt 0)

10+ Year Member



Major brain glitch...I wrote wrongly in my earlier posting... yes I have the httpd.conf... it was the htaccess files which are missing.

httpd.conf is where I set up php to run

The httpd -V is a very neat tool with some good info displayed. I didn't see where the missing file /private/etc/httpd/user.conf is mentioned. So I am still a little baffeled how these various files work together... it seems alot like the configuration of the user environment for the shell... there are separate places to specify an environment for all users and also for any given user. I get the concept in a general way but don't actually see the links. Here is that httpd -V...
-D EAPI
-D HAVE_MMAP
-D USE_MMAP_SCOREBOARD
-D USE_MMAP_FILES
-D HAVE_FCNTL_SERIALIZED_ACCEPT
-D HAVE_FLOCK_SERIALIZED_ACCEPT
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D HARD_SERVER_LIMIT=2048
-D HTTPD_ROOT="/usr"
-D SUEXEC_BIN="/usr/sbin/suexec"
-D DEFAULT_PIDLOG="/var/run/httpd.pid"
-D DEFAULT_SCOREBOARD="/var/run/httpd.scoreboard"
-D DEFAULT_LOCKFILE="/var/run/httpd.lock"
-D DEFAULT_ERRORLOG="/var/log/httpd/error_log"
-D TYPES_CONFIG_FILE="/etc/httpd/mime.types"
-D SERVER_CONFIG_FILE="/etc/httpd/httpd.conf"
-D ACCESS_CONFIG_FILE="/etc/httpd/access.conf"
-D RESOURCE_CONFIG_FILE="/etc/httpd/srm.conf"
The responses to my posting have been most enlightening. Thanks!

jamesa

3:59 am on Jul 23, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



httpd -V will just point you to the config file. It's inside the config file where you'll find any includes as BjarneDM pointed out. On a default OS X install the last line of the httpd.conf reads:

Include /private/etc/httpd/users

That tells Apache to include the contents of any and all the files in that directory as if it were part of httpd.conf. On OS X the user web configurations are stored there, each in a separate file.