By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,575 Members | 1,395 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,575 IT Pros & Developers. It's quick & easy.

Require() & GD Library

P: n/a
I have 2 files... one that is very simple and only contains (for right
now):

<?php
$fontcolor = "0,0,0";
require("/home/rbrooks4/public_html/ticker/image.php");
?>

image.php is a simple image creation via GD library. When I go to the
first page, i get the generic image cannot be displayed because of
errors. However if I go to image.php and paste the $fontcolor =
"0,0,0"; line into the top of that file, the image displays. This says
I have some funkiness with my require(). Is this just not possible to
do? I don't understand what the difference is between the file pasted
above, and pasting the one line on top of image.php.

And yes, i took out the <? ?> tags of image.php when i used it as the
require.

Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Then put the <?php ?> tags back in the require()d script because that's
why it doesn't work. PHP scripts must always be delimited by <?php ?>
tags even when they are require()d by another PHP script.

Jul 17 '05 #2

P: n/a
errr yeah, yer right. I gotta start posting mid-day. That still didn't
fix my problem tho... i'm getting the same error.

Jul 17 '05 #3

P: n/a
Are you able to find out whether your PHP installation is running in
safe_mode or an open_basedir restriction is in effect?

If so it can sometimes help to use a relative rather than absolute path
to the included file, like:

<?php
require('../ticker/image.php');
?>

Or whatever the actual path is to your included file.

Jul 17 '05 #4

P: n/a
Jasper Bryant-Greene wrote:
Are you able to find out whether your PHP installation is running in
safe_mode or an open_basedir restriction is in effect?


Yeah, and no to both. Pretty sure that isn't it - I have other
require/includes on other pages that use absolute path.

Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.