PHP Require Statements not working.php require, server problem
Page 1 of 1
14 Replies - 5498 Views - Last Post: 04 November 2008 - 03:11 PM
#1
PHP Require Statements not working.
Posted 04 November 2008 - 10:54 AM
<?php
print 'test1';
require ('somefile.php');
print 'test2';
somefile.php starts off like this:
<?php
print 'test3'
When I run the main file, the output is 'test1'.... and the rest of the page is blank... Any ideas why? It worked before on the server, and my scripts also work on my localhost machine running the same version of php as the server...
I copied an old copy of the site onto the server, and it doesn't work either. It looks like a server problem. Anyone know the cause?
it's a linux server and the permissions on the files have been set
Replies To: PHP Require Statements not working.
#2
Re: PHP Require Statements not working.
Posted 04 November 2008 - 10:59 AM
print ("test 1");
OR
echo "test 1"
also try using double quotes, ", for the require
#3
Re: PHP Require Statements not working.
Posted 04 November 2008 - 11:08 AM
?>
ending somefile.php?
#4
Re: PHP Require Statements not working.
Posted 04 November 2008 - 11:14 AM
You should copy/paste your full code (no passwords or anything
#5
Re: PHP Require Statements not working.
Posted 04 November 2008 - 11:16 AM
CTphpnwb, on 4 Nov, 2008 - 10:08 AM, said:
?>
ending somefile.php?
There is a ?> at the end
I'm trying the double quotes at the moment.
Moonbat, on 4 Nov, 2008 - 10:14 AM, said:
You should copy/paste your full code (no passwords or anything
i forgot a semi-colon in that example. the code has numerous include statements ..it'd be a big post
#6
Re: PHP Require Statements not working.
Posted 04 November 2008 - 12:28 PM
#7
Re: PHP Require Statements not working.
Posted 04 November 2008 - 12:44 PM
File1:
<?php
print 'test1';
require ('somefile.php');
print 'test2';
?>
somefile.php:
<?php print 'test3'; ?>
I just noticed that you're missing a ; at then end of print 'test3'
This post has been edited by CTphpnwb: 04 November 2008 - 12:46 PM
#8
Re: PHP Require Statements not working.
Posted 04 November 2008 - 12:53 PM
CTphpnwb, on 4 Nov, 2008 - 11:44 AM, said:
File1:
<?php
print 'test1';
require ('somefile.php');
print 'test2';
?>
somefile.php:
<?php print 'test3'; ?>
I just noticed that you're missing a ; at then end of print 'test3'
that works, but the code on the webpages doesn't. it only does if i comment out all the require statements or make them include statements..I kinda need those in though. i could post the code, but it will be many many pages long
#9
Re: PHP Require Statements not working.
Posted 04 November 2008 - 12:59 PM
#10
Re: PHP Require Statements not working.
Posted 04 November 2008 - 01:02 PM
#11
Re: PHP Require Statements not working.
Posted 04 November 2008 - 01:15 PM
Hary, on 4 Nov, 2008 - 12:02 PM, said:
i'll try looking in the log. and my test program does produce "test1test3test2".
gakattack, on 4 Nov, 2008 - 12:10 PM, said:
Hary, on 4 Nov, 2008 - 12:02 PM, said:
i'll try looking in the log. and my test program does produce "test1test3test2".
error logging is disabled on the server....hm..
#12
Re: PHP Require Statements not working.
Posted 04 November 2008 - 01:31 PM
So here's one error:
[Tue Nov 04 10:42:03 2008] [error] [client 192.168.5.129] PHP Fatal error: require() [<a href='function.require'>function.require</a>]: Failed opening required 'DIR_WS_INCLUDESheader.php'
the thing is, DIR_WS_INCLUDES is defined as....
define('DIR_WS_INCLUDES', 'includes/');
This path is correct, it just doesn't process as 'includes/'?
another error is:
[Tue Nov 04 10:43:00 2008] [error] [client 192.168.5.129] PHP Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 24576 bytes) in /export/home/opt/xampp/htdocs/oscom/includes/application_top.php on line 52
hm..
#13
Re: PHP Require Statements not working.
Posted 04 November 2008 - 02:02 PM
#14
Re: PHP Require Statements not working.
Posted 04 November 2008 - 02:51 PM
#15
Re: PHP Require Statements not working.
Posted 04 November 2008 - 03:11 PM
Hary, on 4 Nov, 2008 - 01:51 PM, said:
Thanks Hary and everyone else, that should fix it. If not I'm sure I'll be continuing this thread ..
|
|

New Topic/Question
Reply




MultiQuote







|