Page 1 of 1

Moved server, now site is covered with errors

Posted: Thu Nov 15, 2007 12:57 pm
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;
}

Posted: Thu Nov 15, 2007 1:42 pm
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?

Posted: Thu Nov 15, 2007 2:32 pm
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?

Posted: Thu Nov 15, 2007 4:53 pm
by feyd
The other errors can be avoided with a few simple if checks and/or the use of isset().

Posted: Thu Nov 15, 2007 6:31 pm
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'].

Posted: Sat Nov 17, 2007 11:06 am
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.

Posted: Sat Nov 17, 2007 11:27 am
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.

Posted: Sat Nov 17, 2007 11:34 am
by davidtube
Cheers but I've set the file permissions to 777 but it's still not working.

Posted: Sat Nov 17, 2007 11:58 am
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?