Software⏱️ 3 min read📅 2026-06-04

How to Fix: Error message Strict standards: Non-static method should not be called statically in php

Learn how to fix: Error message Strict standards: Non-static method should not be called statically in php.

Quick Answer: Try checking your system settings or restarting.

The 'Strict standards: Non-static method should not be called statically in php' error message occurs when you try to call a non-static method using the static keyword.

This issue is typically caused by trying to instantiate an object from a class that does not have a static constructor or is not designed to be instantiated.

💡 Why You Are Getting This Error

  • The problem arises when you use a class without creating an instance of it, which leads to the error message being displayed.
  • To fix this issue, ensure that you create an instance of the class before calling any non-static methods.

✅ Best Solutions to Fix It

Create an instance of the class

  1. Step 1: Use the 'new' keyword to create a new instance of the class.
  2. Step 2: For example: $page = Page::getInstanceByName(); // Replace with your actual method call.
  3. Step 3: This will ensure that you are calling a non-static method on an instance of the class, rather than trying to call it statically.

Use a static constructor or redesign the class

  1. Step 1: If the class is not designed to be instantiated, consider adding a static constructor to initialize the object.
  2. Step 2: Alternatively, redesign the class to make it suitable for instantiation and then create an instance of it before calling any non-static methods.

💡 Conclusion

By following these steps, you should be able to resolve the 'Strict standards: Non-static method should not be called statically in php' error message and ensure that your PHP code runs smoothly.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions