1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

Dedicated Server: How do I set up a folder to be shared across multiple domains

Discussion in 'Plesk for Linux - 8.x and Older' started by hermes, Feb 9, 2006.

  1. hermes

    hermes Guest

    0
     
    I would like to have a folder wherein I can store reusable .php functions and javascript...plus ideally any other reusable items across my websites.

    I have a dedicated server with a number of websites on it, and would rather not have to make changes across all the sites whenever I make changes to items that are commonly used by all the sites.

    I tried putting files into the /var/www/cgi-bin/ folder as an experiment, but got a

    Warning: main(): open_basedir restriction in effect. from .php.

    Any ideas?
     
  2. Highland

    Highland Guest

    0
     
    You'll have to disable the open_basedir settings on every domain by creating a vhost.conf file. Put the following in it
    Code:
    <Directory /home/httpd/vhosts/yourdomain.com/httpdocs>
    php_admin_value open_basedir none
    </Directory>
    Now put that file into the conf directory of your domain and run the following
    Code:
    /usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=yourdomain.com
    From http://download1.sw-soft.com/Plesk/Plesk7.1/Doc/html/plesk-7-reloaded-admin/apas02.html
     
  3. hermes

    hermes Guest

    0
     
    Highland:

    Thanks so much for your help! You were certainly pointing me in the right direction. Without your help I certainly wouldn't have figured this out though, so thanks!

    It turns out that your solution takes care of the .php error, but leaves php scripts in one domain able to access items in the other domain. What I was looking for was a more full-featured solution.

    The following I'm putting in for anyone after me who has a similar issue to mine. That is: I wanted a central repository where I could put both public reusable items and private reusable items for my various domains on my dedicated server.

    I fumbled around for a bit trying to enact the instructions in the preceding post. There was no /home/httpd/vhosts/<domain-name>/conf/
    folder, so I tried making one and running the
    Code:
    /usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=yourdomain.com
    code in putty. No dice.

    Then I realized that it was probably because the folder hierarchy was different on my server. Instead of home/httpd/vhosts/mydomain... my server has /var/www/vhosts/mydomain/
    So by both changing this string in the vhost.conf file AND moving the said file to the conf file of the /var/www/vhosts/mydomain/conf/ folder AND THEN running the code in Putty...it worked.

    However I figured out quickly that this no longer put bounds on .php files to access NY domain on my server, and potential security problems wouldn't be contained to only that domain...

    Furthermore this didn't take care of the issue of included javascript being kept in a directory above my domain's root folder.

    So the solution was twofold:
    1: I created an alias to make a shared folder accessible to html documents for public shared items

    2: I made a private folder and allowed .php to access that folder without throwing an error

    The resulting vhost.conf file looks like this:
    Code:
    Alias  /shared_public_items /var/www/vhosts/shared_public_items/
    <Directory /var/www/vhosts/MYDOMAIN/httpdocs>
    php_admin_value open_basedir "/var/www/vhosts/MYDOMAIN/httpdocs:/tmp:/var/www/vhosts/shared_private_scripts"
    </Directory>
    
    This meant that I can now put shared images and javascript code in the shared_public_items folder, and can put included .php files in the shared_private_scripts file, and can use these assets across all of my domains.

    As I'm new to this...if anyone out there can identify a PROBLEM with what I've done I'd much appreciate you telling me!

    Btw: for the other newbies out there: I had to run the line of code in putty after each change to the vhost.conf file in order for it update.

    Final note: this process has to be duplicated for each domain that I want to operate this way, and have access to the shared folders...
     
  4. phingers

    phingers Guest

    0
     
    Thanks for the great help, I'm trying to setup this very similar situation on my server now.

    What is the best way to now reference these shared script files in php?

    Thanks.
     
Loading...