require_once

Discussion in 'PHP' started by naopublic, Jun 20, 2013.

  1. #1
    Not sure why.

    define('PHPRPG_DIR',  '/game');
     
    define('PHPRPG_ERROR_FILE', PHPRPG_DIR.'/share/log/error.log');
    Code (markup):

     
    naopublic, Jun 20, 2013 IP
  2. ActiveFrost

    ActiveFrost Notable Member

    Messages:
    2,072
    Likes Received:
    63
    Best Answers:
    3
    Trophy Points:
    245
    #2
    Do those files exist in the given location?
     
    ActiveFrost, Jun 20, 2013 IP
  3. lph

    lph Member

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #3
    Check line 61. Is the path correct? And as stated by ActiveFrost, are the files present?
     
    lph, Jun 20, 2013 IP
  4. sarahk

    sarahk iTamer Staff

    Messages:
    28,897
    Likes Received:
    4,555
    Best Answers:
    123
    Trophy Points:
    665
    #4
    when you define a path in PHP it's from the root of the hosting account, not the root of the url.
    I suspect that
    define('PHPRPG_DIR', '/game');
    should be
    define('PHPRPG_DIR', '/home/a2901808/public_html/game');
     
    sarahk, Jun 20, 2013 IP
  5. sorindsd

    sorindsd Well-Known Member

    Messages:
    201
    Likes Received:
    3
    Best Answers:
    2
    Trophy Points:
    118
    #5
    If you don't know the path you should try to include it relatively to the existing file.
    For example require_once(dirname(__FILE__)."/init.php")
     
    sorindsd, Jun 21, 2013 IP
  6. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #6
    or just remove the leading slash -- since generally speaking that too is NOT a relative path... but generally speaking if you 'need' to absolute path anything in your code or even up-tree path (..\) it, you've probably got a bad directory structure set up.
     
    deathshadow, Jun 21, 2013 IP
  7. robinton

    robinton Member

    Messages:
    44
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    33
    #7
    i think using this solve problem

    define('PHPRPG_DIR', '../game');
     
    robinton, Jun 22, 2013 IP