Greets all! I really hope this question hasn't already been answered before - because if it has - then I'll feel like an idiot for having not found it. =) And like a punk for asking again. =)

So, I have Windows 2000 advanced server - running IIS,the latest version of php - and of course MySql server. The machine is hosting two (well, more like 5 - but two that matter) domains. Directory structure is something like this

Inetpub->
wwwroot-> (this is where the main domain is)
anb-> (a subfolder of wwwroot.)

Now if a person types in www.domain1.com they get the basic wwwroot directory. If they type in www.domain2.com the server redirects them to the <anb> directory. So they can browse the site there the entire time, and it will always say www.domain2.com/currentfile.html which is what I want. You can simply link to another page in the site by doing an <a href="newfile.html">

BUT - to get php working you can't simply do a action="phpfile.php" you have to call it by action="http://www.domain1.com/anb/phpfile.php"

that of course takes them OUT of the current website (at least as far as the URL up top is concerned, and from then on, future site browsing always shows www.domain1.com/somefile.html.

Maybe I set up my domains wrong - maybe I need to do something to PHP. I just would prefer to keep the domains seperate. So that unless someone did some serious research - they'd never realize that the two domains are on the same machine and ip. Not that it's a huge security issue - just tacky - and I can forsee it getting sloppy.

Any help you guys could provide on this matter would be GREATLY appreciated. Thanks!

    Hi,

    I hope I understood your problem right. Do you have the problem that you only get the source code if you try to execute php on domain 2 ? You have to set up php completely for every virtual host on IIS to enable php on every host. Maybe you only set up the domain 2 without adding the php stuff ?

      No code - it just brings up the CGI error about not returning headers. Are you telling me that I need to install a SECOND copy of PHP for the second domain? Or will I just need to edit the php.ini file?

        No,

        you don't need to install a second copy of php but you need to make sure that you set up your php in the IIS properties of the second domain like you did it for the first domain. The same php install is used by both hosts and they share the same php.ini.

        If you already did that then your header call might be incorrect, make sure that there is a : in

        header("Location: /thedir/thescript.php");

        and that an space exists between : and /thedir/thescript.php.
        You might also get that CGI error if the file can't be found.

          when are you suggesting I use that header call?

          I'm new to PHP so please forgive me if I'm missing something blatantly obvious. =)

          But I call my script like this

          <form method="post" action="http://www.mydomain1.com/myphpfile.php">

          Is that the header call you're referring to?

            Sorry,

            I misunderstood your first posting, you wrote about the server redirecting the users, I thought you did that by the header call I mentioned. How did you set up the second Domain ?

              Went into IIS - and where it shows Default Web site, Administrator Web Site, default FTP etc. I just right-clicked. Hit new - site. Then I told it that the new website's home directory is a sub directory of the default website (sub of wwwroot), and set it's header call to the new domain. So that if someone types in www.mydomain2.com it will recognize that the user is after the second site.

              Everything else is duplicated. .php files are pointed at the php.exe file. Permissions are set the same as far as I can tell, but if the scripts are called with www.mydomain2.com they return the cgi header error.

                Hi,

                I found a thread on the php bug pages,

                http://bugs.php.net/bug.php?id=9852

                Seems to be a performance/speed/timing problem. There are several post about how people solved the problem. Maybe you can find a solution to your problem on that page 🙂

                  Write a Reply...