$_SERVER[DOCUMENT_ROOT]
Moderator: General Moderators
$_SERVER[DOCUMENT_ROOT]
I need to know a very simple thing and a 100% correct answer.
does $_SERVER[DOCUMENT_ROOT] work in safe mode ??
if yes is there any circumstances when $_SERVER[DOCUMENT_ROOT] doesnt work ??
please help me.
--------------------------------
I am talking about PHP 4 and above
does $_SERVER[DOCUMENT_ROOT] work in safe mode ??
if yes is there any circumstances when $_SERVER[DOCUMENT_ROOT] doesnt work ??
please help me.
--------------------------------
I am talking about PHP 4 and above
Last edited by nwp on Sat Jul 21, 2007 2:00 pm, edited 1 time in total.
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
- The Phoenix
- Forum Contributor
- Posts: 294
- Joined: Fri Oct 06, 2006 8:12 pm
Re: $_SERVER[DOCUMENT_ROOT]
No but there are workarounds.nwp wrote:I need to know a very simple thing and a 100% correct answer.
does $_SERVER[DOCUMENT_ROOT] work in safe mode ??
Yes, it also does not generally work on OpenBSD, or when using non-apache webservers (not all web servers pass that information to php).nwp wrote:if yes is there any circumstances when $_SERVER[DOCUMENT_ROOT] doesnt work ??
please help me.
- Ollie Saunders
- DevNet Master
- Posts: 3179
- Joined: Tue May 24, 2005 6:01 pm
- Location: UK
Don't use safe mode. I've been deprecated since PHP 5.1 (i think) and will be removed in PHP 6. If you are trying to secure your PHP config then I recommend something like this:Selective overridding for strengthening / relaxing these in VirtualHost is pretty esseniual as well and can be done with code like this:
There's also suhosin
Code: Select all
register_globals=off
allow_url_fopen=off
enable_dl=off
expose_php=off
disable_functions=sql_regcase,escapeshellarg,escapeshellcmd,exec,passthru,proc_cl,se,proc_get_status,proc_nice,proc_open,proc_close,proc_terminate,shell_exec,system,openlog,syslog,virtual
open_basedir = /var/www/ ; be even more specific if you like in each virutalhost
error_reporting = E_ALL
log_errors = On
; consider making this virutalhost specific
error_log = /var/www/logs/php/php_error_log
display_errors = Off
display_startup_errors = Off
memory_limit = 8M ; this is pretty strict, increase for gd work
post_max_size = 8M
max_input_time = 60
max_execution_time = 30 ; reduce on fast servers (mine is 10)
file_uploads = Off
upload_max_filesize = 2M
upload_tmp_dir = /var/www/tmp
; set this to same as ServerName in each name-based vitualhost
session.referer_check = localhostCode: Select all
php_flag file_uploads on
php_admin_value open_basedir "/monkey"
php_value post_max_size "4M"- The Phoenix
- Forum Contributor
- Posts: 294
- Joined: Fri Oct 06, 2006 8:12 pm
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
- Ollie Saunders
- DevNet Master
- Posts: 3179
- Joined: Tue May 24, 2005 6:01 pm
- Location: UK
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
- Ollie Saunders
- DevNet Master
- Posts: 3179
- Joined: Tue May 24, 2005 6:01 pm
- Location: UK
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm