Solved

Virtual host with support for PHP

Posted on 2006-06-20
6
805 Views
Last Modified: 2013-11-18
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
0
Comment
Question by:sendhelp
  • 4
  • 2
6 Comments
 
LVL 51

Accepted Solution

by:
ahoffmann earned 500 total points
ID: 16944278
should work if you also have a

NameVirtualHost *

otherwise please post the URL which does not work.

>      ScriptAlias  "c:/php/"
do you use php as CGI?
0
 

Author Comment

by:sendhelp
ID: 16945436
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
0
 

Author Comment

by:sendhelp
ID: 16945536
I mean yes I have NameVirualHost *
#
# Use name-based virtual hosting.
#
#

   NameVirtualHost *
0
Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

 

Author Comment

by:sendhelp
ID: 16945629
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>

0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 16946309
> ServerRoot "C:\Program Files\Apache Group\Apache2"
you should not use \ but /
0
 

Author Comment

by:sendhelp
ID: 16948382
Thank you. I got everything working.
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now