www.webdeveloper.com
Results 1 to 4 of 4

Thread: IIS: How can many websites have the same code/class?

  1. #1
    Join Date
    Nov 2010
    Posts
    67

    IIS: How can many websites have the same code/class?

    Lets say I run IIS with 100 websites on it, all 100 websites need a single class. Instead of copying/pasting 100 times, is there a better way?

    I cannot create another "site" with only the class because that site will recognize "include" as a regular HTTP request the handler will pass it to PHP to "run it". Even if I remove the handler for only that site, then any user inside out network would be able to pull up the PHP...

    edit: Maybe if there are no solutions to this, I can do a work around: Configure IIS to treat PHP code as regular text. Then whenver a website request it, it will simple return the PHP code. Then I can block ports so nobody can access it but the server itself... The problem with this workaround: I do not know how to tell IIS to just send out the PHP code.

    edit2: Well I renamed it to textfiles for now. So this workaround is working... But I am looking for a real solution to this problem.
    Last edited by ZeratulsDomain; 02-12-2011 at 09:54 AM.

  2. #2
    Join Date
    Nov 2010
    Posts
    67
    bump?

    I honestly cant be the first person to ever want to do this...

  3. #3
    Join Date
    Jan 2007
    Location
    Wisconsin
    Posts
    2,120
    See http://www.php.net/manual/en/ini.cor...i.include-path

    php.ini
    Code:
    include_path=".;c:\php\includes"
    So, in c:\php\includes\ you might have sharedclass1.php, sharedclass2.php, etc.

    And then, on your sites you might have the following:

    c:\sites\docroot1\index.php
    PHP Code:
    include('sharedclass1.php');
    include(
    'sharedclass2.php'); 
    c:\sites\docroot2\index.php
    PHP Code:
    include('sharedclass1.php'); 
    c:\sites\docroot3\index.php
    PHP Code:
    include('sharedclass2.php'); 
    etc.

    The shared classes (libraries (includes (files) ) ) in this case don't really belong to any site. But, any site can include them.

  4. #4
    Join Date
    Nov 2010
    Posts
    67
    thats brilliant.

    Tnx.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles