0

Over the past week I've lost connection multiple times on a vital production server and as a result I was forced to make the switch to AWS EC2 Hosting. Utilizing a Debian based AMI I was able to build a similar build to what I was hosting locally on my own machines.

Long story short there is a fatal error being thrown now that works perfectly fine on the local servers that I can't track down the source of on the Debian based EC2 Instance.

If I painstakingly comment out various lines of code utilizing the DOM Module it quickly indicates other DOM Based objects do not register properly. More or less it is throwing consistent errors as follows.

Fatal error: Uncaught Error: Using $this when not in object context in /your/path/yourfile.php at line 21

I have tried unloading the php7.0 module as well as php7.0-xml I have also attempted to load it in with php5.6 which was used on the local server.

As a last ditch effort I even attempted to configure it with php7.2

Needless to say I am stumped.

Lelio Faieta
  • 6,457
  • 7
  • 40
  • 74
Justin
  • 1
  • 2
  • 1
    `$this when not in object context in /your/path/yourfile.php at line 21` is a pretty specific error message – bassxzero Jun 13 '18 at 13:36
  • show the code that raise the error... – Lelio Faieta Jun 13 '18 at 13:36
  • 2
    Possible duplicate of [PHP Fatal error: Using $this when not in object context](https://stackoverflow.com/questions/2350937/php-fatal-error-using-this-when-not-in-object-context) – Lelio Faieta Jun 13 '18 at 13:37
  • `$rootElement = new \DOMDocument(); $rootElement->appendChild($this->node = $rootElement->createElement($name));` – Justin Jun 13 '18 at 13:44
  • this error is about context, ie more code. Also you should be specific about which is line 21 AND you should paste your code by editing the question, not in a comment. – YvesLeBorg Jun 13 '18 at 14:56

0 Answers0