Link to home
Start Free TrialLog in
Avatar of sendhelp
sendhelp

asked on

Virtual host with support for PHP

I have a directory in my document root "C:\Program Files\Apache Group\Apache2\htdocs"
named private_party. I need to create a new vertual host with the name www.private_party.com that uses the private_party directory and add PHP support for the www.private_party.com virtual host. I don't know how to configure the directory and to add the handlers correctly. This is what I have tried so far.

#
# the virtual host private_party
#

   <VirtualHost *>
        ServerName www.private_party.com
        DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs"
      Options -FollowSymLinks -ExecCGI -Includes
      ErrorLog logs/private_party.com-error_log
      CustomLog logs/private_party.com-access_log common
      ScriptAlias  "c:/php/"
   </VirtualHost>
What should it be and do I need code for any other part of my httpd.conf
ASKER CERTIFIED SOLUTION
Avatar of ahoffmann
ahoffmann
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sendhelp
sendhelp

ASKER

Here is my URL my default is:
 <VirtualHost *>
      ServerName localhost.com
      DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs/"
   </VirtualHost>


http://localhost/private_party/test.php


everything else works using html extension, i.e.   http://localhost/private_party/index.html 
just not php extensions
I mean yes I have NameVirualHost *
#
# Use name-based virtual hosting.
#
#

   NameVirtualHost *
I want to use php as my cgi
Here is what I have changed or added on my httpd.conf, should I change, delete, or add anything else. I am not experienced with this at all. I am trying to work from books and a cd tutorial and php is not working for me. Please tell me where to make any changes in the file.

ServerRoot "C:\Program Files\Apache Group\Apache2"

 
DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs"

DirectoryIndex index.html index.htm index.cgi default.htm default.html index.phtml index.php

AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php "/php-exe-location/php.exe"
ScriptAlias /php-exe-location/ "C:/PHP/"


#
# Use name-based virtual hosting.
#
#

   NameVirtualHost *


   <VirtualHost *>
         ServerName www.private_party.com
         DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs"
       Options -FollowSymLinks -ExecCGI -Includes
       ErrorLog logs/private_party.com-error_log
       CustomLog logs/private_party.com-access_log common
   </VirtualHost>

> ServerRoot "C:\Program Files\Apache Group\Apache2"
you should not use \ but /
Thank you. I got everything working.