Page 1 of 1

Virtual Host problem

PostPosted: 30. June 2010 12:51
by kosh
Hi All,

I have been going through David Powers yet to be published book on Dreamwever CS5 with PHP, via the Creative Edge website) and have got to the point of creating virtual hosts for my websites. I have added the lines below to httpd-vhosts.conf as stated in the book:

<Directory C:/vhosts>
Order Deny,Allow
Allow from all
</Directory>

and now Apache will not start (through XAMPP Control Panel). I rremolvbe these lines and Apache starts OK again. The Error Log contains the line:

"httpd.exe: Syntax error on line 484 of C:/xampp/apache/conf/httpd.conf: Syntax error on line 53 of C:/xampp/apache/conf/extra/httpd-vhosts.conf: </Directory> without matching <Directory> section"

I have tried a few things (including changing the C:/ to C:\) but top no effect. The exact same lines above are also in his previous book, Dreamweaver CS4 with CSS, Ajax and PHP, so it cannot be a typing error.

I am stuck, any ideas ?

I am using Windows 7 Home Premium 64-bit with XAMPP 1.7.3.

Cheers,
Alan Taylor
England

Re: Virtual Host problem

PostPosted: 30. June 2010 17:55
by JonB
Look in the examples in /apache/conf/extra/httpd-vhosts.conf

This is from my server, the directory location is a quoted string:

Code: Select all
<Directory "C:/xampp/sites">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.2/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks Includes ExecCGI

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride All

    #
    # Controls who can get stuff from this server.
    #
    Order allow,deny
    Allow from all

</Directory>
:shock:

Re: Virtual Host problem

PostPosted: 02. July 2010 14:13
by BigWetDog
The syntax for the lines you've posted are correct. Can you post more of your httpd-vhosts.conf (namely everything after about line 44)?

Re: Virtual Host problem

PostPosted: 02. July 2010 15:47
by JonB
I missed this the first time around - you know - that error message is quoting two source problems:

There is 1st a problem in httpd.conf at line 484 --- then there is a problem in the httpd-vhosts.conf. They may well be related.

:shock:

Re: Virtual Host problem

PostPosted: 02. July 2010 15:51
by BigWetDog
Jon,
It's kind of like a stack trace. If you check your httpd.conf you'll find that about line 484 is the include for extra/httpd-vhosts.conf so the error is in httpd-vhosts.conf. We just need to see line 53 of that file in context in order to help.

Re: Virtual Host problem

PostPosted: 03. July 2010 00:01
by kosh
Thanks for all the ideas. I tried the quotes without success and a few other things but then i thought i may have made an error ealier on, so i decided to re-install XAMPP from scratch and repeat all the changes and test at each stage. Then, of course, it all worked fine !!!

Frustrating, as not knowing the error means i can't learn from it, but at least the virtual hosts are working at the moment.

Many thanks for all your help and suggestions.

Cheers,
Kosh