Closed Thread
Results 1 to 7 of 7
Like Tree1Likes
  • 1 Post By descalzo

Thread: PHP Include Help?

  1. #1
    freewebs.com.asdfduh84 is offline x10Hosting Member freewebs.com.asdfduh84 is an unknown quantity at this point
    Join Date
    Jan 2011
    Posts
    21

    PHP Include Help?

    In a index.php file on a section of my website, I have several PHP includes like this one:

    PHP Code:
    <?php include('./xy7/2/include/header1.php'); ?>
    This does not work when I load the index file, nor do any of the other ones. Can anybody help me with this?

  2. #2
    Livewire's Avatar
    Livewire is offline Abuse Compliance Officer Livewire is a glorious beacon of lightLivewire is a glorious beacon of light
    Join Date
    Jun 2005
    Location
    Behind a keyboard.
    Posts
    8,998

    Re: PHP Include Help?

    Try it without the leading ./ and see if it works; include is not a blocked function and it works perfectly within CMS's like Joomla and Wordpress, so it's going to end up being a code problem.


    TOS breakers will be suspended regardless of race, creed, national origin, hair color, or favorite food. Thanks for your understanding!

  3. #3
    freewebs.com.asdfduh84 is offline x10Hosting Member freewebs.com.asdfduh84 is an unknown quantity at this point
    Join Date
    Jan 2011
    Posts
    21

    Re: PHP Include Help?

    Unfortunately, that did not fix it. Do you have any more suggestions?

  4. #4
    Livewire's Avatar
    Livewire is offline Abuse Compliance Officer Livewire is a glorious beacon of lightLivewire is a glorious beacon of light
    Join Date
    Jun 2005
    Location
    Behind a keyboard.
    Posts
    8,998

    Re: PHP Include Help?

    Where/what subdirectory is it in on your site? The includes are working on the main site so it's gotta be a code problem. I'm heading away from my PC for a bit but I can check into it when I get back; no guarantees I'll be able to figure it out (I'm not an expert at PHP) but I'm willing to give it a shot.


    TOS breakers will be suspended regardless of race, creed, national origin, hair color, or favorite food. Thanks for your understanding!

  5. #5
    freewebs.com.asdfduh84 is offline x10Hosting Member freewebs.com.asdfduh84 is an unknown quantity at this point
    Join Date
    Jan 2011
    Posts
    21

    Re: PHP Include Help?

    index.php is located at /xy7/2/index.php.
    The include file in this situation is located at /xy7/2/include/header1.php.

  6. #6
    descalzo's Avatar
    descalzo is offline Grim Squeaker descalzo has a brilliant futuredescalzo has a brilliant futuredescalzo has a brilliant future
    Join Date
    Jul 2009
    Location
    Ankh-Morpork
    Posts
    7,636

    Re: PHP Include Help?

    PHP Code:

    <?php include('include/header1.php'); ?>
    OR

    PHP Code:

    <?php include('/home/cPanelUSERNAME/public_html/xy7/2/include/header1.php'); ?>
    assuming the directory xy7 is in public_html
    Livewire likes this.
    Nothing is always absolutely so.

  7. #7
    freewebs.com.asdfduh84 is offline x10Hosting Member freewebs.com.asdfduh84 is an unknown quantity at this point
    Join Date
    Jan 2011
    Posts
    21

    Re: PHP Include Help?

    Both of those worked, thanks!

Closed Thread

Similar Threads

  1. php include
    By monsterm in forum Free Hosting
    Replies: 7
    Last Post: 07-15-2009, 06:11 PM
  2. PHP Url Include
    By vwd2009 in forum Free Hosting
    Replies: 3
    Last Post: 05-23-2009, 11:23 AM
  3. Help With php include
    By evil-bunny in forum Programming Help
    Replies: 4
    Last Post: 04-27-2009, 11:10 AM
  4. php include
    By Conmiro in forum Programming Help
    Replies: 4
    Last Post: 03-28-2009, 02:29 PM
  5. php include is this possible
    By nahsorhseda in forum Programming Help
    Replies: 5
    Last Post: 12-28-2007, 12:09 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers