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

auto_prepend_file

Discussion in 'Plesk for Linux - 8.x and Older' started by dietcheese, Mar 8, 2007.

  1. dietcheese

    dietcheese Guest

    0
     
    Anyone know how to auto_prepend_file for inclusion in all domains without having to edit the vhost.conf in every domain?

    Thanks.

    DC
     
  2. breun

    breun Golden Pleskian

    29
     
    Joined:
    Jun 28, 2005
    Messages:
    1,647
    Likes Received:
    0
    If you want to add something to the global httpd config, the cleanest way is usually to create a new .conf file in /etc/httpd/conf.d/. All .conf files in that dir are automatically included in the global config and don't get overwritten by upgrades.
     
  3. dietcheese

    dietcheese Guest

    0
     
    I want to auto_prepend some PHP libraries to any PHP page - but not to any other type of page.

    Can I do this via /etc/httpd/conf.d/

    Thanks,
    DC
     
  4. dietcheese

    dietcheese Guest

    0
     
    Well, apparently Plesk is not really capable of properly using auto_prepend_file.

    After all my Plesk headaches this comes as no surprise.

    Some more research has however offered several bad suggestions from setting open_basedir to "none" in /etc/php.ini to putting the prepended file in /tmp.

    Does anyone have a good solution?

    Thanks,
    DC
     
  5. breun

    breun Golden Pleskian

    29
     
    Joined:
    Jun 28, 2005
    Messages:
    1,647
    Likes Received:
    0
    This has nothing to do with Plesk really. Anything you can do on a regular apache install can be done when using Plesk.
     
  6. dietcheese

    dietcheese Guest

    0
     
    By default Plesk uses vhost.conf to restrict the PHP value for "open_basedir".

    This prevents files from being auto_prepended via php.ini.

    I'd say that has everything to do with Plesk.
     
  7. breun

    breun Golden Pleskian

    29
     
    Joined:
    Jun 28, 2005
    Messages:
    1,647
    Likes Received:
    0
    Plesk uses httpd.include to do this, not vhost.conf. And nothing prevents you from overriding the open_basedir path in vhost.conf.
     
  8. dietcheese

    dietcheese Guest

    0
     
    I'm running Plesk 8.1. Plesk defines the open_basedir restriction on a per-domain basis (at least mine does) in vhost.conf. All of my domains have vhost.conf, and each of them are restricted by it.

    Overriding the restrictions via httpd.include will, so far as I know, override ALL of the vhost.conf settings - domain-specific settings that I want to keep. If I'm wrong about this please end my suffering and let me know how it is done.
     
  9. breun

    breun Golden Pleskian

    29
     
    Joined:
    Jun 28, 2005
    Messages:
    1,647
    Likes Received:
    0
    It seems you've got it all backwards. By default Plesk only generates a conf/httpd.include file for domain. This is a file you should never edit (like it says in the comments at the top of those files).

    If you want to override or add any settings for a domain you create a conf/vhost.conf file (and run websrvmng to have it add an include in the httpd.include file). In this way you can change a domain's open_basedir path. The SWsoft knowledge base even has an article on this very topic: http://kb.swsoft.com/article_41_432_en.html
     
  10. dietcheese

    dietcheese Guest

    0
     
    I think maybe you are misunderstanding me.

    I do not want to open_basedir for a single domain, which I would do with vhost.conf. I want to open_basedir for ALL existing domains, without creating a new vhost.conf for each of them.

    The problem with this is that when a new domain is created, the conf/httpd.include file that is created with it contains the following basedir directive:

    php_admin_value open_basedir "/var/www/vhosts/domainname.com/httpdocs:/tmp"

    This directive overrides any open_basedir directive put in /etc/httpd/conf/httpd.include.

    I want to "globally" open_basedir for all domains so I can auto_prepend_file via php.ini.

    DC
     
  11. dietcheese

    dietcheese Guest

    0
     
    Is there a way to

    1) append to the order in which the .include files are processed (i don't know where this is done but it isn't in httpd.conf)

    or

    2) regenerate all the domains after modifying the skeleton? I believe that when you migrate, the new server applies its skeleton to the old files. Not sure about this though.

    Help appreciated

    DC
     
  12. breun

    breun Golden Pleskian

    29
     
    Joined:
    Jun 28, 2005
    Messages:
    1,647
    Likes Received:
    0
    Ok, so you were talking about httpd.conf (global) instead of httpd.include (domain specific)...

    No, there is no single file you can edit to override the open_basedir path for all domains. You'll have to create a vhost.conf file for every domain (you may want to script that if there's a lot of domains). For new domains you can put a prepared vhost.conf in the skeleton with the open_basedir path override already there.
     
  13. dietcheese

    dietcheese Guest

    0
     
    I have now found that I will also have to turn off safe mode for all those sites in order to include the file I want to prepend.

    This sucks.

    All I am trying to do is auto_prepend a file to all my domains, so I can automatically include some small library files that I have created. This should be easier then having to add a vhost.conf and turning safe mode off on every domain.

    Sheesh :rolleyes:

    DC
     
  14. dietcheese

    dietcheese Guest

    0
     
    Not to mention the fact that I just migrated to a new server from 7.5.4->8.1 and even though all the vhost.conf files were copied, the paths were not adjusted for the domain root so all my old files are:

    <Directory /home/httpd/vhosts/domain.com>

    but my new domain directory is actually

    /var/www/vhosts/domain.com

    Therefore none of the vhost.conf's work.

    Thanks SWSoft for making my life a living hell over the past month.

    DC
     
  15. breun

    breun Golden Pleskian

    29
     
    Joined:
    Jun 28, 2005
    Messages:
    1,647
    Likes Received:
    0
    Create a symbolic link and they should all work again:

    Code:
    ln -s /var/www/vhosts /home/httpd/vhosts
     
  16. dietcheese

    dietcheese Guest

    0
     
    tried it already, doesn't work.
    DC
     
  17. breun

    breun Golden Pleskian

    29
     
    Joined:
    Jun 28, 2005
    Messages:
    1,647
    Likes Received:
    0
    Worked perfectly for me.
     
  18. dietcheese

    dietcheese Guest

    0
     
    Hmmm....maybe I'm doing something wrong, but I don't seem to be:

    [root@109839-app1 conf]# ls -la /home/

    lrwxrwxrwx 1 root root 8 Feb 13 17:21 httpd -> /var/www


    This doesn't work:

    vhost.conf

    <Directory /home/httpd/vhosts/domain.com/httpdocs>
    php_admin_value open_basedir "/home/httpd/vhosts/domain.com/httpdocs:/tmp:/home/httpd/vhosts/"
    php_admin_value upload_tmp_dir /tmp
    php_admin_flag safe_mode off
    </Directory>

    This does work:

    vhost.conf

    <Directory /var/www/vhosts/domain.com/httpdocs>
    php_admin_value open_basedir "/home/httpd/vhosts/domain.com/httpdocs:/tmp:/home/httpd/vhosts/"
    php_admin_value upload_tmp_dir /tmp
    php_admin_flag safe_mode off
    </Directory>

    permissions on the link?
     
  19. breun

    breun Golden Pleskian

    29
     
    Joined:
    Jun 28, 2005
    Messages:
    1,647
    Likes Received:
    0
    I linked /home/httpd/vhosts to /var/www/vhosts directly, not /home/httpd to /var/www.
     
  20. dietcheese

    dietcheese Guest

    0
     
    First off, thanks for all your help - many of your posts on this forum and on the ART forum have really helped me out lately. :)

    So...do you mean like this?

    [root@109839-app1 httpd]# pwd
    /home/httpd

    [root@109839-app1 httpd]# ls -la
    total 12
    drwxr-xr-x 2 root root 4096 Mar 12 18:37 .
    drwxr-xr-x 6 root root 4096 Mar 12 18:37 ..
    lrwxrwxrwx 1 root root 16 Mar 12 18:37 vhosts -> /var/www/vhosts/

    That doesn't work for me. It ignores all entire Directory directives in vhost.conf indicating that it probably doesn't think /home/httpd/vhosts/domain.com/httpdocs exists.

    When I change Directory to /var/www/vhosts/domain.com/httpdocs it immediately works.

    :confused:

    DC
     
Loading...