TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,022
  • Total Topics: 21,332
  • Online today: 899
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 1
  • Guests: 691
  • Total: 692
  • @rjen

fatal error

Started by lAJl, March 23, 2008, 10:43:58 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

lAJl

ok im trying to install a server status block for a BF2 server but when i add the bit of php this shows up on the front page


Fatal error: (null)() [function.require]: Failed opening required 'lgsl/lgsl_files/lgsl_zone.php' (include_path='.:/usr/php4/lib/php:/usr/local/php4/lib/php') in /home/vkcommun/public_html/website/Sources/Load.php(1744) : eval()'d code(35) : eval()'d code on line 3

here is the code

<?php
$lgsl_zone_number = 1;
  $output = "";
  require "lgsl/lgsl_files/lgsl_zone.php";
  echo $output;
?>

can someone pls help

G6Cad

Line 3 seem to be the output, what output do you have to write in there between the " " ?


JPDeni

Three things.

First, if you're using a php block, you do not need and cannot have <?php and ?>. Remove them from your block.

Second, require must have parentheses.


$lgsl_zone_number = 1;
  $output = "";
  require("lgsl/lgsl_files/lgsl_zone.php");
  echo $output;


Third, what G6 said. ;) If you're going to be passing values between your block and your external file, you have to declare the variables as global. Something like:


global $output, $lgsl_zone_number;
$lgsl_zone_number = 1;
  $output = "";
  require("lgsl/lgsl_files/lgsl_zone.php");
  echo $output;


You'll also have to be sure that global line is in your external file.

lAJl

#3
well i am new to php so i am realy confused
also the readme did say what to put as the output
i attatched the readme file i am using the standalone version... ;)

JPDeni

Try the points I posted one at a time. You absolutely cannot have the opening and closing php tags in a php block. Take those out and see what happens.

As for the () around the file path on the require... It doesn't say how old that file is. It could be that require did not need parentheses at one time, but if you look up the require function on a php site, you'll see that the parens are used. At any rate, it's not going to cause any more problems than what you are having now, so what can it hurt?

Possibly you can manage without the global line. Try changing the other things and see if it works. If it doesn't add the global lines. They won't hurt anything if they're there and you don't need them.

lAJl

well i am still getin the same error when i do them all one at a time i have no idea what is wrong

JPDeni

Where is your file located, relative to your SMF files?

lAJl

#7
my smf files are not in the same directery as the server status file
this is what its like...

public_html/lgsl/(server status file are in that folder)
public_html/website/(SMF files)

JPDeni

Well that would explain it. The script can't figure out where the file is.

If you don't want it to be with your SMF files, you should probably just put the entire path into your block, which often starts with "home". So it might be "/home/public_html/lgsl/lgsl_files/lgsl_zone.php". I can't be certain, of course, because there are variations. Try some different permutations until you find the right one.

lAJl

yup that was the problem it works hey thx man

This website is proudly hosted on Crocweb Cloud Website Hosting.