How to fix any error in PHP

The most frustrating part of web development is getting stuck. Research also shows that when we get stuck we get angry because we are basically cavemen.

whitescreenofdeath
This is the famous white screen of death that you often find in PHP
This is a great way to get unstuck if you are working in PHP.

When a PHP file is broken your server will send you to a completely blank page. This might be very frustrating if you don’t know what to do with it. If you see the blank page, your PHP code is giving you an error. If you solve the error you website will work again.

So here is what you should do.

1. Remember that every time your PHP file is not working there is an error log and that you should search it. If you can’t fix it straight away, just go check out the error logs.

2 . Check out your apache error logs by typing this into your ubuntu server. This will print the errors to your screen.

  1. cat /var/log/apache2/error.log

3.  Your latest errors will be displayed last. Screenshot 2016-01-30 17.50.34

4. Googling your error message will help you find a solution.

Remember. Every time you see a blank PHP page. Search for the error logs using cat /var/log/apache2/error.log
(for ubuntu server). This will give you a nice error message to google.

Good luck!

Leave a Reply

Your email address will not be published. Required fields are marked *