0

My folder stracture like that;

  • system
  • core
  • bootstrap
  • run

In run folder I have a file php file. I can include other files like;

include '../core/...php'

But I want to block that. Can I set it apart from the others?.How should I write my .conf file?

1 Answers1

0

You're looking for the PHP setting open_basedir which limits the files that can be accessed by PHP to the specified directory-tree.

Note the disclaimer:

Caution open_basedir is just an extra safety net, that is in no way comprehensive, and can therefore not be relied upon when security is needed.

Like many settings for PHP it can be set in the php.ini configuration file.

 open_basedir = /path/to/run/

And depending on how your run PHP files ( as Apache mod_php) maybe also in Apache httpd configuration files, in the main httpd.conf and includes for example in VirtualHost and/or Directory blocks and .htaccess files.

php_value open_basedir "/path/to/run/"

php_admin_value open_basedir "/path/to/run/"
HBruijn
  • 77,029
  • 24
  • 135
  • 201