D&C Lug - Home Page
Devon & Cornwall Linux Users' Group

[ Date Index ][ Thread Index ]
[ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] PHP



On Saturday 22 Nov 2003 5:01 pm, Richard Brown wrote:
> Hi Neil and Neil
>
> I think I've done this before but I can't remember what to do. I ran the
> file through:-
>
> http://home/rich/test.php
> and it came up with "Unknown host home"

Because you haven't added a virtual host to Apache to make the host called 
home. If that was done with

<VirtualHost home>
DocumentRoot    /home/rich
ServerName      home
ScriptAlias     /cgi-bin/ /home/rich/cgi-bin/
<Directory /home/rich/cgi-bin>
        Options +ExecCGI
</Directory>
</VirtualHost>

Then http://home/test.php would work, reading the file from /home/rich/

Read the Apache config carefully, look for the section on Virtual Host - DON'T 
just crib the above straight in - it needs to go in the right place with 
another setting or two. (In particular, take note of name hosts vs IP hosts - 
you'll need to do some work with ifconfig and other networking scripts if you 
want an IP virtual host. It works fine without. You'll also need to add the 
new name to /etc/hosts as an alias for that machine - not localhost, it's 
real name.)

>
> and so I tried:-
>
> http://localhost/home/rich/test.php

http://localhost is just a public shorthand for a private path, the default 
with Apache is:
/usr/local/apache/htdocs

So:
http://localhost/home/rich/test.php

Is actually:
/usr/local/apache/htdocs/home/rich/test.php

Which doesn't exist.

> What is frustrating is that I always get so far with configuring the
> server and doing stuff with my box and then do something and break
> everything.

No, you just break a bit of it. Namely, you look for something that hasn't 
been configured yet.

> I thought I would try Linux because I didn't want to use windows. I
> didn't realise I would end up running servers/php/mysql/etc... Good fun
> though. Just frustrating because I don't do everything enough to
> remember it. I have started writing things down at last.

Sounds like we need a Cornwall web server meet.

> The journey goes on.
>
> Rich


-- 

Neil Williams
=============
http://www.codehelp.co.uk/
http://www.dclug.org.uk/
http://www.isbn.org.uk/
http://sourceforge.net/projects/isbnsearch/

http://www.biglumber.com/x/web?qs=0x8801094A28BCB3E3

Attachment: pgp00017.pgp
Description: signature


Lynx friendly