Page 1 of 2

brain fried

Posted: Wed Jul 30, 2003 11:16 pm
by matthiasone
How do you fix a php script when you load the file on the web browser and you can a blank page? :roll:

Posted: Wed Jul 30, 2003 11:21 pm
by jmarcv
depends on the script. Peek-a-boo, I don't see you ... script.

Never hurts to ask, I hear.

Posted: Wed Jul 30, 2003 11:26 pm
by nielsene
First try a "view/show" source in the browser (normally part of the View menu in IE/Moz/Netscape ... See if anything's there, maybe you just have a some funny html element that's not ending, or a endless quote. If the view/show source is blank, too then you have to check into your script to make sure its producing output.

You can always use the inefficient, but ever-popular echo "i'm here!"; method of debugging by placing that line at various places in your code and seeing if it gets outputed, etc

Posted: Wed Jul 30, 2003 11:27 pm
by matthiasone
well..........I moved hosting services........they worked before the move. Some of the pages work fine......

Posted: Wed Jul 30, 2003 11:29 pm
by nielsene
Hmm one quick check. Does the new host support PHP? If yes, do they support short tags? If no, did you previously use them?

How do the versions of PHP compare from old to new host?

Posted: Wed Jul 30, 2003 11:29 pm
by jmarcv
Well I guess it never hurts to ask the ISP to look into it.

Posted: Wed Jul 30, 2003 11:30 pm
by matthiasone
I look at the source before posting on here........it just contains

Code: Select all

<html><body></body></html>

Posted: Wed Jul 30, 2003 11:33 pm
by matthiasone
Like i said some of the php pages work and some are blank. Version old PHP 4.1.1 - new PHP 4.3.1

Posted: Wed Jul 30, 2003 11:34 pm
by jmarcv
Well, I guess you got problems then. If you want help, I suggest you let us look at the php.

Posted: Wed Jul 30, 2003 11:35 pm
by nielsene
matthiasone wrote:I look at the source before posting on here........it just contains

Code: Select all

&lt;html&gt;&lt;body&gt;&lt;/body&gt;&lt;/html&gt;
OK, that probably means that PHP is executing, so that's a start. And it means the the short-tags thing probably isn't the problem.

It normally means that your script is executing, but not producing any output. Did you rely on register globals before?

Try adding

Code: Select all

error_reporting(E_ALL);
to the top of your script. You might have some unset/undefined variables that used to be set my the old ISP, that aren't being set now, causing an unexpected fall-through of dispatch/display logic.

Posted: Wed Jul 30, 2003 11:42 pm
by matthiasone
ok did that on one the scripts......got......

Code: Select all

Notice: Undefined variable: page in /usr/web/domains/christs-church/www/cm/prayer.php on line 4

Notice: Undefined variable: page in /usr/web/domains/christs-church/www/cm/prayer.php on line 6

Notice: Undefined variable: page in /usr/web/domains/christs-church/www/cm/prayer.php on line 8

Notice: Undefined variable: page in /usr/web/domains/christs-church/www/cm/prayer.php on line 10

Notice: Undefined variable: page in /usr/web/domains/christs-church/www/cm/prayer.php on line 12
which I believe are referring global variable.........variable from the URL

but one of my script that works or appears to...

I have looked at the phpinfo.php.....but couldn't find globals settings to see what they are set too.

Posted: Wed Jul 30, 2003 11:43 pm
by matthiasone
here is the first 13 lines of the script

Code: Select all

error_reporting(E_ALL);
  require_once('db_fns.php');
  if($page == "new")
    prayer_new();
  elseif($page == "add")
    prayer_db($HTTP_POST_VARS,'n');
  elseif($page == "upd")
    prayer_db($HTTP_POST_VARS,'u');
  elseif($page == "list")
    prayer_list();
  elseif($page == "edit")
    prayer_edit($id);

Posted: Wed Jul 30, 2003 11:46 pm
by jmarcv
All that error means is you didn't predefine the variable. How are you outputting, lets see a script, or are you just going to continue to ignore me?

Posted: Wed Jul 30, 2003 11:49 pm
by matthiasone
I finally found the setting ........globals are off.......I will contact the hosting service and see about getting it turned on

Sorry to trouble everyone

:oops:

Posted: Wed Jul 30, 2003 11:49 pm
by nielsene
OK this is the common register_globals problem. as to be expected when the 4.2.0 line is crossed.

Try adding

Code: Select all

$page = $_GET["page"];
(I'm assuming you're using GET....)