Link to home
Start Free TrialLog in
Avatar of Chris Andrews
Chris AndrewsFlag for United States of America

asked on

Undefined variable problem

yikes, this is a bit of a mess.

I'm moving my sites to a new server.  The new server has php5, (my old one just php4), but I can run sites through php4 via cgi.

On one of the scripts I am trying to run on the new server (using php4 for now), goes like this:

-------
if (!$loc){ //start if
 $time='<FONT COLOR="#223D75" STYLE="font-size: 13px">- time will appear here -</FONT>';}
--------

I'm getting an error like this:
---------
Notice: Undefined variable: loc in /home/mysite/public_html/data/wwc.php on line 5
--------

What do I do about that?  I mean, my whole 'if' test is to see if it has a value, and if it doesn't, do such and such.  

Do I need to write this differently, or change something in php.ini (it worked on my old server), or is there something else?

Thanks,  Chris

ps: the goal is to get all my sites php5 compatible, but I put them on php4 for now just to get them going so I can work on them.  I did try this site on php5 and got lots of errors, so I backed off and just going to try the smaller issues until I get everything moved.

ASKER CERTIFIED SOLUTION
Avatar of Todd Mummert
Todd Mummert

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Chris Andrews

ASKER

Thank you climbgunks,

I didn't get an answer from that page, per se, but it did lead me down the path of investigating .htaccess more closely, and I realized that I had

AddType application/x-httpd-php .php .php4 .php3  .html .htm

in .htaccess, and:

AddHandler php4-script .php .htm .html

in the httpd.conf file (to get the php4 cgi working).

Wondered if that might cause some problem, so I took it out of .htaccess and voila, things are working :)

So thanks for getting me going in the right direction!

Chris