Hi Friend,

I need to know this urgently.

How to create a virtual hosting setup in Apache with a single ip and also I have to use php in all the virtual hostings.

my problem is I only can use php in apache root folder but I can not use php in virtual hostings.but I can use html files in
virtual hosting folder.

I know how to set virtual hosting in apache server so html file works fine but I do not know how to set php function for all virtual hostings.

Please help me

Mark

    Hi,

    how did you set up php in the httpd.conf ?

    Thomas

      Hi,

      the php part in httpd.conf

      LoadModule php4_module libexec/mod_php4-4.3.4.so

      <IfModule mod_dir.c>
      DirectoryIndex index.php index.php4 index.php3 index.html index.htm index.cgi index.php index.shtml
      </IfModule>

      Action php4-script /cgi-bin/php
      AddHandler php4-script .php .php4 .php4 .phtml

      <IfModule mod_php4.c>
      AddType application/x-httpd-php .php
      AddType application/x-httpd-php-source .phps
      </IfModule>

      my probles is I can not run php code in virtual hosting folders.I only can use php in apache htdocs folder.I believe I have to add something in http.conf for virtual hostings.

      Please help me.

      Thanks

        Hi,

        with apache 1.3.x you additionally need AddModule mod_php4.c

        Either use LoadModule or Action so remove the lines
        Action php4-script /cgi-bin/php
        AddHandler php4-script .php .php4 .php4 .phtml

        Put the lines
        <IfModule mod_php4.c>
        AddType application/x-httpd-php .php
        AddType application/x-httpd-php-source .phps
        </IfModule>

        somewhere in the global scope (outside any Directory or VirtualHost directive) but below the LoadModule (and AddModule with apache 1.3.x) directive(s).

        Also make sure that you have a valid php.ini.

        Thomas

          4 days later

          I try to take out the part

          Action php4-script /cgi-bin/php
          AddHandler php4-script .php .php4 .php4 .phtml

          but it doen't work also.

          Do you think I have to change DocumentRoot and let DocumentRoot include all the virtual hosting foders.

          my current setting is

          DocumentRoot "/usr/local/apache/htdocs"

          Thanks a lot

          Mark

            Did you install php4 on apache 1.3.x or apache 2.x ?

            Thomas

              Ok,

              with apache 1.3.x do the following:

              Based on a clean (without any php4 configuration) httpd.conf:

              At the end of the LoadModule section:
              LoadModule php4_module libexec/mod_php4-4.3.4.so

              At the end of the AddModule section:
              AddModule mod_php4.c

              Make sure that mod_dir is activated.

              Then:

              <IfModule mod_dir.c>
              DirectoryIndex index.php index.php4 index.php3 index.html index.htm index.cgi index.php index.shtml
              </IfModule>

              <IfModule mod_php4.c>
              AddType application/x-httpd-php .php .phtml
              AddType application/x-httpd-php-source .phps
              </IfModule>

              Make sure to have all of these directives/blocks outside any Directory or VirtualHost sections and do not add any PHP4 Action/AddHandler directives.

              Thomas

                Write a Reply...