Current location: Hot Scripts Forums » Programming Languages » PHP » doc_root


doc_root

Reply
  #1 (permalink)  
Old 05-15-09, 06:15 PM
tobyjoiner tobyjoiner is offline
Newbie Coder
 
Join Date: Nov 2006
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
doc_root

Is there anyway to read doc_root variable from php.ini?

I have tried
PHP Code:

ini_get('doc_root'
and I dont want the value in
PHP Code:

$_SERVER['DOCUMENT_ROOT'
because I need to run it command line and that doesn't work in command line.

I am also willing to use any other variable that I can set custom in the php.ini

Thanks,

Toby
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 05-16-09, 04:45 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,074
Thanks: 11
Thanked 88 Times in 83 Posts
Quote:
Originally Posted by tobyjoiner View Post
[...] and that doesn't work in command line.
May I ask why?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 05-16-09, 02:39 PM
tobyjoiner tobyjoiner is offline
Newbie Coder
 
Join Date: Nov 2006
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
There is no value in $_SERVER['DOCUMENT_ROOT'] from the command line.

I have read that somewhere before, and here is what comes out when I run this:

PHP Code:

print_r($_SERVER); 

I cut out the top part of the output because it does nothing to help this:
Code:
 [PHP_SELF] => d:\wamp\www\deleteme.php
   [SCRIPT_NAME] => d:\wamp\www\deleteme.php
   [SCRIPT_FILENAME] => d:\wamp\www\deleteme.php
   [PATH_TRANSLATED] => d:\wamp\www\deleteme.php
   [DOCUMENT_ROOT] =>
   [REQUEST_TIME] => 1242498822
   [argv] => Array
       (
           [0] => d:\wamp\www\deleteme.php
       )

   [argc] => 1
So does anyone know a way to get a custom php.ini variable back to php?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 05-16-09, 04:14 PM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,516
Thanks: 20
Thanked 109 Times in 106 Posts
Notes on $_SERVER variables:

PHP: CGI and command line setups - Manual

Options:

PHP: Magic constants - Manual

-- or --

instead of using command line PHP use wget http://localhost/thefile.php - which will execute it through Apache/IIS.

If you need the wget output, use -O option.

-- or --

Create an include file that provides the constants you need to both server served and command line processed scripts.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 05-16-09, 04:55 PM
tobyjoiner tobyjoiner is offline
Newbie Coder
 
Join Date: Nov 2006
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
yea, I think your right, there are other issues that I am running into with the command line, so I'll just use the wget. Thanks for the help from both of you.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump


All times are GMT -5. The time now is 01:39 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.