Hi there,

I am very new to PHP. I have started learning it very recently. I have some working experience with Microsoft ASP. We have created a website that can automatically create a new website in IIS using the ADSI object modules.

Now we wanted to move from (Win 2k, IIS, ASP) to (Linux, Apache, PHP). First of all is this a good choice?? I hope so.

Then how can we automate creating of virtual hosts in Apache server? Are there any script available in the web to do this job?

Please help and your help will be highly appreciated.

Thanks a lot.

Faheem Hameed

    GREAT CHOICE!!! much more stable than microsoft.

    you can fwrite() to the httpd.conf file and write the value you want to the file to create the virtual hosts.

      You'll find that you made absolutely the right move.
      As for help with your Apache, i'd advise you have a look at http://www.apache.org
      You'll find about everything you need there.

      Furtheron i'd take a look at (depending on your distribution) /etc/apache/ where you should find a file named httpd.conf.
      Read that, that should help you.
      Furthermore you should have a look into the man/info pages
      concerning apache.
      and, finally, there should be HOW-TO-documents around that tell you step-by-step how to do waht you want to do.

      However.
      Linux + Apache = great tool.

      have fun with it and never mind the starting difficulties, it's worth it.

      greetings, jakob

        Hi,

        Thanks for your reply.

        I could use fwrite() to httpd.conf . But the website will take effect instantly or we have to re-start the apache?

        Also I wanted to do something like checking whether the site is already existing or not?? I will only add a site if the site is not already existing or else an error message will be displayed.

        Also writing to the httpd.conf on the fly will cause any problems?

        Thanks for your reply.

        Faheem Hameed

          There also are many free existing packages that will do exactly what you want; go fishing on sf.net and freshmeat.net for "apache virtual."

            Hi friends,

            Thanks for your valuable replies. I have found some modules/scripts to manage the Apache virtual hosts. I have to spend more time undersand the scripts since I am very new to Apache and PHP.

            Again thanks for your helps.

            Hameed

              2 months later

              Can you tell me what script did you found, Im still looking for something to edit my httpd.conf with php.

              Thanks in advance!

                Hi!
                Hmmm...
                I'd strongly advise that you read through the "security" chapter of the php manual before you start to edit httpd.conf with php...

                the reason why you can't edit it is file/folder rights.
                You have to be aware that you seriously endanger your server if you make /etc/ -rwx accessible to php...

                but its all in the manual.
                greetings, jakob

                  Good point.

                  Now tell me how do software like plesk, ensim, and others alter system files like httpd.conf, named.conf, and so on?

                  I think they use perl wrappers, but still insecure, dont you think?.

                  Anyways...Im the technician in charge to create a virtual domain web administration and choose php to do that, I will create a virtual host under https to access the web admin and give root access to the system administrator using the USER AND GROUP APACHE DIRECTIVES under that virtual host. Or should I use SUEXEC....I don't now.....

                  Thanks for your posting...

                  🆒

                    Write a Reply...