placing php includes outside web root

Discussion in 'Programming/Scripts' started by drahcir77, Dec 30, 2013.

  1. drahcir77

    drahcir77 New Member

    I see in some security manuals that placing php include files outside the web root. When I ftp into my web site set up on Ubuntu 12.04 and ISPConfig 3 that there is a private folder. I can place the folder containing the includes there but how do I access them via a php script. I can not figure out how to declare the path to that folder. it lives on my machine at var/www/client2/web2/private/php
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Either use the full path /var/www/..... Or you use a relative path like ../private/php/

    Ensure that you dd the path to the openbasedir setting on the options tab of the ite settings.
  3. drahcir77

    drahcir77 New Member

    not quite sure waht the dd is

    I am not sure what you are saying about the dd in the site settings, I did find the options tab and the base dir, but don't know where the dd goes:)
  4. drahcir77

    drahcir77 New Member

    I figured out : dd

    I figured out the dd, but I still can not get to the includes in the private folder. I have given all folders and files 777 and still can not contact the includes folder. any advice:confused:
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    Do not run chmod 777, it is not nescessary, insecure and it may prevent that the include will work if security components like suexec detect these insecure permissions. So the first step to get inclusions to work is to reset all permissions back to their defaults.

    Then check this:

    1) Ensure that php mode of the website is php-fcgi or php-fpm and that the suexec checkbox is enabled.
    2) add the path from were you want to include scripts to the open_basedir of the website, paths are separated by ":"
    3) Ensure that all your scripts are woned by the web user and client group of the website and not e.g. root. The scripts are owned by the correct user when you upload them by ftp. If you created them as root, then chown them to the web user and client group of this website.
  6. CharlesDole

    CharlesDole New Member

    I want to get all php tool for my assignment. Professor asked me to write a essay about php and i am about to go for any custom essay writing service but before as a final try i am asking here, Can any one please share me some god information
  7. Elizabeth_Keen

    Elizabeth_Keen New Member

    Including php script outside webroot

    including a script that's outside the webroot is easy : you'll do the same way as you're doing for a script that's under the webroot :

    include '../myscript.php';
    include '../library/myscript.php';
    include dirname(__FILE__) . '/../library/myscript.php';

    The one you prefer ;-)
    I would go for the last one, personnaly, though.

    Visit For Innovative Web design and Development
    Last edited by a moderator: Feb 1, 2015

Share This Page