SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Zealot Para's Avatar
    Join Date
    Mar 2005
    Location
    London UK
    Posts
    155
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Running multiple sites from 1 script, what would my process be?

    Hi all, i have many clients that i host php shopping carts for, i use the same script for all my clients, however when it is time to upgrade or apply bug fixes to the script i find myself having to do each site individually, and with my client base growing rapidly its taking to way to much time to do this for each site.

    So, i want to develop a system where i can run all the sites from 1 script so that changes can be applied throughout all my clients at once.

    What would my process be? can anyone give any input?

    Heres all i could come up with after hours of brainstorming

    My idea was to have the main script install in a folder

    /main/

    And all clients in seperate folders

    /client_name/

    In the clients folder, i would duplicate the main script and edit the files so that they INCLUDE the same file from the main script folder, and the only file that would be unique would be the config.php which would reflect individual database or URL data.


    This is pretty much the only way i can think of doing this, is this a good route for me to go as i need to get stuck into this asap.

    There are many examples of scripts that host multiple sites from 1 script/db, like sebflippers phpbb multiforums for example, this system seems to work good.

    Thanks in advance for any input.

    PS: I hope this is in the right forum, i felt it was more of a "PHP" question rather than an "Online scripts and services" question as im looking for code and practicle examples of howto develop this in php.

  2. #2
    SitePoint Addict
    Join Date
    Jan 2007
    Posts
    344
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's pretty much the way I've done it in the past. An alternative is to have separate roots that do virtual includes of the base code. This actually works a bit better for folder layout.

  3. #3
    SitePoint Addict
    Join Date
    Mar 2003
    Location
    In a house in the USA
    Posts
    293
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have not done this but if you are on linux you could use symlinks. Which would only create a reference to the main files.

    You would have to create a new symlink to each directory for the script. So if your script had an includes, images and a templates folder there would be a symlink for each. Then each file in the root directory except for your config file would also have a symlink.

    You could automate the process of creating these symlinks and copy of the default config file by creating a shell script which you would just pass a variable of the users home directory to where you want the files created.

    So it would only take you a matter of seconds to get the base configuration of their site setup.
    Daniel
    http://www.wlscripting.com - PHP Tutorials and code snippets
    Notepad++ Function List plugin tip - for PHP developers

  4. #4
    SitePoint Enthusiast abhai2k's Avatar
    Join Date
    Jun 2005
    Location
    India
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmmm it is a good idea but then if you do use this method then if your server goes down then their shopping cart is useless..
    A safe way would be this :
    1. Load up the core script functions etc in your main server ( your domain ). This 'core functions' are the main functions whic the cart/script need and which would be more prone to upgrades.
    2. Load the complete script to clients server also. Now you can simply include all files from your server instead of including it in their server and keep a check. Incase your server goes down then include files from their server.
    3. Since even now you will have to apply the upgrades to each site you have another cron job on the client server which checks for changes say every week or month. If file changes are there then update.
    Pretty complex method but i have done this before.

    Also i strongly advise not using 1 db for all clients. Let clients have their own db. And if you are developing this system only because u want to upgrade in one shot then simply use the cron update method...
    http://www.webblogged.com -Article on seo, web design and coding.

  5. #5
    SitePoint Addict
    Join Date
    Mar 2003
    Location
    In a house in the USA
    Posts
    293
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I just thought about another option. Using an SVN server to store all of your changes. That way all you have to do is checkout a copy of the main files and update on occasion to make sure your files are up to date. Then you would just need to run some kind of database update script to update any kind of database files. Every site would have their own files and it would be simple to upgrade.

    If your clients had shell access they could then check for updates on their own and update on their own without you needing to do anything except for committing your changes to the SVN server.
    Daniel
    http://www.wlscripting.com - PHP Tutorials and code snippets
    Notepad++ Function List plugin tip - for PHP developers

  6. #6
    SitePoint Zealot Para's Avatar
    Join Date
    Mar 2005
    Location
    London UK
    Posts
    155
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the input guys, this gives me something to work with. Not sure what route im going to take yet, but at least i have choice

    Ill update my thread with my progress as it could be useful for others in the same situation.


Bookmarks

Posting Permissions

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