Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 12 of 12

Thread: Php require

  1. #1
    Regular Coder Andy92's Avatar
    Join Date
    Nov 2005
    Location
    Horsham, West Sussex, UK
    Posts
    363
    Thanks
    7
    Thanked 1 Time in 1 Post

    Php require

    Hi there,

    To require a file for inclusion, i use...

    PHP Code:
    <?php require('/home/username/public_html/php/account_bar.php'); ?>
    It is a file which needs to be included using the server path, not the url.

    So i try and include it on a subdomain with the code abouve and it does include, but it doesnt work?

    the url is http://labs.allsortgroup.com

    How can i include this on my subdomain using the server path?

  • #2
    Regular Coder the-dream's Avatar
    Join Date
    Mar 2007
    Location
    Northamptonshire, UK
    Posts
    477
    Thanks
    8
    Thanked 4 Times in 4 Posts
    try using:

    PHP Code:
    include(); 
    i don't know if it will help but you can try!

  • #3
    Regular Coder Andy92's Avatar
    Join Date
    Nov 2005
    Location
    Horsham, West Sussex, UK
    Posts
    363
    Thanks
    7
    Thanked 1 Time in 1 Post
    Nop, still doesnt work.


  • #4
    Regular Coder the-dream's Avatar
    Join Date
    Mar 2007
    Location
    Northamptonshire, UK
    Posts
    477
    Thanks
    8
    Thanked 4 Times in 4 Posts
    hmmm????

    try


    require_once();

    oh and r u really 14!?!

  • #5
    Regular Coder Andy92's Avatar
    Join Date
    Nov 2005
    Location
    Horsham, West Sussex, UK
    Posts
    363
    Thanks
    7
    Thanked 1 Time in 1 Post
    Yes, i am.

    And basically, it does include it, but when users are logged in it says that they arnt.

    This is just because its on a subdomain.

    Ill see if i can try and fix it.


  • #6
    Regular Coder
    Join Date
    Oct 2005
    Location
    Right Here
    Posts
    654
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Well if its not throwing an error I assume you have allow fopen turned on? I run myarmedforces.com and I have tons of subdomains I bounce through and I include files from my main domain all throughout. It should work as long as that server is setup right.

  • #7
    New to the CF scene
    Join Date
    Mar 2007
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hey,

    i guess you have a basedir restriction in effect.
    Set the error_reporting to 4095 on top of your script:

    PHP Code:
    <?php
            error_reporting 
    (4095);
    ?>
    The is E_ALL | E_STRICT

  • #8
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,108
    Thanks
    11
    Thanked 101 Times in 99 Posts
    probably cookies or session cookies are defaulting to the domain where the user logs into (e.g. www.blah.com) this will disallow their usage in e.g. sub.blah.com

    if you are using cookies see setcookie
    if session see session_set_cookie_param
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #9
    New to the CF scene
    Join Date
    Mar 2007
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    But you can set a cookie accessable for all subdomains by setting the cookies domain to ".domain.com"

  • #10
    Senior Coder
    Join Date
    Jan 2007
    Posts
    1,648
    Thanks
    1
    Thanked 58 Times in 54 Posts
    Quote Originally Posted by the-dream View Post
    hmmm????

    try


    require_once();

    oh and r u really 14!?!
    Using either include() or require_once() will make 0 difference from using require().

  • #11
    Regular Coder the-dream's Avatar
    Join Date
    Mar 2007
    Location
    Northamptonshire, UK
    Posts
    477
    Thanks
    8
    Thanked 4 Times in 4 Posts
    Ye! Sorry My Answers Dident Help!

    I am 12!

  • #12
    Regular Coder Andy92's Avatar
    Join Date
    Nov 2005
    Location
    Horsham, West Sussex, UK
    Posts
    363
    Thanks
    7
    Thanked 1 Time in 1 Post
    Ok, i have done it now.



  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •