Php Function Include

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Php Function Include

    in my script i have these files.

    ../sources/core.php

    and

    ../controls/admin/index.php


    i do this in ../controls/admin/index.php

    Code:
    <?php
    
    include("../sources/core.php");
    
    
    blah blah blah
    
    ?>
    when i try to access

    ../controls/admin/index.php

    i get
    Code:
    Warning: include(../sources/core.php) [function.include]: failed to open stream: No such file or directory in /home/user/public_html/controls/owner/index.php on line 3
    
    Warning: include(../sources/core.php) [function.include]: failed to open stream: No such file or directory in /home/user/public_html/controls/owner/index.php on line 3
    
    Warning: include() [function.include]: Failed opening &#39;../sources/core.php&#39; for inclusion (include_path=&#39;.:/software/php/lib/php&#39;) in /home/user/public_html/controls/owner/index.php on line 3

    can sum1 plz help me with this. i dnt see the problem

    #2
    try

    <?php

    require("../sources/core.php");


    blah blah blah

    ?>[/b]
    might work might not

    Comment


      #3
      i got it fixed. i put a variable in page
      Code:
      $scriptpath = "home/user/public_html";
      then
      Code:
      include("".$scriptpath."/sources/core.php");
      works great

      Comment


        #4
        having ../ in link means its lookin for file thats back 1 folder on server so ../../ would be back 2 folders etc

        Comment


          #5
          ya shouldnt need all that in path though

          Comment

          Working...
          X