473,405 Members | 2,160 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

require_once() dumping text instead of including file

I'm facing a problem with require_once...

Instead of actually including the file i'm requiring, it just dumps it
out as text...

other functions are working quite well...

the code look like this:

$forum_version = 'SMF 1.0 RC2';

// Get everything started up...
define('SMF', 1);
@set_magic_quotes_runtime(0);
$time_start = microtime();

// Load the settings...
require_once(dirname(__FILE__) . '/Settings.php');
error_reporting(isset($db_show_debug) && $db_show_debug === true ?
E_ALL : E_ALL ^ E_NOTICE);

// And important includes.
require_once($sourcedir . '/QueryString.php');

After this line:
require_once(dirname(__FILE__) . '/Settings.php');

It just displays the contents of Settings.php as text to the browser -
no code execution...
Although dirname(__FILE__) works fine and actually returns the correct
directory name of the current file, so i can't really tell if it's a
problem with php code execution in general or just this function
(require_once)...

Thanks.

Jul 17 '05 #1
5 2078
mostof wrote:
I'm facing a problem with require_once...

Instead of actually including the file i'm requiring, it just dumps it
out as text...


The file probably uses an extension, which isn't associated with the PHP
interpreter. When you use Apache, have a look at the AddType directive.
JW
Jul 17 '05 #2
or maybe you forgot to put <?php and ?>

Jul 17 '05 #3
.oO(Janwillem Borleffs)
mostof wrote:
I'm facing a problem with require_once...

Instead of actually including the file i'm requiring, it just dumps it
out as text...


The file probably uses an extension, which isn't associated with the PHP
interpreter. When you use Apache, have a look at the AddType directive.


The name and extension of included files don't matter, you can name them
whatever you like. It looks like the <?php .. ?> tags are missing in the
included file.

Micha
Jul 17 '05 #4
That was it! It seems file upload didn't complete or the file got
corrupted...

Jul 17 '05 #5
On Fri, 18 Feb 2005 14:07:13 +0100, Janwillem Borleffs <jw@jwscripts.com>
wrote:
mostof wrote:
I'm facing a problem with require_once...

Instead of actually including the file i'm requiring, it just dumps it
out as text...


The file probably uses an extension, which isn't associated with the PHP
interpreter. When you use Apache, have a look at the AddType directive.


If you're include() or require()'ing a file off the _filesystem_ it doesn't
matter what extension it has - Apache simply isn't involved.

--
Andy Hassall / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: the wonderer | last post by:
This is an elementary question, but I've not been able to find the answer, so here goes: I am developing a site using php. I have the html header information in a file that I include in all the...
6
by: Nik Coughin | last post by:
Say I have a script: http://www.mydomain.com/test/admin/foo.php That looks like this: <?php $baseDir = "http://" . $_SERVER . "/test"; require_once( $baseDir . '/helpers/helper.php' );
3
by: Sean Quinn | last post by:
Hi, I don't know if anyone has run into similar problems, but it seems like when I use `require_once(...)' with files that contain functions I get an error indicating that it can't redeclare the...
11
by: Kimmo Laine | last post by:
I'm flipping my wig here, people. I'm using classes and making each class a file. when I'm including dependet classess, I use require_once to avoid multiple declarations - yet they happen. I put...
8
by: David T. Ashley | last post by:
Hi, Does require_once() treat "file.inc" and "subdirectory/file.inc" as the same things or different? The reason for my question is that I'd like to organize my PHP library into...
6
by: Shelly | last post by:
Here is a crazy question that has happend to me once before. I have an include file for the connection information to the server. It is like this: $hostname= "the_server_location"; $database...
7
by: Ronald Raygun | last post by:
I have been struggling with this all afternoon and I'm, well lats just say, very pissed off ... I have a require once in a file. I am passing the fully qualified (i.e. absolute pathname) to a...
4
by: Andrew G. Koptyaev | last post by:
Is I can use include_once() or require_once() in function or only include()?
5
by: vinpkl | last post by:
hi all i m having problem with including files and images geting disappear. i have images folder on the root. i have hdr.php in my included_files folder on root. if i include hder.php in my...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.