php doc_root set with custom php.ini per domain

Zagorax

Verified User
Joined
Jan 11, 2011
Messages
67
Hi all,

I've followed this guide:

http://help.directadmin.com/item.php?id=183

But I've set a per domain php.ini.

My .ini file is read and you can see it here:

http://bran-dun.org/php_info.php

The content of custom.ini is:

Code:
[PHP]
doc_root = /home/brandun/domains/bran-dun.org/public_html

Unfortunately, if I do:

Code:
<?php print_r(scandir('/')); ?>

It prints the server root contents and not the domain public_html contents.

Where am I wrong? Thank you very much.
 
Hello,

doc_root as far as I see it, does not transform / to /home/brandun/domains/bran-dun.org/public_html

PHP's "root directory" on the server. Only used if non-empty. If PHP is configured with safe mode, no files outside this directory are served. If PHP was not compiled with FORCE_REDIRECT, you should set doc_root if you are running PHP as a CGI under any web server (other than IIS). The alternative is to use the cgi.force_redirect configuration below

http://www.php.net/manual/en/ini.core.php#ini.doc-root

scandir — List files and directories inside the specified path

http://www.php.net/manual/en/function.scandir.php

p.s You've got safe_mode = Off
 
p.s You've got safe_mode = Off

Unfortunately false. :)
In Admin->PHP Settings I've 'ON' both safe_mod and open_base_dir for that domain. Do I need something else to make i working?

However, I have read that safe_mode was erased from newer php version. So, is there any way to avoid root listing without safe_mode?

And are you aware of any way to set php document root the same as the server document root? So that '/' will point to the document root in php, too.

Cheers,
Zag
 
In Admin->PHP Settings I've 'ON' both safe_mod and open_base_dir for that domain. Do I need something else to make i working?

If I'm not mistaken, these settings do not effect suPHP, you need to use individual php.ini (per user) and enable them (safe_mod and open_base_dir) in php.ini.

And are you aware of any way to set php document root the same as the server document root?

No, I am not.

Maybe this:
http://php.net/manual/en/function.chroot.php

Or you might want to try to run php-fpm in a chroot'ed environment.
 
Back
Top