wuno
wuno

Reputation: 9885

Finding Value Of An Index When Index Not Found

I am migrating a site to a new server.

On the first server the site run fine.

In the new server some file paths are changing do to the Server_Root_Dir_Path

I am clearing errors and 2 of the errors are the typical and common

Notice: Undefined index: page in /home4/filepath/index.php on line 6

Notice: Undefined variable: admin in /filePAth/libraries.php on line 3

Notice: Undefined index: theme in /home4/filepath/index.php on line 6

My question is...

In this situation I am trying to solve each notice and error.

So I start with the variable and I want to know the value of it so since its undefined on Server B

I go to Server A and var_dump($admin);

Is there some type of equivalent on server A to see what page or theme are exactly?

This is how they are in the actual files,

if ($_GET["page"]=="my_home"){$_GET["page"]="my_handshakes";}



elseif($_COOKIE["theme"]){

I realize I could just add isset to these but when I do the errors and notice clear but then the page loads blank.

So to be clear,

Is there a way to basically var_dump the page or theme on the first server that the site is running perfectly on to see what their values are supposed to be?

Upvotes: 0

Views: 26

Answers (2)

IMSoP
IMSoP

Reputation: 97996

From the code you posted, the variable it is looking for is $_GET["page"]. "Undefined index" means it found the $_GET array, but no item in it with the key "page".

So, firstly, yes, you can var_dump($_GET["page"]) on your working server, nothing special needed there.

Secondly, though, you should know that $_GET represents the query string of the currently loaded page, so unless there is some really ugly code creating fake entries in it, what is actually expected is a URL containing ?page=something.

Finally, have you actually tried setting the old server to have the same setting of error_reporting as the new one? Since these are notices, it's entirely possible that they've been there all along, but hidden by your settings, and the actual problem with the page is somewhere else altogether.

Upvotes: 1

Ahmad
Ahmad

Reputation: 437

I used to face this problem the reason was 2 :-

  1. The best is to fix them if possible.

  2. Try to keep php version >=5.3

  3. Disable warning and notices because when i was developing on my localhost warnings were disabled while on live server it was enabled hence i disabled them and it was okay... But keep error reporting on... remember we have different error levels and what i was getting is warning hence i disabled it.

Thanks

Upvotes: 0

Related Questions