error 500 on server

Asked

Viewed 249 times

2

The errors found were:

Notice: A session had already been started - ignoring session_start()
getdate(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone.
Undefined variable: resultadoVer
Notice: A session had already been started - ignoring session_start()
Notice: Undefined index: Key
Notice: Trying to get property of non-object
Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone.

Regarding the source code, we are using POO:

include("inc/Conecta.class.php");
include("inc/Metodos.class.php");
$metodos = new Metodos();

We make the connection:

class Conecta{

      private $Servidor = 'XXX';
      private $Usuario = 'XXX';
      private $Senha = 'XXX';
      private $Banco = 'XXX';


        protected $Conecta;
        protected $Teste;

     public function conectar(){   


       $this->Conecta = mysqli_connect($this->Servidor,$this->Usuario,$this->Senha,$this->Banco) or die("Erro 001: Erro ao conectar no servidor");

       if ($this->Conecta == false) {
          printf("Erro ao conectar: %s\n", mysqli_connect_errnor());
          $this->erro(mysqli_connect_errnor());
          exit();
       }

       mysqli_set_charset($this->Conecta, "utf8");   

      }

      public function erro($erro_valor){
             error_log(filter_input(INPUT_SERVER,"PHP_SELF")." - Erro: 01 (".@date("d/m/Y") ." as ".@date("H:i").") - ".$erro_valor."\r\n",3,"log/erro.log");
      }

     public function fechar(){
         mysqli_close($this->Conecta);      
    }
 }

And Metodos.class.php has almost 2000 lines, it would be a lot. So we’re doing it this way:

      class Metodos extends Conecta{

    ***// As linhas seguem abaixo***  

// Erro:  getdate(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone.
$hoje = getdate();

// Erro:  Undefined variable: resultadoVer
$resultadoVer .= "<div class=\"list-group\">"; 

// Erro:  Undefined property: stdClass::$IdCodUsuarios
public function usuariosOnline($idUsuarios) {
        $resultados = "<a href='enviar.php?Key=".$jmVerPerfil->IdCodUsuarios."'";
return $resultados;
}

// Erro: Notice: Trying to get property of non-object

public function cadastrarVisitas($id,$idVisitado){

          $conectar = new Conecta(); 
          $conectar->conectar();
$sqlVerificar = mysqli_query($conectar->Conecta, "SELECT * FROM verificar WHERE IdVisitantes = ".$id." AND IdVisitado = ".$jmVisitado->IdUsuarios."");
......
}

The PHP version of the current server is PHP: 5.5.23. From the old server I can’t remember.

  • Error 500 is programming, enable error messages on production host, see php tag wiki the blank screen item.

  • Sorry, I couldn’t understand you..

  • It is usually because of the disabled php or mod_rewrite version or your file . htaccess is encoding GOOD.

  • Add these two lines in the first file that is loaded: ini_set('display_errors', true); error_reporting(E_ALL); then edit the reply put the error message and the source code. Which is php version of the old and current host?

  • Hi Leandro... actually we are not using . htaccess.

  • Alright rray, I’ll be including the lines and posting here the error.

  • I changed the answer with the bugs and the code

  • Place lines where errors are indicated, it does not need to be the whole code.

  • Hello rray. I put the errors found and the lines...

  • Other than the question title, the data you passed as errors are not errors, performing a basic reading are Notices and Warning which do not generate error 500 would be interesting to have more information or even you could take a look at apache log to get the real problem.

  • Okay, Otto... after you put in the code that rray gave you, all you get is a warning.. Does that mean it could be from the server itself? We are in a Linux hosting...

  • through my search, I saw that it can be PHP memory_limit settings. To change the code, you would have to put ini_set("memory_limit","256M"); right?

  • 1

    Managed to solve your problem?

Show 8 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.