I've got Apache 2.2 working, and my virtualhosts work within the following directories:

C:/www (main Apache root)

C:/www/vhosts (virtual hosts)

However, I cannot get PHP files to function outside of vhosts, even if the domain works well as a virtual host.

Example domain:

<VirtualHost *:80>
    ServerName  testweb1.co.uk
              ServerAlias  www.testweb1.co.uk
    DocumentRoot /www/testweb1.co.uk
    ErrorLog /www/Apache22/logs/error.log

<Directory "/www/testweb1.co.uk">
    Options All
    AllowOverride All
    order allow,deny
    allow from all
</Directory>

I tried a PHP file with a simple include, two files in the directory:

<?php include("header.php"); ?>

It worked within C:/www/vhosts but outside of it, no PHP code was displayed.

Here's my vhosts-conf, well, the beginning:

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

Why is this and what can be done? PHP scripts won't execute in either of them.

I don't want all my virtualhosts in one directory; what's the best solution for this?

link|improve this question
Check php setting for base directory – SergeS Jul 8 '11 at 14:31
2  
How is PHP being enabled in apache? If the AddHandler directive is inside a <Dir /www/vhosts>, then PHP would only function inside that directgory. – Marc B Jul 8 '11 at 14:32
1  
It would help if your code examples would line up. You say you have two local directories but your config files have references to different (non existing) local directories. – Adrian Jul 8 '11 at 15:30
See if you have inserted AddType application/x-httpd-php .php and LoadModule php5_module modules/libphp5.so main Apache root configuration. – tftd Jul 9 '11 at 3:07
feedback

migrated from stackoverflow.com Jul 9 '11 at 2:22

This question came from our site for professional and enthusiast programmers.

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
or
required, but never shown