Hi there,

Just trying to convert my webserver from apache 1.3.27 to 2.0.43, but I ran in to some problems, hope somebody has an idea.

In apache 1.3.27 you are able to do the following:

<VirtualHost 1.2.3.4>
ServerAdmin you@your.domain
DocumentRoot /path/to/web/
ServerName web.your.domain
AddType application/x-httpd-php .htm .php .php3
php_value auto_prepend_file "/path/to/files/prepend.inc"
php_value auto_append_file "/path/to/files/append.inc"
</VirtualHost>

I have tried to put this in the 2.0.43 httpd.conf file, but it has no effect.
It works if I put the Addtype in the global configuration.

The reason for me to want to do it like this is that I want to be able to swich php on/off for the different domains running on the server, controlled by <virtualhost> or has this changed now ?

    Put the AddType into the main global config then add:

    php_flag engine off

    in the virtual hosts that you don't want PHP to work.

      Originally posted by rpanning
      Put the AddType into the main global config then add:

      php_flag engine off

      in the virtual hosts that you don't want PHP to work.

      Ok, I will try that right away.

      thanks.

      By the way if I want to use different extensions for php, like .php on one site and .php4 on another, how do I do that ?

        5 days later

        Why don't you just enable .php and .php4 on all the sites?

          Well some sites need ie .htm as normal html and not with php, its a policy that they are not able to.

          Other sites wants .htm with php, the .php and .php4 was just an example.

          In apache-1.3.x is was possible to put the AddType in under every virtualhost to control the extensions, but in 2.0.43 it doesnt work. Just wondered if there was a way around that, with a new and smart feature 🙂

            You could globally allow .htm, .php, .php4 and .php3. The people who don't want to use the .php extensions don't have to, and the people who don't want to use .htm don't have to either. Just enable them all and then people can choose what they want to use.

              I userstand what you mean.

              But just enabling it would give people that are not supposed to have script access to the server a potential access.

              Right now I just testing the setup and trying to figure out if we want to switch to 2.0 or not.

              But I guess that the best way is probably to turn it on globally and then use "php_flag engine off" to make sure that people cannot use the php functions.

              The "php_flag engine on/off" works perfect.

              Just wondered if there was a feature in 2.0 about adding extension by virtiualhost.

                Write a Reply...