...

View Full Version : Php require



Andy92
03-21-2007, 11:03 PM
Hi there,

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



<?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?

the-dream
03-21-2007, 11:26 PM
try using:


include();

i don't know if it will help but you can try!

Andy92
03-21-2007, 11:37 PM
Nop, still doesnt work.

:confused:

the-dream
03-21-2007, 11:47 PM
hmmm????

try


require_once();

oh and r u really 14!?!

Andy92
03-22-2007, 12:15 AM
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.

:thumbsup:

iLLin
03-22-2007, 12:28 AM
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.

fackelkind
03-22-2007, 01:20 AM
Hey,

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


<?php
error_reporting (4095);
?>

The is E_ALL | E_STRICT

firepages
03-22-2007, 01:35 AM
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 (http://www.php.net/setcookie)
if session see session_set_cookie_param (http://www.php.net/session_set_cookie_param)

fackelkind
03-22-2007, 01:38 AM
But you can set a cookie accessable for all subdomains by setting the cookies domain to ".domain.com"

aedrin
03-22-2007, 04:19 PM
hmmm????

try


require_once();

oh and r u really 14!?!

Using either include() or require_once() will make 0 difference from using require().

the-dream
03-22-2007, 06:13 PM
Ye! Sorry My Answers Dident Help!

I am 12!

Andy92
03-22-2007, 06:48 PM
Ok, i have done it now.

:thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum