Watchdog reset rst cause:4, boot mode:(3,6) on esp8266

So i’ve been experiencing this problem,only with this program.Basicly,the program strarts,the board get’s connected to my wifi,and then it gets wtd reset,and the proces repeats it self (like on a loop).
i’ve tried to change the pins,same ressult,same message.
Please help,i need this program for a project for my finals. Thanks.

#include <ESP8266WiFi.h>
const char* ssid = “Nikovi computers”;
const char* password = “PW”;

WiFiServer server(80);

String header;
String output4State = “off”;
String output5State = “off”;
String output7State = “off”;
String output8State = “off”;
int triggerPin = 9;
int echoPin = 12;
long vremetraenje, rastojanie;

long MikrosekundiVoCentimetri(long vremetraenje)
{
long d = (vremetraenje/2)*0.0343;
return d;
}
const int output4 = 4;
const int output5 = 5;
const int output7 = 7;
const int output8 = 8;
void setup() {
Serial.begin(115200);

Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(“Nikovi computers”);

WiFi.begin(“Nikovi computers”, “PW”);

while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println(“WiFi connected”);
Serial.print("My IP: ");
Serial.println(WiFi.localIP());
pinMode(echoPin, INPUT);
pinMode(triggerPin, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
digitalWrite(output4, LOW);
digitalWrite(output5, LOW);
digitalWrite(output7, LOW);
digitalWrite(output8, LOW);
}

void loop() {
WiFiClient client = server.available();

if (client) {
Serial.println(“New Client.”);
String currentLine = “”;
while (client.connected()) {
if (client.available()) {
char c = client.read();
Serial.write©;
header += c;
if (c == ‘\n’) {
if (currentLine.length() == 0) {

client.println("HTTP/1.1 200 OK");
        client.println("Content-type:text/html");
        client.println("Connection: close");
        client.println();
    }

vremetraenje = pulseIn(echoPin, HIGH);

rastojanie = MikrosekundiVoCentimetri(vremetraenje);
Serial.print("Rastojanieto e: ");
Serial.println(rastojanie);

if(rastojanie<=10){

Serial.println(“GPIO 4 on”);
digitalWrite(4, HIGH);
}
else
{
digitalWrite(4, LOW);
Serial.println(“GPIO 4 off”);
}

if(rastojanie<=6){
Serial.println(“GPIO 5 on”);
digitalWrite(5, HIGH);
}
else
{
Serial.println(“GPIO 5 off”);
digitalWrite(5, LOW);
}

if(rastojanie<=4){
Serial.println(“GPIO 7 on”);
digitalWrite(7, HIGH);
}
else
{
Serial.println(“GPIO 7 off”);
digitalWrite(7, LOW);
}

if(rastojanie<=2){
Serial.println(“GPIO 8 on”);
digitalWrite(8, HIGH);
}
else
{
Serial.println(“GPIO 8 off”);
digitalWrite(8, LOW);
}
digitalWrite(triggerPin, LOW);
delayMicroseconds(2);
digitalWrite(triggerPin, HIGH);
delayMicroseconds(10);
digitalWrite(triggerPin, LOW);

String webpage = "<h1>SCADA</h1>";
         webpage += "<p><h2>";
   if (rastojanie<=10)
   {
    webpage+= " Branata e polna do 25% od maksimalniot kapacitet";
    }
    else if(rastojanie<=6){
      webpage+= " Branata e polna do 50% od maksimalniot kapacitet";
      }
    else if(rastojanie<=4){
      webpage+= " Branata e polna do 75% od maksimalniot kapacitet";
      }
    else if(rastojanie<=2){
      webpage+= " Branata e polna do 100% od maksimalniot kapacitet";
      }
   webpage += "</h2></p></body>";
        client.println();
        break;
      } else { currentLine = "";
      }




  }
}
header = "";
client.stop();
Serial.println("Client disconnected.");
Serial.println("");

}
}

this is the line i get in the serial monitor.

ets Jan 8 2013,rst cause:4, boot mode:(3,6)
02:01:07.739 ->
02:01:07.739 -> wdt reset
02:01:07.739 -> load 0x4010f000, len 1384, room 16
02:01:07.739 -> tail 8
02:01:07.739 -> chksum 0x2d
02:01:07.739 -> csum 0x2d
02:01:07.739 -> vbc204a9b
02:01:07.739 -> ~ld

 i’ve tried everything i could possibly think of,so a new perspective could be nice.

I have the same problem … I tried everything … I searched a lot on google still I can’t find it’s the solution. you found any solution ???

for me the problem was the AP mode wifi interface.
To fix I turned off my wifi routers so I could boot the device without it resetting then in boot.py I turn off the AP interface and added the connection string for my wifi (turning off AP is the important part)

import network
ap_if = network.WLAN(network.AP_IF)
ap_if.active(False)
sta_if = network.WLAN(network.STA_IF)
sta_if.active(True)
sta_if.connect("SSID","PASSWORD")