Moved server, now site is covered with errors

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

Post Reply
davidtube
Forum Commoner
Posts: 79
Joined: Sun Mar 25, 2007 8:42 pm

Moved server, now site is covered with errors

Post by davidtube »

I think I need a lot of help. I've moved from a Windows server to a Linux one and now my site is covered with error messages. I've added this to a php file which is included on every page (if you're not too busy):

Code: Select all

error_reporting(E_ALL ^ E_NOTICE);
I've still got lots of errors though.

I'll show you the errors then the appropriate line of code and see if you know what's wrong:

Notice: Undefined index: email in /home/fhlinux160/w/website.co.uk/user/htdocs/signin.php on line 4

Code: Select all

$email = addslashes(trim($_POST['email']));

Notice: Use of undefined constant membership - assumed 'membership' in /home/fhlinux160/w/website.co.uk/user/htdocs/editproduct.php on line 3

Code: Select all

if($_SESSION[membership] != "current")

I assume this error is because the vardata[2] doesn't exist but some times it will exist and it all used to work properly:
Notice: Undefined offset: 2 in /home/fhlinux160/w/wikiprice.co.uk/user/htdocs/more.php on line 6

Code: Select all

$PATH_INFO = $_SERVER['PATH_INFO'];
   if(isset($PATH_INFO)) {   
      $vardata = explode('/', $PATH_INFO);
        $urlcat=$vardata[1];
		$urlsubcat=$vardata[2];
		}

This one shows up when an image can't be found.
function.getimagesize]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/fhlinux160/w/wikiprice.co.uk/user/htdocs/product.php on line 76
Warning: Division by zero in /home/fhlinux160/w/wikiprice.co.uk/user/htdocs/product.php on line 89
Warning: Division by zero in /home/fhlinux160/w/wikiprice.co.uk/user/htdocs/product.php on line 90

Code: Select all

$ix=$imageinfo[0];
$iy=$imageinfo[1];


if ($iy>$ix)
{
$nheight=$iy/$iy*250;
$nwidth=$ix/$iy*250;
}
else
{
$nheight=$iy/$ix*250;
$nwidth=$ix/$ix*250;
}
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Post by Jonah Bron »

I'm no php pro, but I think that

Code: Select all

if($_SESSION[membership] != "current")
is supposed to be

Code: Select all

if($_SESSION['membership'] != "current")
Was the old server php5 or php4? What is the new server?
davidtube
Forum Commoner
Posts: 79
Joined: Sun Mar 25, 2007 8:42 pm

Post by davidtube »

Great thanks. That fixed that one. Yeah I think i was on php4 but now on 5.2.3.

Does anyone know anything about the others?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

The other errors can be avoided with a few simple if checks and/or the use of isset().
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

var_dump($_SERVER); and see what comes out. I think the failure on getimagesize() it probably due to previous code not functioning correctly from the point where you try to explode $_SERVER['PATH_INFO'].
davidtube
Forum Commoner
Posts: 79
Joined: Sun Mar 25, 2007 8:42 pm

Post by davidtube »

Thanks. The getimagesize problem seems to be caused by the old server not being case sensitive with file names, whereas the Linux one is.

I've got a problem with file_exists(). Even the example on php.net isn't working. but the site says
"This function returns FALSE for files inaccessible due to safe mode restrictions. However these files still can be included if they are located in safe_mode_include_dir."

But I can't find info on how to use safe_mode_include_dir properly. I've got this code

Code: Select all

safe_mode_include_dir = http://website.co.uk/images/;
but i get an unexpect = error.
Last edited by davidtube on Sat Nov 17, 2007 11:28 am, edited 1 time in total.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

file_exists can return false if you don't have permission to access the files sometimes too. Check your permissions on the file/directory to make sure your web server can access them.
davidtube
Forum Commoner
Posts: 79
Joined: Sun Mar 25, 2007 8:42 pm

Post by davidtube »

Cheers but I've set the file permissions to 777 but it's still not working.
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

davidtube wrote:Cheers but I've set the file permissions to 777 but it's still not working.
Just the files or the directories containing the files as well?
Post Reply