Webhosting | Hosting - My Hosting PartnerWebhosting | Hosting - My Hosting PartnerWebhosting | Hosting - My Hosting PartnerWebhosting | Hosting - My Hosting Partner

Error messages in PHP

Error messages in PHP
MijnHostingPartner

Error messages in PHP

Reading out error messages in PHP

When you are developing your website, error messages are the order of the day. It is therefore important to learn how to deal with them and to know where to look when you get one. The extended PHP error messages are easy to turn on. We always recommend putting the following at the top of your file after the <?php tag. The short tags <? are not supported on MIjnHostingPartner.nl webhosting.

ini_set("display_errors", 1);

error_reporting(E_ALL);

These two lines of code will make sure you will see all error messages within PHP. After this you can immediately look further into what exactly is wrong. In these error messages are always the path of the file and the line of code where it goes wrong. If you then look into the files you will see which function or action causes the error message exactly. From there you can look at various sources.

Fixing it yourself

Often you can easily see from the piece of code where it goes wrong and if you have forgotten something. When you are just starting out in website development or you just can't see the wood for the trees, you can easily get stuck. If you can't solve it yourself then the next step is:

Find the error message and consult PHP.net

PHP.net is the official site of the code language PHP. Here they release the latest version which MijnHostingPartner.nl then makes available for you in your hosting. As the official site, they have a wealth of information available in their documentation. Among the documentation of PHP.net are also almost always examples posted by users. This works with a simple point system where the correct answer or clear piece of code appears at the top. You can then use that to solve your error message.

Tracking down the first part of the error message also provides the necessary information in many cases. Within PHP you can say that no problem is more original. This is because it is a popular language in which many content management systems are written. If you paste the entire error message in a search engine you will not get much result. This is because it is too specific. Think of the first part:

Fatal error: Call to undefined function

With the above information, we hope that you can solve your PHP error quickly!