brain fried

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

matthiasone
Forum Contributor
Posts: 117
Joined: Mon Jul 22, 2002 12:14 pm
Location: Texas, USA
Contact:

brain fried

Post 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:
jmarcv
Forum Contributor
Posts: 131
Joined: Tue Jul 29, 2003 7:17 pm
Location: Colorado

Post by jmarcv »

depends on the script. Peek-a-boo, I don't see you ... script.

Never hurts to ask, I hear.
User avatar
nielsene
DevNet Resident
Posts: 1834
Joined: Fri Aug 16, 2002 8:57 am
Location: Watertown, MA

Post 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
matthiasone
Forum Contributor
Posts: 117
Joined: Mon Jul 22, 2002 12:14 pm
Location: Texas, USA
Contact:

Post by matthiasone »

well..........I moved hosting services........they worked before the move. Some of the pages work fine......
User avatar
nielsene
DevNet Resident
Posts: 1834
Joined: Fri Aug 16, 2002 8:57 am
Location: Watertown, MA

Post 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?
jmarcv
Forum Contributor
Posts: 131
Joined: Tue Jul 29, 2003 7:17 pm
Location: Colorado

Post by jmarcv »

Well I guess it never hurts to ask the ISP to look into it.
matthiasone
Forum Contributor
Posts: 117
Joined: Mon Jul 22, 2002 12:14 pm
Location: Texas, USA
Contact:

Post by matthiasone »

I look at the source before posting on here........it just contains

Code: Select all

<html><body></body></html>
matthiasone
Forum Contributor
Posts: 117
Joined: Mon Jul 22, 2002 12:14 pm
Location: Texas, USA
Contact:

Post 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
jmarcv
Forum Contributor
Posts: 131
Joined: Tue Jul 29, 2003 7:17 pm
Location: Colorado

Post by jmarcv »

Well, I guess you got problems then. If you want help, I suggest you let us look at the php.
User avatar
nielsene
DevNet Resident
Posts: 1834
Joined: Fri Aug 16, 2002 8:57 am
Location: Watertown, MA

Post 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.
matthiasone
Forum Contributor
Posts: 117
Joined: Mon Jul 22, 2002 12:14 pm
Location: Texas, USA
Contact:

Post 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.
matthiasone
Forum Contributor
Posts: 117
Joined: Mon Jul 22, 2002 12:14 pm
Location: Texas, USA
Contact:

Post 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);
jmarcv
Forum Contributor
Posts: 131
Joined: Tue Jul 29, 2003 7:17 pm
Location: Colorado

Post 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?
matthiasone
Forum Contributor
Posts: 117
Joined: Mon Jul 22, 2002 12:14 pm
Location: Texas, USA
Contact:

Post 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:
User avatar
nielsene
DevNet Resident
Posts: 1834
Joined: Fri Aug 16, 2002 8:57 am
Location: Watertown, MA

Post 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....)
Post Reply